Hot answers tagged osm2pgsql
4
Introduction
This will likely require significant amount of manually work to detect and remove the duplicated data. When you're detecting and resolving the duplicate data; you'll want both sources to be in the same geo format: shapefile, PostGIS DBs, or as OSM data.
Workflow
The following workflow is based on having both sources of data as OSM before ...
3
I think you must (in addition to other scripts you've run) also run legacy.sql file which you can find next to postgis.sql and spatial_ref_sys.sql on whatever platform you are. This will add function aliases for old names because in Postgis 2.0, all functions have a 'ST_' prefix.. so AsText is now named ST_AsTexT().
Hope this helps!
3
Just done the process for Cambridge. [This is the fastest method]
Using PostGIS 2.0 (pgAdmin postgres SQL Tools 1.14)
Downloaded the Cambridge OpenStreetMap data from here:
http://download.geofabrik.de/osm/europe/great_britain/england/
selected Cambridge note the cambridgeshire.shp.zip 01-May-2012 06:08 11M ESRI Shapefile (EPSG:4326), zipped
Loaded ...
2
An edge contains a source and target, which describes your route-able network. For Dijkstra algorithm this is sufficient.
A-Star and Shooting Star algorithm have a heuristic component and make use of the geometry of source and target (x1,y1 and x2,y2). Source and target coordinates are pre-calculated for better performance.
The geometry (ie. ...
2
planet_osm_line: contains all imported ways planet_osm_point:
contains all imported nodes with tags planet_osm_polygon: contains all
imported polygons. Relations seem to be resolved for that.
planet_osm_roads: contains a subset of planet_osm_line suitable for
rendering at low zoom levels. planet_osm_line contains too many
elements to render on ...
2
Magnus,
What are you intending to do with the OSM data once in a postgis table ?
Depending on what you intend on doing with the data (Are you looking to do spatial analysis of highways ? Make a map of a complete city including restaurants and other POIs (points of interests) ? ), your osm2pgsql style files will be a little different.
First, osm2pgsql's ...
1
The commands are the same as the commands listed in the answer provided by @Andre Joost except you shouldn't need to provide the full path, all those commands should be in your normal path.
The one exception would be if you're using PostGIS 2.0 or later. In that case you can use the extension manager to create the postgis and postgis_topology extensions.
1
It looks like the loader you're using is from 1.5 or lower, while the database you're loading to is 2.0. Either (a) move to the latest loader or (b) add the "legacy.sql" file into your postgis database to ensure that all the old function signatures the old loader expects are available to you.
1
Why the detour via pbf? osm2po allows you to write your own Reader and to inject it into the processing chain. All you need is a Java-Class which implements OsmParser.
@Override
public void open(InputStream inputStream,
OsmParserHandler osmParserHandler, Config config) {
this.handler = osmParserHandler;
this.log = config.getLog();
// ...
1
From the manual:
osm2pgsql relies much on its node cache during import. If the nodes do
not fit into the cache it needs to do database lookups which slow down
the process. Use enough cache so all nodes are cached. -C 12000 seems
to do the job, even if that means you have to configure more swap
space.
Try to use -C 'somethingbig'
See the wiki
...
1
Firstly, you can download OSM extracts that are already filtered by country/region/city directly from CloudMade: http://downloads.cloudmade.com/
Secondly, the reason your command isn't working is because osm2pgsql requires a filename to be passed in. On Linux you would use /dev/stdin (and this is what the osm2pgsql docs tell you to do) but it looks like ...
1
You should use osmosis to filter OSM file to another OSM file and then osm2pgsql to import it. You can do it with single command using pipe as following
osmosis --read-pbf-fast planet-latest.osm.bz2 --node-key-value keyValueList="place.city,admin_level.2" --write-xml - |osm2pgsql --append [my customized arguments] -
1
You probably want to take a look at nominatim/gazetteer and dive in the code to find out, I've done so a while back but there are steps to create certain indexes that you need to find data (geocode and reverse geocode). So directly it's hard to tell what you really need.
1
Found a discussion about a similar problem at http://web.archiveorange.com/archive/v/wQWIbp8uENgQyNoCJGQz. Even though the discussion happened several years ago the information provided to troubleshoot is still relevant.
In doing some of the troubleshooting listed in this discussion I was able to identify and resolve the problem.
Thanks to Jon Burgess for ...
1
I switched to imposm http://imposm.org/docs/imposm/latest/ for the same reason and everything worked out great. I was trying to install osm-bright for mapbox https://github.com/mapbox/osm-bright/ as all of the desired styling was present. Hope this helps out.
1
This is harder than it sounds - I made some notes on my (abortive) attempts to get the whole of OSM into a postgis data base which may help you get started.
The bottom line is I gave up and went and used a different data set.
1
are you mentioning about nodes, ways and rels tables.
osm2pgsql should be used with many options avalaible. You can find them when you type --help command.
Like the one example here:
osm2pgsql -U postgres -d postgis -S "C:\Program Files\HOTOSM\share\default.style" -k -l -v -c -s -m -E "C:\Program Files\HOTOSM\share\900913.sql" "C:\path\map.osm"
This ...
Only top voted, non community-wiki answers of a minimum length are eligible