Solved

Google Maps API 3 -- Polyline breaks in IE

Posted on 2011-03-25
3
919 Views
Last Modified: 2012-06-27
Experts,

I'm sorry to be part of the long line of "It Doesn't Work in IE" but here goes.

I'm trying to add a polyline to a pair of latlng points.  Works great in Chrome, Opera and FF.

In IE 8 i receive the following:
******************
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; AskTbARS/5.8.0.12304)
Timestamp: Fri, 25 Mar 2011 08:23:59 UTC

Message: Arg: Fraction out of range (0 to 1 allowed)
Line: 8
Char: 202
Code: 0
URI: http://maps.gstatic.com/intl/en_ca/mapfiles/api-3/4/6a/main.js
**************
The map and the markers seem to render correctly, sort of, but the polyline is definitely missing and any attempt to zoom breaks the thing entirely.

I've searched for solutions and tried different header settings, all of which have no effect.

I need this proof of concept working on IE by Thursday next week

Can you point me to a solution?

Capt

PS -- I'll supply further info should you need it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml"
		xmlns:v="urn:schemas-microsoft-com:vml"> <head><style type="text/css">v\:* { behavior:url(#default#VML); }</style><meta http-equiv=""X-UA-Compatible" content="IE=EmulateIE7" ><meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

Open in new window

0
Comment
Question by:Glen Gibb
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
EZFrag earned 500 total points
ID: 35214103
Hi there,

Is there any chance that you can provide your source code?

Regards,
EZFrag
0
 

Author Comment

by:Glen Gibb
ID: 35215270
Thanks for your reply.  Here's the source code.  

I found the answer in a Google Forum -- apparently the "Fraction was caused by a strokeOpacity setting that was neither 1 nor 0.

The example that I was working from set the original strokeOpacity value to 5, which IE totally choked on.  The other browsers handled it just fine.

As soon as the value changed, the error cleared right up and I had the desired PolyLine.

Tnx,

Capt
// add polyline points for line ...
					if (eqType == 1)
					{
						$.ajax(
						{
							type: 'get',
							url: 'ajax_end_points.php',
							contentType: 'html; charset=utf-8',
							dataType: 'json',
							data: 'eqId=' + items.equipmentPK,
							async: false,
							success: function(data)
							{
								endLat = data[0] * 1;
								endLon = data[1] * 1;
								var pts = [
									new google.maps.LatLng(startLat, startLon),
									new google.maps.LatLng(endLat, endLon)
								];
								//alert(pts);
								// IE error: strokeOpacity must be 1 (Arg: fraction)  ...
								var polyln = new google.maps.Polyline( {
									path: pts,
									strokeColor: '#000',
									strokeOpacity: 1,
									strokeWeight: 5
								});
								// connect the points ...
								polyln.setMap(map);
							}
						});
					}

Open in new window

0
 

Author Closing Comment

by:Glen Gibb
ID: 35215281
See my post with the actual answer.
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question