I am working on a global project for which I want to use OSM data as a model input. I am looking for advice on the best way to produce 1x1 degree WGS84 shapefiles from either regional extracts or the full planet file. I am planning to produce separate road and polygon shapefiles for each 1x1 degree cell from which I will produce binary rasters (although I want to retain the shapefiles to potentially use them from other projects). I only need basic attribution as I will only need to exclude a few tags.
My initial plan would be to import the OSM data to Postgres/PostGIS using osm2pgsql and then execute a series of pgsql2shp commands as such:
pgsql2shp -f cell.shp -h localhost -p 5432 -P postgres -u postgres -g way database_name SELECT ST_Intersection(way, ST_GeomFromText('POLYGON(())', 4326)) FROM planet_osm_roadsIs there a better way? Thank you.
EDIT: I started down this path, but unfortunately I no longer have access to the machine I began on. When I started extracting the 1x1s, I believe it was taking about 5 minutes per query (I believe osm2pgsql creates a spatial index, so that should have helped). I understand that this is quite a lot of data and won't be terribly fast no matter what. Basically, I don't necessarily think this is a bad solution, just hoping there may be a faster one.
أكثر...
My initial plan would be to import the OSM data to Postgres/PostGIS using osm2pgsql and then execute a series of pgsql2shp commands as such:
pgsql2shp -f cell.shp -h localhost -p 5432 -P postgres -u postgres -g way database_name SELECT ST_Intersection(way, ST_GeomFromText('POLYGON(())', 4326)) FROM planet_osm_roadsIs there a better way? Thank you.
EDIT: I started down this path, but unfortunately I no longer have access to the machine I began on. When I started extracting the 1x1s, I believe it was taking about 5 minutes per query (I believe osm2pgsql creates a spatial index, so that should have helped). I understand that this is quite a lot of data and won't be terribly fast no matter what. Basically, I don't necessarily think this is a bad solution, just hoping there may be a faster one.
أكثر...