polygon cooridinates array massive confusion
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, #ff, 0.2); map.addOverlay(polygon); 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, #ff, 0.2); map.addOverlay(polygon); 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, #ff, 0.2); map.addOverlay(polygon); I want to use an array of points... what the hell am and I doing wrong? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: polygon cooridinates array massive confusion
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, #ff, 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, #ff, 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, #ff, 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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: polygon cooridinates array massive confusion
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: 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, #ff, 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: var polygon = new GPolygon(points, #f33f00, 5, 1, #ff, 0.2); map.addOverlay(polygon); 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, #ff, 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, #ff, 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, #ff, 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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: polygon cooridinates array massive confusion
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, #ff, 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, #ff, 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, #ff, 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, #ff, 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, #ff, 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, #ff, 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 -~--~~~~--~~--~--~---
Re: polygon cooridinates array massive confusion
(37.4419, -132.0419) That's a pair of numbers. You couldn't use it to represent, say, a point on a map because there is no frame of reference. 37.4419 of what? Relative to where? GLatLng((37.4419, -132.0419) That's a point which you can put on a map, because GLatLng is defined against a particular reference system. Hence why GPolygon wants an array of those as opposed to a jumble of numbers. Why are you trying to avoid GLatLng(), it's not 'geocoding' as you hinted earlier, it doesn't make any requests to servers or anything? I guess you could write your own MyPolygon function that behaved like Gpolygon but accepted an array of number arrays. cheers, Ross K --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: polygon cooridinates array massive confusion
Hi Larry and Ross, Because my polygon I want has a ton of points, and I didn't want to figure out how to use KML to import the points. My skillz are obliviously infantile. I just wanted to feed it an array of numbers, i'll try creating a function like suggested. On Dec 10, 9:56 am, Rossko [EMAIL PROTECTED] wrote: (37.4419, -132.0419) That's a pair of numbers. You couldn't use it to represent, say, a point on a map because there is no frame of reference. 37.4419 of what? Relative to where? GLatLng((37.4419, -132.0419) That's a point which you can put on a map, because GLatLng is defined against a particular reference system. Hence why GPolygon wants an array of those as opposed to a jumble of numbers. Why are you trying to avoid GLatLng(), it's not 'geocoding' as you hinted earlier, it doesn't make any requests to servers or anything? I guess you could write your own MyPolygon function that behaved like Gpolygon but accepted an array of number arrays. cheers, Ross K --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: polygon cooridinates array massive confusion
Wasn't it [EMAIL PROTECTED] who wrote: You could potentially extend the GLatLng class to have a contructor that takes a string... There already is one, but it's undocumented var point = GLatLng.fromUrlValue(37.4419, -132.0419); -- http://econym.org.uk/gmap The Blackpool Community Church Javascript Team --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---