On Dec 10, 9:39 am, Dave Llorens <[EMAIL PROTECTED]> wrote: > My apologies I should be more clear. I would like to use a long array > of numbers without geocoding them individually like in the example > that works. When I document.write(GLatLong(37.4419, -132.0419)) it > just returns "(37.4419, -132.0419)", but yet this does not work:
That is because it has a method that outputs a string representation when you do that... > > var polygon = new GPolygon([ > (37.4419, -132.0419), > (47.3419, -122.1419), > (37.4419, -112.2419), > (27.5419, -122.1419), > (37.4419, -132.0419) > ], "#f33f00", 5, 1, "#ff0000", 0.2); > map.addOverlay(polygon); > > I think this is the best way I can word my question: > > how I define the array "points" that contains 5 lat/lon coordinates > without using GLatLng more than once, so that the following draws a > polygon: You could potentially extend the GLatLng class to have a contructor that takes a string... > > var polygon = new GPolygon(points, "#f33f00", 5, 1, "#ff0000", 0.2); > map.addOverlay(polygon); The GPolygon points argument is an array of GLatLngs. http://code.google.com/apis/maps/documentation/reference.html#GPolygon You could write a function that takes an array of your "points" and returns an array of GLatLngs var polygon = new GPolygon(toGLL(points), "#f33f00", 5, 1, "#ff0000", 0.2); -- Larry > > On Dec 10, 9:01 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > > > On Dec 10, 8:52 am, Dave Llorens <[EMAIL PROTECTED]> wrote: > > > > THIS DRAWS A POLYGON > > > > var polygon = new GPolygon([ > > > new GLatLng(37.4419, -132.0419), > > > new GLatLng(47.3419, -122.1419), > > > new GLatLng(37.4419, -112.2419), > > > new GLatLng(27.5419, -122.1419), > > > new GLatLng(37.4419, -132.0419) > > > ], "#f33f00", 5, 1, "#ff0000", 0.2); > > > map.addOverlay(polygon); > > > This is an array of GLatLngs... > > > > THIS DOES NOT > > > > var polygon = new GPolygon([ > > > [37.4419, -132.0419] > > > [47.3419, -122.1419] > > > [37.4419, -112.2419] > > > [27.5419, -122.1419] > > > [37.4419, -132.0419] > > > ], "#f33f00", 5, 1, "#ff0000", 0.2); > > > map.addOverlay(polygon); > > > This is an array of arrays of numbers. > > > > THIS DOES NOT > > > > points = [[37.4419, -132.0419], [47.3419, -122.1419], [37.4419, > > > -112.2419], [27.5419, -122.1419], [37.4419, -132.0419]]; > > > > var polygon = new GPolygon(points, "#f33f00", 5, 1, > > > "#ff0000", 0.2); > > > map.addOverlay(polygon); > > > This is an array of arrays of numbers. > > > > I want to use an array of points... what the hell am and I doing > > > wrong? > > > Define "points". It works when you use an array of GLatLngs (which > > are what I call points). It doesn't work when you don't because the > > GPolygon constructor expects an array of GLatLngs as its argument. > > > -- Larry- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to Google-Maps-API@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---