I've been pulling my hair over this issue for a day now when I'm
working on a very time-sensitive project, so any assistance on this
would be greatly appreciated.

I've been working on displaying polygon overlays on a map to represent
different jurisdictions in the state of Virginia.  I need to allow a
user to select a jurisdiction and display pricing for the mapping-
based products available within that particular jurisdiction.

I'm getting a Javascript error when I attempt to add the encoded
polygon or polyline to the map:

a is undefined
Mg.prototype.extend=function(a){this.Da.extend(a.Kd());this.va.extend
(a.Ld())};
main.js line 386

I'm debugging in Firefox 3 using Firebug, but this same issue happens
in Firefox 2 as well.  (I upgraded in order to eliminate the browser
as an issue; Also, I have installs of Firefox 2 and 3 running
concurrently in case I need to debug something in Firefox 2 in the
future.)

I've searched this group and online to see if others have had similar
issues.  I've eliminated the following common problems:

* Forgetting to use map.setCenter first (I'm setting it)
* Forgetting to use escaping backslashes when encoding a polyline, or
using them when not appropriate (apparently I don't need to use them
as the JSON encoding handles the encoded polylines successfully -- see
the end of this post)
* Improperly encoding a polyline (I successfully tested decoding my
polyline/level at the link below, which checks for such things as
having more or less encoded levels than points, for instance)

http://code.google.com/apis/maps/documentation/polylineutility.html

* Encoding a polyline with a certain numLevels/zoomFactor and then
attempting to display them with the wrong numLevels/zoomFactor.  I'm
using 18/2 for both encoding and decoding.

For debugging purposes, I've frozen my code here:

http://www.vbmpselect.com/map_polygon.php
http://www.vbmpselect.com/map_polyline.php

I'm deliberately selecting a very short polygon or polyline from the
set of multiple polygons representing the very first jurisdiction in
Virginia, "Accomack".  Only Accomack is in the database right now for
simplicity's sake in debugging this issue.

I'm using AJAX to load the overlays after the page itself loads.  I'm
also using Prototype/Scriptaculous, so I'd like to ask if there are
any known conflicts with the latest version of that vs. the latest
version of Google Maps.  The last time I used Google Maps to display
polylines for another project I did about a year ago, I used
Scriptaculous and it didn't cause a problem.

My client, desperate to help me get this fixed as soon as possible,
got someone from Google on the phone last night and they mentioned
that Google's own polygon example isn't displaying anything right
now!  So apparently there might be a bug in the latest version of
Google's mapping API.

http://code.google.com/apis/maps/documentation/examples/polygon-simple.html

On the other hand, their polyline *is* displaying and mine isn't.

This is where I'm at.  Previously I attempted to import KML to display
the polygon overlays, since that's what the client had available.  I
would have used some boundary-detection code to figure out whether or
not a user's mouse click was inside a particular jurisdiction, instead
of using the API as I'm doing above.  Unfortunately I ran into serious
limitations doing it this way.  The client's single KML file
containing the boundaries for all of the jurisdictions in Virginia was
way too big for Google Maps to handle.  Nothing displayed at all.
Eliminating all but the first jurisdiction did work, but trying to
display the first and the second didn't.  I didn't relish trying to
import a KML file for every single jurisdiction, or seeing whether I
would run into a limitation that way as well.  It looks like I have no
choice but to try the KML method for now, as I absolutely must have at
least *something* functional this morning (Monday morning) or my
client will lose his contract and I won't get paid.

For debugging purposes, I'm storing the results of grabbing the
boundaries in the "bounds" global variable (containing the encoded
polylines and levels), and the jurisdictions in the "jurisdictions"
global variable (containing the generated polygons/polylines).  I've
established that I can successfully generate polygons/polylines, so I
know I'm not having any issues with forgetting to use escaping
backslashes, for instance.  (In fact, if I add escaping backslashes to
the encoded polyline strings, then I don't get polygons/polylines at
all.)

bounds[0].polygons[20][0] is the boundary for the first jurisdiction,
the 20th polygon in that jurisdiction, and the first polyline in that
polygon (representing encoded polygons that potentially have holes in
them).  This is an object that contains the encoded polylines and
levels (poly and levels, respectively).  For debugging purposes, I'm
attempting to display the 20th polyline as it's much shorter than the
first, which is about 6800 points.  I wanted to eliminate the size of
the line as an issue.

jurisdiction[1][0] is the first polygon/polyline that I'm saving for
the jurisdiction with id #1 (which is actually for the 20th encoded
polygon/polyline, since I'm skipping the others for debugging
purposes).  I'm saving it in this global array after adding it to the
map, for event detection purposes.

Any help would be GREATLY appreciated.  Even my hair will thank you.

Damon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to