osm-search / Nominatim

Open Source search based on OpenStreetMap data
https://nominatim.org
GNU General Public License v3.0
3.23k stars 718 forks source link

Missing municipal boundaries #761

Closed iatkin closed 7 years ago

iatkin commented 7 years ago

Hi. I'm working on a project that is using Nominatim for location searching and also features a gazetteer that can use exact boundaries for database queries rather than just bounding boxes. I had been using shape files downloaded from state GIS office websites to populate the gazetteer, but I was looking into using municipal boundaries pulled from Nominatim since it is easier automate the gazetteer population this way.

I currently have seven states loaded into my local Nominatim database using extracts from Geofabrik: CT, MA, ME, NH, NY, RI, VT. Only MA and NH seem to have complete municipal boundaries; MA has some "seams" but this is a minor issue. Is there a reason why these boundaries are missing? I would like to have the gazetteer I'm working on have complete national municipal coverage soon, and could provide the boundaries if needed.

Attached is an image of the current boundaries that I found. I did a query on the Placex table for all entries with a place_class of "boundary" with an admin_level of 5 (for NYC) or and admin_level greater than 6 (to exclude counties). This includes more than just municipal boundaries, but it does illustrate that large regions have no polygonal boundaries.

osm_coverage
mtmail commented 7 years ago

Nominatim might not be the best tool to export administrative boundaries.

With http://overpass-turbo.eu/ try the following query for Vermont (http://www.openstreetmap.org/relation/60759)

[out:json][timeout:45];
area["ISO3166-2"="US-VT"]->.a;
(relation(area.a)["admin_level"=6][boundary="administrative"];);
out body;
>;
out skel qt;

or

[out:xml][timeout:45];
area["ISO3166-2"="US-VT"]->.a;
(relation(area.a)["admin_level"=6][boundary="administrative"];);
out meta;
>;
out meta qt;

image

You might need to use the little magnifying glass button "zoom to data" to see the results on the map. The query language needs some getting used to, but is very powerful.

Alternatively on https://osm.wno-edv-service.de/boundaries/ offers downloads of boundaries in multiple formats.

I haven't answered the question why Nominatim might miss a county. Without looking at a specific example it's hard to tell from the map which admin_level got exported, merged, displayed here.

iatkin commented 7 years ago

What you're suggesting has no relation to my issue. I am not having problems getting boundaries. Many boundaries are nonexistent in OSM.

For example, Bristol County in Rhode Island has three municipalities: Bristol, Barrington and Warren. Warren is only represented by a point and has no boundary information.

I am asking if there's a specific reason for why these boundaries are not included, and I am offering to provide them if needed.

Attached is a better image. The region that I have loaded locally is outlined. The blue areas have municipal boundaries; the grey areas do not. I did a direct SQL query of the Placex table for rows with a place_class of "boundary", a place_type of "administrative" and an admin_level of 7 or greater to exclude state and county boundaries. I would expect there to be full coverage, but it is only 50% by area.

osm_coverage

mtmail commented 7 years ago

I think overpass and the boundary export tool are better suited to find missing boundaries, but Nominatim search (webfrontend, API or database query) works as well of course.

Link to Warren, Rhode Island for reference http://nominatim.openstreetmap.org/details.php?osmtype=N&osmid=158858104

There's no reason why the boundary information of those places is missing. Entirely possible nobody looked that closely at the data in that area. If you have local knowledge or a data source that's compatible with OSM license it's great if you can add those.

Recently I worked on a project to find and fix missing boundaries in Bulgaria and Dominican Republic (pretty random but a client asked for that).

I would like to have the gazetteer I'm working on have complete national municipal coverage soon, and could provide the boundaries if needed.

Before you start adding bulk data, can you email the https://lists.openstreetmap.org/listinfo/talk-us mailing-list with your plan? Maybe somebody worked on that before, knows other data sources or reasons why a data-source hasn't been considered in the past.

Thank you for putting in the work to make OSM better and more complete.

lonvia commented 7 years ago

This is a data issue with OSM rather than a software issue with the Nominatim search engine. Closing.