Skip to content

Commit

Permalink
Merge pull request #1353 from OpenGeoscience/epsg-io-updates
Browse files Browse the repository at this point in the history
fix: Update epsg.io calls
  • Loading branch information
manthey authored Dec 10, 2024
2 parents 4353a25 + b8bd2fb commit 4aaa9a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,14 @@ transform.lookup = function (projection) {
code = parts[1];

return $.ajax({
url: 'https://epsg.io/?q=' + code + '&format=json'
url: 'https://epsg.io/' + encodeURIComponent(code) + '.proj4'
}).done(function (data) {
var result = (data.results || [])[0];
if (!result || !result.proj4) {
if (!result) {
return defer.reject(data).promise();
}

proj4.defs(projection, result.proj4);
proj4.defs(projection, result);
return $.when(proj4.defs[projection]);
});
};
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('geo.transform', function () {
geo.transform.lookup('EPSG:5000').then(spy);

request = server.requests[0];
expect(request.url).toMatch(/\?q=5000/);
expect(request.url).toMatch(/5000\.proj4/);
request.respond(200, {'Content-Type': 'application/json'}, JSON.stringify({
status: 'ok',
number_result: 1,
Expand Down

0 comments on commit 4aaa9a6

Please sign in to comment.