Hello,
We are having a problem with implementing GPS in our MVC solution. We copied the ‘Mylocation demo’ from the sample (included in installation).
When we use a Google overlay as base layer, the GPS functionality works correctly. However, when we use another (custom overlay) as base layer (the layer has EPSG:28992), the GPS location isn’t positioned correctly.
This probably has something to do with transforming the projection from WGS84 (EPSG: 4326) to EPSG: 28992. What are we doing wrong?
We also noticed that the standard getProjectobject is EPSG 4326 even when our base layer is set to EPSG 28992.
Hope to hear from you soon.
Regards,
Jeroen
GPS Problems with MVC
Hi Jeroen,
Have you also transformed your GPS location point from 4326 to 28992?
Regards,
Don
the code we use is.
location: function (position) {
var proj = new OpenLayers.Projection(“EPSG:4326”);
var projRD = new OpenLayers.Projection(“EPSG:28992”);
var point = new OpenLayers.LonLat(position.coords.longitude, position.coords.latitude);
point.transform(proj, projRD);
GIS.ajaxCallAction(’@ViewContext.RouteData.Values[“Controller”].ToString()’, ‘PlotPoint’, { x: point.lon, y: point.lat }, mapCallback);
GIS.setCenter(point, 20, false, false);
},
Hi Jeroen,
From "When we use a Google overlay as base layer, the GPS functionality works correctly", I think the GPS location should have the same projection(epsg:900913), so when you are using a layer with EPSG:28992, the GPS location should be transformed from 900913 rather 4326. Would you please "var proj = new OpenLayers.Projection("EPSG:4326");" to "var proj = new OpenLayers.Projection("EPSG:900913");" .
Hope it helps
Summer