1

I am currently plotting points on a Open Street Map and using the Lat and Long of a point I know of seems to yield different positions on Google Maps and Open Street Map.

//The standard for lat/long projection
var projection = new OpenLayers.Projection("EPSG:4326");;

//Set the bounds of the map controls, etc
var mapOptions = {
    controls: [
        new OpenLayers.Control.Navigation(),
        new OpenLayers.Control.PanZoomBar(),
        new OpenLayers.Control.Attribution(),
        new OpenLayers.Control.LayerSwitcher()
    ]
};

var map = new OpenLayers.Map("OpenStreetMap", mapOptions);
map.addLayer(new OpenLayers.Layer.OSM());

var testPointLonLat = new OpenLayers.LonLat(-1.4629669, 53.3822659).transform(
    projection, // transform from WGS 1984 (EU Equivalent)
    map.getProjectionObject() // to Spherical Mercator
);
var testPointMarker = new OpenLayers.Marker(testPointLonLat);

//Create a markers layer to add
var markers = new OpenLayers.Layer.Markers("Markers");

markers.addMarker(testPointMarker);

//Add all the markers which will be loaded via ajax shortly
map.addLayer(markers);

//Centers the map around a particular lon/lat at a specified zoom level
var zoom = 13;
map.setCenter(basePointLonLat, zoom);

This code has been taken from Open Street Maps website as part of one of their examples.

This is the basis of which I use to set a point of a known Lat/Long on a Map, in this case London Eye. On Google using the Lat/Long of the exact location on their map, I plotted it against a Open Street Map. The exact same co-ordinates appear incorrectly in the middle of the river:

Google Version

Google Version

Open Street Map Version

Open Street Map Version

I cannot seem to see the reason as to why the points are incorrectly placed with a margin of error with the same LatLong co-ordinates. I have a lot of points otherwise plotted and all of them are incorrectly placed too high or in the sea at times.

Tried updating to OpenLayers 3, still the same problem, points are never consistently placed on the map.

To add to this I swapped out OpenStreetMap to Bing Maps and the Lat/Long still appears in the wrong place so I have to assume it is something to do with OpenLayers.

1

The short answer is that the co-ordinates used in both systems are probably not absolutely 'correct' or accurate.

Where something actually IS located is dependent on many factors (including time - Australia is moving northward by about 7cm a year).

In addition a co-ordinate system like that used in Google maps is a way to represent points on a sphere on a flat, square map. That's why places like Greenland look huge on flat maps - it's distorted by the projection.

I would not use google maps to plot co-ordinates if I was going to create a map in another API with a different 'base' layer. Try this site to get some lat/long values that will 'work': http://www.hmmm.ip3.co.uk/longitude-latitude/ (London Eye: Latitude: 51.503066 Longitude: -0.119514)

1

Replicated your result by transforming the var testPointLonLat

SRID:4326 --> SRID:3857

point(-1.4629669 53.3822659) --> point(-13551.109744 6710813.510179)

http://epsg.io/map#srs=3857&x=-13551.109744&y=6710813.510179&z=16

enter image description here

The "London Eye" has the following coordinates

-0.1217317 51.503324 (Google Maps)
-0.119686  51.503286 (EPSG.io SRID: 4326)

https://www.google.no/maps/place/London+Eye/@51.503324,-0.1217317 http://epsg.io/map#srs=4326&x=-0.119686&y=51.503286&z=17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.