Using Proj4js with OpenLayers to transform lat lng from 4326 to 27700 but coming out unchangedUsing Proj4js in Openlayers - Proj4js is not definedOpenLayers/proj4js and the EPSG:27700 (UK) ProjectionOpenLayers transform EPSG 27700 coordinate to Google 900913Problems with features, popups and strategy with OpenLayersOpenLayers.Bounds transform not working as expectedGet Lat & Lng from GeoDjango OSMGeoAdminOpenlayers Transform not transforming a point from EPSG 27700 to EPSG 4326Using Proj4js in Openlayers - Proj4js is not definedUsing OSGB (ESPG: 27700) projection in Openlayers with MousePositionOpenLayers and proj4js.defs() - why does one custom projection work and not the other?Problem on changing the EPSG:3376 to EPSG:4326 using Proj4js
Why was this character made Grand Maester?
Python program to take in two strings and print the larger string
Freedom of Speech and Assembly in China
Why are GND pads often only connected by four traces?
Grade-school elementary algebra presented in an abstract-algebra style?
Where is Jon going?
Why is the Eisenstein ideal paper so great?
Why did other houses not demand this?
How to let other coworkers know that I don't share my coworker's political views?
How was Daenerys able to legitimise this character?
My players want to grind XP but we're using landmark advancement
Is my plasma cannon concept viable?
What is the view of Buddhism in correcting others' view in spite of their willingness to accept it?
Why didn't Thanos use the Time Stone to stop the Avengers' plan?
Non-containing subsets of two sizes
Writing style before Elements of Style
Which European Languages are not Indo-European?
Can I tell a prospective employee that everyone in the team is leaving?
How do I superimpose two math symbols?
Do photons bend spacetime or not?
Of strange atmospheres - the survivable but unbreathable
The disk image is 497GB smaller than the target device
How to deal with a colleague who is being aggressive?
Can you output map values in visualforce inline using a string key?
Using Proj4js with OpenLayers to transform lat lng from 4326 to 27700 but coming out unchanged
Using Proj4js in Openlayers - Proj4js is not definedOpenLayers/proj4js and the EPSG:27700 (UK) ProjectionOpenLayers transform EPSG 27700 coordinate to Google 900913Problems with features, popups and strategy with OpenLayersOpenLayers.Bounds transform not working as expectedGet Lat & Lng from GeoDjango OSMGeoAdminOpenlayers Transform not transforming a point from EPSG 27700 to EPSG 4326Using Proj4js in Openlayers - Proj4js is not definedUsing OSGB (ESPG: 27700) projection in Openlayers with MousePositionOpenLayers and proj4js.defs() - why does one custom projection work and not the other?Problem on changing the EPSG:3376 to EPSG:4326 using Proj4js
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Using Proj4js to transform lat lng from 4326 to 27700 but coming out unchanged. I am using OpenLayers 2.12 (OS API Leisure map) EPSG 27700, Proj4js (CDN)
I have added the definition to proj4
epsg4326 = new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection
// To
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
console.log(lonLat);
lonLat is coming out as lon: -0.1279688, lat: 51.5077286 so unchanged.
I think I'm missing a trick.
openlayers-2 proj4js
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Using Proj4js to transform lat lng from 4326 to 27700 but coming out unchanged. I am using OpenLayers 2.12 (OS API Leisure map) EPSG 27700, Proj4js (CDN)
I have added the definition to proj4
epsg4326 = new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection
// To
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
console.log(lonLat);
lonLat is coming out as lon: -0.1279688, lat: 51.5077286 so unchanged.
I think I'm missing a trick.
openlayers-2 proj4js
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Using Proj4js to transform lat lng from 4326 to 27700 but coming out unchanged. I am using OpenLayers 2.12 (OS API Leisure map) EPSG 27700, Proj4js (CDN)
I have added the definition to proj4
epsg4326 = new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection
// To
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
console.log(lonLat);
lonLat is coming out as lon: -0.1279688, lat: 51.5077286 so unchanged.
I think I'm missing a trick.
openlayers-2 proj4js
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Using Proj4js to transform lat lng from 4326 to 27700 but coming out unchanged. I am using OpenLayers 2.12 (OS API Leisure map) EPSG 27700, Proj4js (CDN)
I have added the definition to proj4
epsg4326 = new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection
// To
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
console.log(lonLat);
lonLat is coming out as lon: -0.1279688, lat: 51.5077286 so unchanged.
I think I'm missing a trick.
openlayers-2 proj4js
openlayers-2 proj4js
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 9 hours ago
Ian Turton♦
51.2k548120
51.2k548120
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 9 hours ago
Simon JeffsSimon Jeffs
111
111
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
transform converts the point in place so no new point is returned. See the documentation:
Transform the LonLat object from source to dest. This transformation is in place: if you want a new lonlat, use .clone() first.
So you want something like:
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286);
lonLat.transform(epsg4326, EPSG27700);
console.log(lonLat);
The transformation is in place, but it still returns the result, for example inmap.setCenter(new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));
– Mike
9 hours ago
Thanks for the tip, however both still output the original lat/lng
– Simon Jeffs
8 hours ago
add a comment |
OpenLayers 2 uses an earlier proj4 (version 1.1.0) syntax:
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs ";
or with proj4 version 2:
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.Proj4js =
Proj: function(code)
return proj4(Proj4js.defs[code]);
,
defs: proj4.defs,
transform: proj4
;
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
alert(lonLat.lon + ' ' + lonLat.lat);
</script>
</body>
</html>
If you are using the OS API some transforms are built in openspace.ordnancesurvey.co.uk/docs/4.0.0/files/OpenSpace/…
– Mike
9 hours ago
We were using the openspace api but are migrating to the OS API apidocs.os.uk/docs/os-maps-overview so have to remove the OpenSpace reference
– Simon Jeffs
9 hours ago
see also gis.stackexchange.com/questions/120021/…
– Mike
8 hours ago
add a comment |
Ok, I figured out my issue. I looked at the post Mike shared Using Proj4js in Openlayers - Proj4js is not defined and tried the example code in my project which still failed. That narrowed it down to the js references. So I copied the references and et voila; success!
My references:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4-src.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js
Changed to:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.min.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js
Note that it worked with both versions of OpenLayers js file but not when using 2.5.0.
Thanks to Ian and Mike for helping!
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2..5.0 is working for me. I've added the code to my answer.
– Mike
5 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Simon Jeffs is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f323552%2fusing-proj4js-with-openlayers-to-transform-lat-lng-from-4326-to-27700-but-coming%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
transform converts the point in place so no new point is returned. See the documentation:
Transform the LonLat object from source to dest. This transformation is in place: if you want a new lonlat, use .clone() first.
So you want something like:
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286);
lonLat.transform(epsg4326, EPSG27700);
console.log(lonLat);
The transformation is in place, but it still returns the result, for example inmap.setCenter(new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));
– Mike
9 hours ago
Thanks for the tip, however both still output the original lat/lng
– Simon Jeffs
8 hours ago
add a comment |
transform converts the point in place so no new point is returned. See the documentation:
Transform the LonLat object from source to dest. This transformation is in place: if you want a new lonlat, use .clone() first.
So you want something like:
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286);
lonLat.transform(epsg4326, EPSG27700);
console.log(lonLat);
The transformation is in place, but it still returns the result, for example inmap.setCenter(new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));
– Mike
9 hours ago
Thanks for the tip, however both still output the original lat/lng
– Simon Jeffs
8 hours ago
add a comment |
transform converts the point in place so no new point is returned. See the documentation:
Transform the LonLat object from source to dest. This transformation is in place: if you want a new lonlat, use .clone() first.
So you want something like:
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286);
lonLat.transform(epsg4326, EPSG27700);
console.log(lonLat);
transform converts the point in place so no new point is returned. See the documentation:
Transform the LonLat object from source to dest. This transformation is in place: if you want a new lonlat, use .clone() first.
So you want something like:
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286);
lonLat.transform(epsg4326, EPSG27700);
console.log(lonLat);
answered 9 hours ago
Ian Turton♦Ian Turton
51.2k548120
51.2k548120
The transformation is in place, but it still returns the result, for example inmap.setCenter(new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));
– Mike
9 hours ago
Thanks for the tip, however both still output the original lat/lng
– Simon Jeffs
8 hours ago
add a comment |
The transformation is in place, but it still returns the result, for example inmap.setCenter(new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));
– Mike
9 hours ago
Thanks for the tip, however both still output the original lat/lng
– Simon Jeffs
8 hours ago
The transformation is in place, but it still returns the result, for example in
map.setCenter(new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));– Mike
9 hours ago
The transformation is in place, but it still returns the result, for example in
map.setCenter(new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()));– Mike
9 hours ago
Thanks for the tip, however both still output the original lat/lng
– Simon Jeffs
8 hours ago
Thanks for the tip, however both still output the original lat/lng
– Simon Jeffs
8 hours ago
add a comment |
OpenLayers 2 uses an earlier proj4 (version 1.1.0) syntax:
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs ";
or with proj4 version 2:
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.Proj4js =
Proj: function(code)
return proj4(Proj4js.defs[code]);
,
defs: proj4.defs,
transform: proj4
;
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
alert(lonLat.lon + ' ' + lonLat.lat);
</script>
</body>
</html>
If you are using the OS API some transforms are built in openspace.ordnancesurvey.co.uk/docs/4.0.0/files/OpenSpace/…
– Mike
9 hours ago
We were using the openspace api but are migrating to the OS API apidocs.os.uk/docs/os-maps-overview so have to remove the OpenSpace reference
– Simon Jeffs
9 hours ago
see also gis.stackexchange.com/questions/120021/…
– Mike
8 hours ago
add a comment |
OpenLayers 2 uses an earlier proj4 (version 1.1.0) syntax:
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs ";
or with proj4 version 2:
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.Proj4js =
Proj: function(code)
return proj4(Proj4js.defs[code]);
,
defs: proj4.defs,
transform: proj4
;
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
alert(lonLat.lon + ' ' + lonLat.lat);
</script>
</body>
</html>
If you are using the OS API some transforms are built in openspace.ordnancesurvey.co.uk/docs/4.0.0/files/OpenSpace/…
– Mike
9 hours ago
We were using the openspace api but are migrating to the OS API apidocs.os.uk/docs/os-maps-overview so have to remove the OpenSpace reference
– Simon Jeffs
9 hours ago
see also gis.stackexchange.com/questions/120021/…
– Mike
8 hours ago
add a comment |
OpenLayers 2 uses an earlier proj4 (version 1.1.0) syntax:
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs ";
or with proj4 version 2:
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.Proj4js =
Proj: function(code)
return proj4(Proj4js.defs[code]);
,
defs: proj4.defs,
transform: proj4
;
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
alert(lonLat.lon + ' ' + lonLat.lat);
</script>
</body>
</html>
OpenLayers 2 uses an earlier proj4 (version 1.1.0) syntax:
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs ";
or with proj4 version 2:
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.Proj4js =
Proj: function(code)
return proj4(Proj4js.defs[code]);
,
defs: proj4.defs,
transform: proj4
;
proj4.defs("EPSG:27700","+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs");
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var EPSG27700 = new OpenLayers.Projection("EPSG:27700");
var lonLat = new OpenLayers.LonLat(-0.1279688, 51.5077286).transform(epsg4326, EPSG27700);
alert(lonLat.lon + ' ' + lonLat.lat);
</script>
</body>
</html>
edited 5 hours ago
answered 9 hours ago
MikeMike
2,905139
2,905139
If you are using the OS API some transforms are built in openspace.ordnancesurvey.co.uk/docs/4.0.0/files/OpenSpace/…
– Mike
9 hours ago
We were using the openspace api but are migrating to the OS API apidocs.os.uk/docs/os-maps-overview so have to remove the OpenSpace reference
– Simon Jeffs
9 hours ago
see also gis.stackexchange.com/questions/120021/…
– Mike
8 hours ago
add a comment |
If you are using the OS API some transforms are built in openspace.ordnancesurvey.co.uk/docs/4.0.0/files/OpenSpace/…
– Mike
9 hours ago
We were using the openspace api but are migrating to the OS API apidocs.os.uk/docs/os-maps-overview so have to remove the OpenSpace reference
– Simon Jeffs
9 hours ago
see also gis.stackexchange.com/questions/120021/…
– Mike
8 hours ago
If you are using the OS API some transforms are built in openspace.ordnancesurvey.co.uk/docs/4.0.0/files/OpenSpace/…
– Mike
9 hours ago
If you are using the OS API some transforms are built in openspace.ordnancesurvey.co.uk/docs/4.0.0/files/OpenSpace/…
– Mike
9 hours ago
We were using the openspace api but are migrating to the OS API apidocs.os.uk/docs/os-maps-overview so have to remove the OpenSpace reference
– Simon Jeffs
9 hours ago
We were using the openspace api but are migrating to the OS API apidocs.os.uk/docs/os-maps-overview so have to remove the OpenSpace reference
– Simon Jeffs
9 hours ago
see also gis.stackexchange.com/questions/120021/…
– Mike
8 hours ago
see also gis.stackexchange.com/questions/120021/…
– Mike
8 hours ago
add a comment |
Ok, I figured out my issue. I looked at the post Mike shared Using Proj4js in Openlayers - Proj4js is not defined and tried the example code in my project which still failed. That narrowed it down to the js references. So I copied the references and et voila; success!
My references:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4-src.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js
Changed to:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.min.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js
Note that it worked with both versions of OpenLayers js file but not when using 2.5.0.
Thanks to Ian and Mike for helping!
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2..5.0 is working for me. I've added the code to my answer.
– Mike
5 hours ago
add a comment |
Ok, I figured out my issue. I looked at the post Mike shared Using Proj4js in Openlayers - Proj4js is not defined and tried the example code in my project which still failed. That narrowed it down to the js references. So I copied the references and et voila; success!
My references:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4-src.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js
Changed to:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.min.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js
Note that it worked with both versions of OpenLayers js file but not when using 2.5.0.
Thanks to Ian and Mike for helping!
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2..5.0 is working for me. I've added the code to my answer.
– Mike
5 hours ago
add a comment |
Ok, I figured out my issue. I looked at the post Mike shared Using Proj4js in Openlayers - Proj4js is not defined and tried the example code in my project which still failed. That narrowed it down to the js references. So I copied the references and et voila; success!
My references:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4-src.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js
Changed to:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.min.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js
Note that it worked with both versions of OpenLayers js file but not when using 2.5.0.
Thanks to Ian and Mike for helping!
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Ok, I figured out my issue. I looked at the post Mike shared Using Proj4js in Openlayers - Proj4js is not defined and tried the example code in my project which still failed. That narrowed it down to the js references. So I copied the references and et voila; success!
My references:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4-src.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/OpenLayers.min.js
Changed to:
https://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.min.js
https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js
Note that it worked with both versions of OpenLayers js file but not when using 2.5.0.
Thanks to Ian and Mike for helping!
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 6 hours ago
Simon JeffsSimon Jeffs
111
111
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Simon Jeffs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2..5.0 is working for me. I've added the code to my answer.
– Mike
5 hours ago
add a comment |
2..5.0 is working for me. I've added the code to my answer.
– Mike
5 hours ago
2..5.0 is working for me. I've added the code to my answer.
– Mike
5 hours ago
2..5.0 is working for me. I've added the code to my answer.
– Mike
5 hours ago
add a comment |
Simon Jeffs is a new contributor. Be nice, and check out our Code of Conduct.
Simon Jeffs is a new contributor. Be nice, and check out our Code of Conduct.
Simon Jeffs is a new contributor. Be nice, and check out our Code of Conduct.
Simon Jeffs is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f323552%2fusing-proj4js-with-openlayers-to-transform-lat-lng-from-4326-to-27700-but-coming%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown