ok no problem, thanks anyway.
Basically i have rewritten a quick script that does the conversion
which is below.
Now this script adds the marker fine but the conversion is completly
off, if i put the lat, long in manually which i know then it displays
correctly but if i let it pick up the variables long and lat that have
been converted then it goes in a completly different place.
Maybe you can help with this one.
Many Thanks
Tom
<script src="geotools2.js" type="text/javascript"></script>
<script type="text/javascript">
var gr="SE 634 819";
var osgb = new GT_OSGB();
var wgs84=osgb.getWGS84();
lat = wgs84.latitude;
long = wgs84.longitude;
document.write(lat+"<br />"+long)
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(51.448444,-0.118446), 6);
map.setUIToDefault();
// Create a base icon for all of our markers that specifies
the
// shadow, icon dimensions, etc.
var baseIcon = new GIcon(G_DEFAULT_ICON);
// Creates a marker whose info window displays the letter
corresponding
// to the given index.
function createMarker(point, letter, address) {
// Create a lettered icon for this point using our icon
class
var letteredIcon = new GIcon(baseIcon);
letteredIcon.image = "http://www.google.com/mapfiles/
marker"+letter+".png";
// Set up our GMarkerOptions object
markerOptions = { icon:letteredIcon };
var marker = new GMarker(point, markerOptions);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(address);
});
return marker;
}
var point = new GLatLng(lat, long);
map.addOverlay(createMarker(point, "A", "10 Raleigh Gardens,<br
/>
London<br /> SW2"));
}
}
</script>
On Jun 11, 2:14 pm, Barry Hunter <[email protected]> wrote:
> Sorry, can't really help you then.
>
> http://groups.google.com/group/Google-Maps-API/web/why-including-a-li...
>
> As I say it works for me.
>
> On 11/06/2009, Tom Cavanagh <[email protected]> wrote:
>
>
>
>
>
> > The site is working on local only as no hosting etc yet,
>
> > i have geotools included above with
>
> > <script src="geotools2.js" type="text/javascript"></script>
>
> > basically no markers are placed on the map and i am getting a is null
> > error in the console
>
> > Tom
>
> > On Jun 11, 1:41 pm, Barry Hunter <[email protected]> wrote:
> > > 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-
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---