MrRalphMan Posted July 21, 2008 Share Posted July 21, 2008 Is there anyway to plot a shape using a set of lon/lat points? I've done a quick search but cannot seem to find an api to be able to do this. Cheers, Paul. Link to comment Share on other sites More sharing options...
sdavies Posted July 21, 2008 Share Posted July 21, 2008 Check out: http://code.google.com/apis/maps/documentation/overlays.html GPolyline - Drawing Poly lines into a layer may be what you are after? e.g. from the above: var polyline = new GPolyline([ new GLatLng(37.4419, -122.1419), new GLatLng(37.4519, -122.1519) ], "#ff0000", 10); map.addOverlay(polyline); Edit: Actually just about any of the drawing stuff below that point looks cool... might start playing with that myself :D:D Cheers, Si. Link to comment Share on other sites More sharing options...
MrRalphMan Posted July 25, 2008 Author Share Posted July 25, 2008 Thanks, looks like it's exactly what I needed, worked in work, but at home I don't see the overlay.. That's on two PC's... Can anyone else see the overlay here? If so can you place the following code in a HTML file and open it in your browser.. Then maybe attach a screen shot of the map and overlay? Cheers.. Paul. Google Maps JavaScript API Example: Simple Polygon type="text/javascript"> <br /> function initialize() {<br /> if (GBrowserIsCompatible()) {<br /> var map = new GMap2(document.getElementById("map_canvas"));<br /> map.setCenter(new GLatLng(51.59363, 0.429238), 20);<br /> map.addControl(new GSmallMapControl());<br /> GEvent.addListener(map, "click", function(overlay,latlng) {<br /> var polygon = new GPolygon([<br /> new GLatLng(51.59363, 0.429238),<br /> new GLatLng(51.60295, 0.42461),<br /> new GLatLng(51.59428, 0.418858),<br /> new GLatLng(51.59363, 0.429238)<br /> ], "#f33f00", 5, 1, "#ff0000", 0.2);<br /> map.addOverlay(polygon);<br /> });<br /> }<br /> } <br /> <br /> Link to comment Share on other sites More sharing options...
arvind8811 Posted July 25, 2008 Share Posted July 25, 2008 good post I've been working on GM for almost a year now. Link to comment Share on other sites More sharing options...
MrRalphMan Posted July 25, 2008 Author Share Posted July 25, 2008 As in using it or developing for it? Link to comment Share on other sites More sharing options...
arvind8811 Posted July 25, 2008 Share Posted July 25, 2008 developing mate http://tourism.wales.info uses GM. Its still work in progress tho sometimes its really a PITA lol but challenging Link to comment Share on other sites More sharing options...
MrRalphMan Posted July 25, 2008 Author Share Posted July 25, 2008 I see all the other examples, but not the poly overlay Link to comment Share on other sites More sharing options...
arvind8811 Posted July 25, 2008 Share Posted July 25, 2008 yeah i never got use the polygon overlays buts it sounds interesting, have to try myself sometime Link to comment Share on other sites More sharing options...
sdavies Posted July 25, 2008 Share Posted July 25, 2008 MrRalphMan said: Thanks, looks like it's exactly what I needed, worked in work, but at home I don't see the overlay.. That's on two PC's... Can anyone else see the overlay here? If so can you place the following code in a HTML file and open it in your browser.. Then maybe attach a screen shot of the map and overlay? Cheers.. Paul. Google Maps JavaScript API Example: Simple Polygon type="text/javascript"> <br /> function initialize() {<br /> if (GBrowserIsCompatible()) {<br /> var map = new GMap2(document.getElementById("map_canvas"));<br /> map.setCenter(new GLatLng(51.59363, 0.429238), 20);<br /> map.addControl(new GSmallMapControl());<br /> GEvent.addListener(map, "click", function(overlay,latlng) {<br /> var polygon = new GPolygon([<br /> new GLatLng(51.59363, 0.429238),<br /> new GLatLng(51.60295, 0.42461),<br /> new GLatLng(51.59428, 0.418858),<br /> new GLatLng(51.59363, 0.429238)<br /> ], "#f33f00", 5, 1, "#ff0000", 0.2);<br /> map.addOverlay(polygon);<br /> });<br /> }<br /> } <br /> <br /> I had to zoom out a bit to find where the polygon had ... gone I am sure there is a joke in there somewhere. http://www.istslice.co.uk/pics/a08654/mapsnapshot.png Edit: p.s. I meant to mention MacOS 10.5.4 using Firefox 3.0.1. Edit2: p.p.s Looks to work on Firefox 3.0.1 on WindowsXP and also IE 7. Link to comment Share on other sites More sharing options...
MrRalphMan Posted July 25, 2008 Author Share Posted July 25, 2008 Thanks dude, no joke there. I'm trying to debug some ..... err .... issues with the Speed Camera detection for GPS Speedo.. Link to comment Share on other sites More sharing options...
arvind8811 Posted July 25, 2008 Share Posted July 25, 2008 have you tried the Google Earth plugin on the maps? its nice and fun Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now