[mapguide-users] Mapguide fusion 2.6 | geolocation issue

Jacco Wanders | TTE Consultants wanders at engineers.nl
Fri Jan 31 02:28:39 PST 2014


Hans and Jackie,

Thanks for the quick repley!

The geolocation fucntion is slightly working..:) 

If the coordinate system setting in the mapsetting is Netherlands- RD-new the geolocation works on bingmap..
However, if the coordinate system in map setting is WGS84.PseudoMercator nothing happens, except underlying message
"  Your position is outside of the initial view of the map"

I found below code for the WGS84.PseudoMercator (I can't see this one in the http://svn.osgeo.org/fusion/trunk/layers/MapGuide/php/csmap2proj4.js), of which I think I have to use.

Proj4js.defs["EPSG:3857"] = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"

I hope you can tell me how I can incorporate the right coordinate conversion (LL84 -> WGS84.PseudoMercator transformation) in my fusion php script (see below please).. As you probably already noticed, this is something where i am terrible bad in. 

<html>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<script src="http://176.74.246.104/mapguide/proj4js/lib/proj4js-combined.js"></script>

//Proj4js.defs["EPSG:3857"] = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"

 <iframe width=100% height=99% src="http://176.74.246.104/mapguide/fusion/templates/mapguide/slate/index.html?ApplicationDefinition=Library://Hembrug_MT/FlexibleLayouts/test.ApplicationDefinition&locale=en"></iframe>
</body>
</html>


Thanks for any  taken efforts.
Jacco

------------------------------

Message: 8
Date: Thu, 30 Jan 2014 04:41:41 -0800 (PST)
From: Hans Milling <hm at geograf.dk>
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] Mapguide fusion 2.6 | geolocation issue
Message-ID: <1391085701205-5100913.post at n6.nabble.com>
Content-Type: text/plain; charset=us-ascii

You can use the Proj4js library to convert the GPS coordinates from WGS84 to something else. Then you can see what coordinates your GPS device is reporting relative to the projection that your map is using. This is what I do to convert to UTM32N:

Proj4js.defs["EPSG:25832"] = "+proj=utm +zone=32 +ellps=GRS80 +units=m
+no_defs"; // Not sure if needed or this is just related to my 
+OpenLayers
map.

var gpsll = new Proj4js.Point(gpslongitude, gpslatitude); var source = new Proj4js.Proj('EPSG:4326'); var dest = new Proj4js.Proj('EPSG:25832'); var utm32n = Proj4js.transform(source, dest, gpsll);
console.log("x: "+umt32n.x+", y: "+utm32n.y); //<-Does not work in old versions of IE

Best regards
  Hans Milling


More information about the mapguide-users mailing list