Tag Info

Hot answers tagged

6

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 ...


6

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!


5

Replacing st_length with st_transform(way,4326)::geography solves the geodetic distance problem - thanks unicoletti!. Old Beechy Rail Trail | 47.2km Great Southern Rail Trail | 53.5km Ballarat-Skipton Rail Trail | 57.2km High Country Rail Trail | 63.7km East Gippsland Rail Trail | 97.6km ...


5

You are not using geodesic functions to calculate the length, which means that for a point there is an error factor of: cos( LATITUDE * pi() / 180 ) If you then multiply the calculated lenght by the error factor you should obtain a value pretty close to the actual trail length. For instance the Old Beechy Rail Trail is close to Melbourne, which has a ...


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 ...


4

You can find the source code of osm2pgsql here: https://github.com/openstreetmap/osm2pgsql/blob/master/reprojection.c and you will find this note in line 67: /* hard-code the source projection to be lat/lon, since OSM XML always * has coordinates in degrees. */ pj_source = pj_init_plus("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); /* ...


4

ST_AsLatLonText documentation says: It is assumed the point is in a lat/lon projection. The X (lon) and Y (lat) coordinates are normalized in the output to the "normal" range (-180 to +180 for lon, -90 to +90 for lat). So you are seeing your point (in 900913) "wrapped" around until it eventually gets into the normal range. To see your ...


3

I had the same problem, and here is how I solved it: The problem lies in PolygonBuilder.cpp within the libgeos library. The line causing the problem has actually been fixed already, but the fix is not in the current ubuntu/debian repository that is installed via apt-get. Details of the change can be found here. I downloaded the libgeos from github and ...


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

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 ...


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_roads contains only ways that are used for rendering low zoom levels, such as motorsways, rivers, etc. It does not contain details like residential roads, streams and various other features normally rendered only at high zoom. The default c-based definitions of what to add to the roads table are tagtransform.c If you want to customize this, ...


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

I am not aware that you have a converter from Mapnik to Mapserver mapfile styles. You will really need a lot of tools for what you expect. OSM world has his own set of tools because of their DB complexity and storage (XML) I don't recommend to use Shapefile for rendering OSM data. If you need lot of custom styles, the shp don't give you all the attributes ...


2

Mapnik 2 is a major change release. There have been many updates and alterations that mean backwards compatibility is not guaranteed. See the documentation for the differences between Mapnik and Mapnik2. If you haven't previously used Mapnik, then I would recommend starting with version 2 to take advantage of the improvements and avoid problems later on.


2

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.


2

I don't know how is in your pg_hba.conf but I believe you use the peer authentication method. (This method is only supported on local connections.) Because this doesn't work, try to change it to md5 ("md5" is preferred since it sends encrypted passwords), like this: and restart your database server. References: pg_hba.conf inside comments; PostgreSQL ...


2

The current osm2pgsql default.style explains in much more detail the meaning of the various flags and OsmTypes. If you're looking at writing your own style file, you should start with the empty.style example. Quoting what I wrote at the time, the five flags are polygon - Create a column for this tag, and objects the tag with are areas linear - Create a ...


2

The names of the tables should be self-explaining: planet_osm_point is a point layer file planet_osm_line is a line layer file planet_osm_roads similar to line, contaning simplified geometries of roads and railways for lower zoom levels planet_osm_polygon contains (multi-)polygons These tables reflect the OSM datamodel in the way they can be used GIS ...


1

If you have access to the file system of your caching server then you could just look at it there. Just navigate to {path}/{to}/Geoserver_Data_Dir/gwc/{layer_name} and you should see a bunch of folders relating to each zoom level and projection e.g. EPSG_900913_18. You could then just see what the total file size of each folder is. If you wanted to predict ...


1

One very crude way would be to find the size of one of you tiles from one of the zoom levels you have already cached. For example one of my cached tiles is 18Kb. If you then go into your geoserver admin panel and click on the your correct gridset you are using (maybe the EPSG:900913 one) you will see a list of zoom levels and the number of tiles. So if ...


1

From @Jakub Kania tip : ALTER TABLE routes ADD temp geometry; select UpdateGeometrySRID('public', 'routes', 'temp', 4326) ; update routes set temp = ST_Transform(the_geom,4326); select UpdateGeometrySRID('public', 'routes', 'the_geom', 4326) ; update routes set the_geom = temp; alter table routes drop column temp;


1

Sorry, not an answer, but I want to confirm I am seeing the exact same connection lost issue, in the same pbf file and have been unable to load it for 2 weeks now. It fails after about 20 hours with this error. I will edit this if I find a cause or a solution. Right now I suspect that the pbf file is bad or its a bug. Tests that worked so far: Tested a ...


1

A few possible reasons: Your version of osm2pgsql is not ready for 64-bit-long node numbers. Try the latest version Updating of the planet at Geofabrik failed before cutting into pieces. The OSM Inspector has such lines too at the moment. There is not much to do but complaining at Geofabrik. You get that kind of error if boundary polygons are missing some ...


1

ST_Length, when called on a geometry, reports in units of the spatial reference system. For EPSG:900913/EPSG:3857, the units are in Mercator meters, not in meters. At all points on the globe, a Mercator meter is at most 1 real meter. To do this there are two possible fixes Transform to an appropriate projection for your area. UTM, state plane and albers ...


1

Just to cut short the answer by Will As to finding out what keys are in your .osm file, just peek around in it by opening it in josm or qgis. One way to find out what tags are used is by opening your osm file in josm, then go to search, and type:way and it will return with a column of all the keys that are used on at least one way in that file.


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

What you are looking for is a WebMap toolkit that allows interaction with a basemap and interactive layers: http://wiki.openstreetmap.org/wiki/Frameworks#Webmaps Most popular is Leaflet (easy to use but limited) and OpenLayers (more complex). They allow you to display raster maps by different providers and to add map data on top as vector layer. While ...


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(); // ...



Only top voted, non community-wiki answers of a minimum length are eligible