You should include a link to your page, so we can see the whole generated page.

Your code works if I copy/paste it into a framework map.

Perhaps you havent included geotools.js correctly ?

you should also read 'potential pitfalls' here:
http://econym.org.uk/gmap/basic1.htm



On 11/06/2009, Tom Cavanagh <[email protected]> wrote:
>
>  I have created a ASP script using geotools now which should loop
>  through all of the grid references in a database.
>
>         response.write("<script type=""text/javascript"">" & vbcrlf)
>         response.write("function initialize() {" & vbcrlf)
>       response.write("if (GBrowserIsCompatible()) {" & vbcrlf)
>         response.write("var map = new GMap2(document.getElementById
>  (""map_canvas""));" & vbcrlf)
>                 response.write("//map.setMapType(G_SATELLITE_MAP);" & vbcrlf)
>         response.write("map.setCenter(new GLatLng(54.228719,
>  -1.027345), 6);" & vbcrlf)
>       response.write("}" & vbcrlf)
>     response.write("}" & vbcrlf)
>
>     response.Write("</script>")
>
>         i = 1
>         do while not rs.eof
>                 id = rs.fields("id")
>                 'response.Write(i & "<br />")
>                         response.write("<script langauge=""javascript"">" & 
> vbcrlf)
>
>                                 response.write("var gr=""" & 
> rs.fields("grid_ref") & """;" &
>  vbcrlf)
>                                 response.write("var osgb = new GT_OSGB();" & 
> vbcrlf)
>                                 'response.write("document.write(gr)" & vbcrlf)
>
>                                 response.write("if (osgb.parseGridRef(gr))" & 
> vbcrlf)
>                                 response.write("{" & vbcrlf)
>                                         response.write("var wgs84 = 
> osgb.getWGS84();" & vbcrlf)
>
>                                         response.write("var lat = 
> wgs84.latitude;" & vbcrlf)
>                                         response.write("var long = 
> wgs84.longitude;" & vbcrlf)
>
>                                         
> 'response.Write("document.write(long+"" ""+lat)")
>
>                                 response.Write("initialize();") & vbcrlf
>                                 response.write("var info = new GMarker(new 
> GLatLng(wgs84.latitude,
>  wgs84.longitude));" & vbcrlf)
>                                 response.write("map.addOverlay(info);" & 
> vbcrlf)
>                                 
> response.write("info.openInfoWindowHtml(""<strong>" & rs.fields
>  ("grid_ref") & "</strong>"");" & vbcrlf)
>
>                         response.write("}" & vbcrlf)
>
>                         response.Write("</script>" & vbcrlf)
>
>                 i = i + 1
>         rs.movenext
>         loop
>
>  now once i run the page it loops through them all ok except that the
>  GLatLng in the GMarker is blank.
>
>  the source code looks like this
>
>  var gr="SD 80558 71330";
>  var osgb = new GT_OSGB();
>  if (osgb.parseGridRef(gr))
>  {
>  var wgs84 = osgb.getWGS84();
>  var lat = wgs84.latitude;
>  var long = wgs84.longitude;
>  initialize();
>  var info = new GMarker(new GLatLng(wgs84.latitude, wgs84.longitude));
>  map.addOverlay(info);
>  info.openInfoWindowHtml("<strong>SD 80558 71330</strong>");
>  }
>
>
>  any help to get these being filled in correectly?
>
>  many thanks.
>
>  Tom
>
>  On Jun 11, 11:30 am, Barry Hunter <[email protected]> wrote:
>
> > On 11/06/2009, JavaJive <[email protected]> wrote:
>  >
>  >
>  >
>  > >  On Jun 10, 11:41 pm, Barry Hunter <[email protected]> wrote:
>  >
>  > >  >http://www.nearby.org.uk/tests/GeoTools.html
>  >
>  > > Note: Can't cope with Irish (inc Northern Ireland)
>  >
>  > there is a link to the top of the page - to a version that does work
>  > with Irish grid :)
>  >
>  > I do have a non released (read: experimental) for ITM grid - the
>  > probable new system for Ireland.
>  >
>  > > or Channel Islands,
>  >
>  > true. there are a few possible grid systems there too :(
>  >
>  > >  which is fair enough for many purposes, but really in such situations
>  > >  it should give an error message rather than a misleading incorrect
>  > >  result!
>  >
>  > thats easy enough to check in userland. there are many grid systems
>  > the code doent cope with :)
>  >
>  >
>  >
>  > >  > example of using it with gmaps 
> apihttp://www.geograph.org.uk/submitmap.php
>  >
>  > >  Seems to require registration to see anything useful?
>  >
>  > Opps, forgot that.
>  >
>  > another example 
> here:http://www.nearby.org.uk/blog/2008/09/27/grid-references-on-google-maps/
>  > (its a mapplet, but the api is very similar to the maps api)
>  >
>  > but it should be easy to see how to do it from the documentation
>  >
>  >
>  >
>  > --
>
> > Barry
>  >
>  > -www.nearby.org.uk-www.geograph.org.uk-
>
> >
>


-- 
Barry

- www.nearby.org.uk - www.geograph.org.uk -

--~--~---------~--~----~------------~-------~--~----~
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