You are not logged in.
Pages: 1
Hello,
Well im not an expert user of all this GIS/OSM stuff so i would like some help ![]()
I am trying to convert an OSM file with osm2pgsql.
I have my PostGIS setup and all , and already using it with some other files.
I want to convert the OSM i have to import it in the PostGIS and i always get thsi error
Couldn't read EPSG definition (do you have /usr/share/proj/epsg?)
i run the command like this \osm2pgsql>osm2pgsql.exe -E 900913 -d gisdb xxxx.osm
I tried this small tutorial at the start of this page ( http://blog.geoserver.org/2009/01/30/ge … streetmap/ )
Any hints that could help me out?
Thank you
Offline
Hi,
Looks like PostGIS is missing definitions for epsg:900913 projection. Do this:
INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text)
VALUES (900913, 'spatialreference.org', 900913,
'PROJCS["unnamed",GEOGCS["unnamed ellipse",DATUM["unknown",
SPHEROID["unnamed",6378137,0]],PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],PROJECTION["Mercator_2SP"],
PARAMETER["standard_parallel_1",0],PARAMETER["central_meridian",0],
PARAMETER["false_easting",0],PARAMETER["false_northing",0],
UNIT["Meter",1],
EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"]]',
'+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0
+k=1.0 +units=m +nadgrids=@null +wktext +no_defs');
There is another manual at http://trac.osgeo.org/mapserver/wiki/RenderingOsmData.
I know I should say that Mapnik is the standard for rendering OSM data but there is plenty of space for other alternatives too.
Offline
Hi there thanx for the reply
Well i tried the following but i dont know if its correct way to do it
\osm2pgsql>osm2pgsql.exe -E 4326 -d gisdb xxxx.osm (where 4326 is the SRS i want to use)
It accepted it and entered the .osm to my PostGID Database but im not sure if its correct
The projection i want to use is this one.
GEOGCS["Geographic Coordinate System",DATUM["WGS84",SPHEROID["WGS84",6378137,298.257223560493]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
Any ideas?
Thank you
Offline
Hi,
It looks correct. I am using mostly an old Windows binary that does not have -E option. Instead is has option -l that is doing the same and imports data to EPSG:4326.
Offline
Ok then 1 last thing shall i edit the spl script in the osm2pgsql folder and add
GEOGCS["Geographic Coordinate System",DATUM["WGS84",SPHEROID["WGS84",6378137,298.257223560493]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
?
Offline
Sorry, I don't know. My guess is that there is no need to edit anything, just run with -E 4326 option.
Offline
Hi,
I have the same problem, and i have inserted the record in the spatial_ref_sys table, but I continue getting the message:
$ osm2pgsql -E 900913 -d osm -U test planet.osm
osm2pgsql SVN version 0.69-exported
Couldn't read EPSG definition (do you have /usr/share/proj/epsg?)
I can do it with epsg 4326 OK:
$ osm2pgsql -E 4326 -d osm -U test planet.osm
But the features don't look like in the correct position when displayed on Geoserver/openlayers (and unable to display the line/roads layers).
Any idea?
Thanks
Offline
Hi,
It is some problem with paths. The final solution would be to add a suitable Windows environmental parameter with SET command before running osm2pgsql, I got once even imstructions for that. A simple way is just to run osm2pgsql.exe with defaults and do the update inside PostGIS. For example I am running these commands from psql prompt after import:
update osm_point set way=transform(way,3067);
update osm_line set way=transform(way,3067);
update osm_polygon set way=transform(way,3067);
update geometry_columns set srid=3067 where f_table_name='osm_point';
update geometry_columns set srid=3067 where f_table_name='osm_line';
update geometry_columns set srid=3067 where f_table_name='osm_polygon';
The problem I had with osm2pgsql.exe and the suggested solution is described here:
http://lists.openstreetmap.org/pipermai … 19742.html
Last edited by JRA (2010-07-22 12:07:31)
Offline
Thank you for your reply.
I have imported the osm data by not specifying the epsg code (the default sr is 900913):
osm2pgsql -d test -U postgres -s -v planet.osm It would be ideal if the coordinate system could be converted to some other SRs (e.g. 4326). I tried the approach you provided:
update qrt.planet_osm_point set way=transform(way,4326);but got the following error:
ERROR: AddToPROJ4SRSCache: couldn't parse proj4 string: '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs': squared eccentricity < 0I have created the SR definition from osm2pgsql/900913.sql:
INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text)VALUES (900913,'EPSG',900913,'PROJCS["WGS84 / Simple Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS_1984", 6378137.0, 298.257223563]],PRIMEM["Greenwich", 0.0],UNIT["degree", 0.017453292519943295],AXIS["Longitude", EAST],AXIS["Latitude", NORTH]],PROJECTION["Mercator_1SP_Google"],PARAMETER["latitude_of_origin", 0.0],PARAMETER["central_meridian", 0.0],PARAMETER["scale_factor", 1.0],PARAMETER["false_easting", 0.0],PARAMETER["false_northing", 0.0],UNIT["m", 1.0],AXIS["x", EAST],AXIS["y", NORTH],AUTHORITY["EPSG","900913"]]','+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs');Not sure whats wrong with the convert function on my database. I am using PostGIS1.4.2 with PostgreSQL 8.4.4 and Proj4.6.1-3 on Fedora12.
Thanks
Last edited by sige (2010-07-26 00:27:33)
Offline
Hi,
the error has gone after installing proj-nad:
yum install proj-nad.x86_64Thanks
Offline
Pages: 1