Reputation: 2641
I have a project which involve me to map some random objects in NYC(Astoria Park, etc). Now I'm using openalayer3 and osm to display a map, but I having a hard time understanding how to calculate coordinates for NYC. I have made a map, but it is focused on city of London:
var city = ol.proj.transform([-0.12755, 51.507222], 'EPSG:4326', 'EPSG:3857');
Coordinates for Astoria Park(40.780229N, 73.920935W), but obviously this are not the coordinates that I'm locking for, I have read about ol.proj.transform
, but I can't understand how to calculate this.
Can someone explain me how can I overcome this and learn something, thank you.
Upvotes: 1
Views: 278
Reputation: 21469
OpenLayers uses coordinates in the form of longitude, latitude. 40.780229,-73.920935
are the correct coordinates for Astoria Park, New York, however in latitude, longitude. Try var city = ol.proj.transform([-73.920935, 40.780229], 'EPSG:4326', 'EPSG:3857');
instead.
Upvotes: 1