Solved

Google Maps API 3 -- Polyline breaks in IE

Posted on 2011-03-25
3
913 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
Comment Utility
Hi there,

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

Regards,
EZFrag
0
 

Author Comment

by:Glen Gibb
Comment Utility
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
Comment Utility
See my post with the actual answer.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

771 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now