Skip to content

Commit

Permalink
[geocoder] Fix inverted lat lon in nominatim's viewport
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 17, 2020
1 parent c56d2d8 commit e488a57
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/core/geocoding/qgsnominatimgeocoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ QgsGeocoderResult QgsNominatimGeocoder::jsonToResult( const QVariantMap &json )
{
QVariantList boundingBox = json.value( QStringLiteral( "boundingbox" ) ).toList();
if ( boundingBox.size() == 4 )
res.setViewport( QgsRectangle( boundingBox.at( 0 ).toDouble(),
boundingBox.at( 2 ).toDouble(),
boundingBox.at( 1 ).toDouble(),
boundingBox.at( 3 ).toDouble() ) );
res.setViewport( QgsRectangle( boundingBox.at( 2 ).toDouble(),
boundingBox.at( 0 ).toDouble(),
boundingBox.at( 3 ).toDouble(),
boundingBox.at( 1 ).toDouble() ) );
}

res.setAdditionalAttributes( attributes );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsnominatimgeocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def test_json_to_result(self):
'place_id': '157298780', 'postcode': 'G1C 4X5',
'road': 'Rue Anick', 'osm_type': 'way',
'type': 'school', 'class': 'amenity'})
self.assertEqual(res.viewport(), QgsRectangle(46.887, -71.199, 46.889, -71.201))
self.assertEqual(res.viewport(), QgsRectangle(-71.201, 46.887, -71.199, 46.889))
self.assertEqual(res.group(), 'Quebec')


Expand Down

0 comments on commit e488a57

Please sign in to comment.