Skip to content

Commit

Permalink
Merge pull request #225 from nrotstan/fix-nominatim-boundingbox
Browse files Browse the repository at this point in the history
Include bbox from Nominatim response, fixes #224
  • Loading branch information
jonataswalker authored Oct 17, 2020
2 parents 90538dc + 0f940fa commit 3de99e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/nominatim.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ export class Nominatim {
let { bbox } = place;

if (bbox) {
bbox = proj.transformExtent(bbox, 'EPSG:4326', projection);
bbox = proj.transformExtent(
[bbox[2], bbox[1], bbox[3], bbox[0]], // NSWE -> WSEN
'EPSG:4326',
projection
);
}

const address = {
Expand All @@ -230,6 +234,7 @@ export class Nominatim {
address,
coordinate: coord,
bbox,
place,
});
} else {
if (bbox) {
Expand All @@ -246,6 +251,7 @@ export class Nominatim {
feature,
coordinate: coord,
bbox,
place,
});
}
}
Expand Down
1 change: 1 addition & 0 deletions src/providers/osm.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class OpenStreet {
return results.map((result) => ({
lon: result.lon,
lat: result.lat,
bbox: result.boundingbox,

address: {
name: result.display_name,
Expand Down

0 comments on commit 3de99e0

Please sign in to comment.