osm-without-borders / cosmogony

easy to use & easy to update geographic regions
http://cosmogony.world
Apache License 2.0
103 stars 15 forks source link

Approximate polygons for areas/levels where they are missing #19

Open poudro opened 6 years ago

poudro commented 6 years ago

The Problem

There are a lot of areas around the world where it is close to impossible to obtain a proper partition of a country with available polygon data for all levels (especially city and below).

On the other hand, OSM has an abundance of city nodes for example.

How we can solve this

A first order approximation of the polygons for levels where OSM has a good coverage of nodes could be done via a Voronoi Diagram (https://en.wikipedia.org/wiki/Voronoi_diagram).

In practice

For preliminary tests, Postgis offers the ST_VoronoiPolygons (https://postgis.net/docs/ST_VoronoiPolygons.html) function.

Example output applied to a set of city nodes: screen shot 2018-01-30 at 10 39 17 pm

This method would need to be refined and robustified to adapt to existing admin levels of higher level and situations where data is partially available (and other scenarios that might emerge).

antoine-de commented 6 years ago

That can be a nice approach!

Won't we need to weight the admin (with their population, area or whatever) ?

And I think a dumb approach prioritizing admin's with boundary (at the same ZoneType) can be enough no ?

have you checked if there is a Voronoi rust implementation ? 🤣

Tristramg commented 6 years ago

What worked so far solely using postgis:

The weighting is something we are curently working on. I am not sure exactly how it will result

On 1 February 2018 at 10:38, Antoine D notifications@github.com wrote:

That can be a nice approach!

Won't we need to weight the admin (with their population, area https://www.wikidata.org/wiki/Property:P2046 or whatever) ?

And I think a dumb approach prioritizing admin's with boundary (at the same ZoneType) can be enough no ?

have you checked if there is a Voronoi rust implementation ? 🤣

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/osm-without-borders/cosmogony/issues/19#issuecomment-362210928, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAvywzo6CzuOPX7MaG8Pu_fwHcxJP95ks5tQYYIgaJpZM4RzDqt .

TeXitoi commented 6 years ago

I doubt population is relevant.

poudro commented 6 years ago

What is commonly available in data are population and place tag type. Not much more widely available so will have to do.

In preliminary tests, population seems relevant to give a little more weight to bigger towns.

Tristramg commented 6 years ago

After some testing, it seems that weighting is not a good idea : municipalities that are cities are not always larger than villages. The mistake was to confuse the urban area (often composed of many municipalities in cities) with the area of the municipality (often consists of fields and forest in rural areas).

So the good news is that it’s way simpler ;)

Example of the exploration of parameters :

screenshot from 2018-02-07 10-11-39

antoine-de commented 6 years ago

cool!

so a simple voronoi is enough ?

poudro commented 6 years ago

It would appear so!