I have osm.xml file where projection is defined as follows: Map background-color="grey" srs="&srs900913;" minimum-version="2.0.0">

n settings.xml file projection is also set there as:

<!ENTITY osm2pgsql_projection "&srs900913;">

I want to know what is the difference between these 2 projection. I have changed osm2pgsql projection to wgs-84 and it runs f9 for some files. i am confused in this thing


When i use srs4326 projection i am getting error on console which is as follow: Unknown projection string, using web mercator as never the less. +init=epsg:4326

I have long/lat coordinates i want to use srs4326 projection

  • First projection is not a projection, but an entity. I guess it denotes EPSG:3857, tile projection. You skipped the second projection definition. For minimizing hassle, I'd recommend installing TileMill and adding your PostGIS layer there: you can specify the projection there with a drop-down box. May 15, 2014 at 10:21
  • edited check second one May 15, 2014 at 10:30
  • Try changing osm2pgsql_projection to &srs4326; or &srsmercator;. Between those two projections in your question there is obviously no difference. May 15, 2014 at 11:44
  • sir both these projections are giving error of unknown projection string May 15, 2014 at 11:47
  • See entities.xml.inc for a list of available entities / projections. May 15, 2014 at 11:49

1 Answer 1


entities.xml.inc lists the possible projections supported by Mapnik:

<!ENTITY srs900913 "+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 +over">
<!ENTITY srsmercator "+proj=merc +datum=WGS84 +over">
<!ENTITY srs4326 "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0">

Note that srs900913 is defined on a sphere (EPSG:3857), while srsmercator uses the WGS84 ellipsoid (that's hidden behind +datum=WGS84) usually known as EPSG:3395. Both have a shift of about 20 kilometer unless you are near the aequator. The last one uses lat/lon degree coordinates (EPSG:4326).

Which parameter you have to use depends on the way you stored the data with osm2pgsql. The first one is the default, while the others requires an import with the -M or -l option. But to be honest, I have never seen tiles with those projections, and I am not sure if the style and generate_tile.py files work with that.

In settings.xml.inc you define the entity:

<!ENTITY osm2pgsql_projection "&srs900913;">

which is used inside osm.xml, unless you use the parameter directly:

<Map background-color="#b5d0d0" srs="&srs900913;" minimum-version="2.0.0">
  • thks for reply, i want to use srs4326 as i have long/lat coordinates which i have converted to geometry from st_geomfromtext(). but i am getting an error of unknown projection string May 16, 2014 at 4:58
  • You could convert them to EPSG:900913 inside Postgis before rendering. Do you get an error message stating at which module and line the error occured? It would be good to include that in your question. You can still edit it.
    – AndreJ
    May 16, 2014 at 5:09
  • In your other question, you have srs="&srs900913;" for the Map and srs="&osm2pgsql_projection;" for the layer. This might go wrong if both are not the same.
    – AndreJ
    May 16, 2014 at 5:14
  • sir you have written in your answer that i have to import with -M or-l option if i have to use srs4326 projection? May 16, 2014 at 5:21
  • question edited May 16, 2014 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.