[OSM-dev] Extracting map regions

Paul Norman penorman at mac.com
Wed Sep 16 19:40:09 UTC 2015

On 9/16/2015 12:31 AM, Stadin, Benjamin wrote:
> I want to import planet.osm into a Postgresql db (I’m considering to 
> use imposm for the import). Once I have the whole planet imported, I 
> need to extract many small regions (say max 5km * 5km max). The area 
> is user-definable in my case, it can be any boundary with mentioned 
> maximum size.
> I’m interested in how regional / metro extracts are done for the 
> cities provided at the OSM download page, what options there are 
> (especially performance-wise) and what I need to take care of 
> otherwise when extracting regions (missing relationships when 
> clipping, routing network issues, or else).
https://mapzen.com/data/metro-extracts and http://download.geofabrik.de/ 
are third party services. Both rely on standard tools, osmconvert in the 
case of metro and osmosis in the case of geofabrik extracts. Both 
require a predefined list of extracts to create.

Imposm is designed for creating a database for rendering and is lossy. 
You could use it to provide the secondary services like shapefiles that 
extract providers offer, but not extracts of the data itself.

The two options that come to mind for supporting user-defined extracts 
are an osm3s (overpass) database or pgsnapshot database.

In the case of the latter, you'd do it without geometries or any tag 
indexes, then use pyxapi, jxapi, cgimap, or osmosis to extract the data 
for a bounding box.

More information about the dev mailing list