Jump to content
The mkiv Supra Owners Club

Google Maps, anyway to plot a shape using the lon/lat values?


MrRalphMan

Recommended Posts

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:D

 

Cheers,

 

Si.

Link to comment
Share on other sites

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. You might also be interested in our Guidelines, Privacy Policy and Terms of Use.