Skip to content

Commit

Permalink
fix: Update epsg.io calls
Browse files Browse the repository at this point in the history
The current interface is changing.

Closes #1349.
  • Loading branch information
manthey committed Dec 10, 2024
1 parent 4353a25 commit b8bd2fb
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 b8bd2fb

Please sign in to comment.