Hi Folks I'm trying to create a map based on a tutorial I found. The tutorial has a piece of code for the start point; // define point as a new LonLat object and transfom point = new OpenLayers.LonLat(-4.225, 57.478); point.transform("EPSG:4326", "EPSG:3857"); I can follow what this code does but it centers the map in Scotland. I'm looking to center it in Dublin. In Google Earth the coordinates I want are 53.285756, -6.141998. But when I put that in, OpenStreetMap sends me to somewhere near the Seychelles. Can you help with how I can convert it correctly? I'm a beginners so apologies if I've not explained it correctly. Thanks. asked 02 Apr '17, 11:24 Shane_Ire
showing 5 of 6
show 1 more comments
|
Perhaps you could explain a little more fully what it is you're trying to do when you say "create a map."
Which program or website are you plugging the coordinates into?
When I put 53.285756, -6.141998 into JOSM, the OSM editor program, it takes me to a golf course in Dublin, so the coordinates are reasonably accurate.
Cheers
Dave
Hi Dave
I'm only just learning Web based GIS. So here are the details. I have GeoServer 2.8.2 hosted on a VM. It is also the webserver. I have a simple HTML page calling OpenLayers and a .js file.
<script src="http://www.openlayers.org/api/OpenLayers.js"></script> <script type="text/JavaScript" src="map.js"></script>
In the .js file I am using OpenLayer and OSM;
//create new map object map = new OpenLayers.Map("mymap");
When I enter this code and open the page via http://localhost:8080/geoserver/www/index.html. It opens off the coast of Africa.
// define point as a new LonLat object and transform point = new OpenLayers.LonLat(53.285756, -6.141998); //point.transform("EPSG:4326", "EPSG:3857");
As I say, I'm new to this so might not be explaining it well. Thanks
Thanks for the information. This list is watched by many smart OSM folks who can possibly help and I'm sure you'll get some answers shortly. But I'm afraid I can't be of much help because I have no expertise in the area you're addressing.
Best,
Dave
Are you mixing up latitude and longitude?
OpenLayers.LonLat()
requires longitude first, then latitude (as the name of the function already indicates).Thanks Dave, sorted it. Had to clear out Internet cache.
For Info i cut and paste your coords in OSMs search box and got this http://www.openstreetmap.org/search?query=53.285756%2C%20-6.141998#map=16/53.2858/-6.1420