x

Wrong boundingbox coordinates for some cities?


  1. Wrong boundingbox coordinates for some cities? · TiMESPLiNTER (Gast) · 08.05.2014 10:45 · [flux]

    I played around with the nominatim API to geocode some addresses. I take the boundingbox coordinates the API gives me and use google maps to set the bounds. So that if I enter "London" the map gets centered to London. This works for most cities but there are some exceptions like Berlin. It will not center the map showing Berlin but a specific place in Berlin. If I look to the boundings I see that lat1/lat2 and lng1/lng2 are nearly the same:

    ["52.5170364379883","52.5170402526855","13.3888597488403","13.3888607025146"]
    
    ...
    
    "display_name":"Berlin,␣Deutschland,␣Europ\u00e4ische␣Union","class":"place","type":"city"
    

    So is there a better way to achieve what I like to do or are the bounding box coordinates just wrong. If yes how can I help correcting them?


    • Re: Wrong boundingbox coordinates for some cities? · wambacher (Gast) · 08.05.2014 11:07 · [flux]

      TiMESPLiNTER wrote:

      I take the boundingbox coordinates the API gives me ...

      please tell us your api-call and the results.

      ... and use google maps to set the bounds.

      Bad boy 😉

      regards
      walter


    • Re: Wrong boundingbox coordinates for some cities? · TiMESPLiNTER (Gast) · 08.05.2014 12:03 · [flux]

      I use the following API call:

      http://nominatim.openstreetmap.org/search?q=Berlin&format=json
      

      And always use the first result of the response (highest importance).


    • Re: Wrong boundingbox coordinates for some cities? · brogo (Gast) · 08.05.2014 12:16 · [flux]

      TiMESPLiNTER wrote:

      I use the following API call:

      http://nominatim.openstreetmap.org/search?q=Berlin&format=json
      

      And always use the first result of the response (highest importance).

      For Berlin is this the admin_centre in the boundary-relation. London and other cities doesn't have admin_centres set.

      Christian


    • Re: Wrong boundingbox coordinates for some cities? · TiMESPLiNTER (Gast) · 08.05.2014 12:30 · [flux]

      brogo wrote:

      For Berlin is this the admin_centre in the boundary-relation. London and other cities doesn't have admin_centres set.

      Christian

      Okay... so is there any possbility to get a boundingbox which let me display the whole city as large as possible on the map?


    • Re: Wrong boundingbox coordinates for some cities? · GeorgFausB (Gast) · 08.05.2014 13:21 · [flux]

      TiMESPLiNTER wrote:

      Okay... so is there any possbility to get a boundingbox which let me display the whole city as large as possible on the map?

      In a first step I would ignore entries with

      "osm_type":"node"
      

      Georg


    • Re: Wrong boundingbox coordinates for some cities? · TiMESPLiNTER (Gast) · 08.05.2014 14:32 · [flux]

      GeorgFausB wrote:

      In a first step I would ignore entries with

      "osm_type":"node"
      

      Georg

      Wow that did the trick! Googled for osm_type description but I haven't found clear information what's this exactly... may you explain what this attribute is used for?


    • Re: Wrong boundingbox coordinates for some cities? · JohnDoe23 (Gast) · 08.05.2014 14:46 · [flux]

      TiMESPLiNTER wrote:

      Wow that did the trick! Googled for osm_type description but I haven't found clear information what's this exactly... may you explain what this attribute is used for?

      http://wiki.openstreetmap.org/wiki/Elements

      for boundaries you should also take a look at: http://wiki.openstreetmap.org/wiki/Relation:boundary