Adding SRID 900913 to PostgresSQL

When installing geo django I ran into the problem of the 900913 SRID not being in the spatial_ref_sys table by default. So the following SQL needs to be run in order to get yourself up and running.

INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 900913, ’spatialreference.org’, 6, ‘+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’, ‘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"]]’);

3 Responses to “Adding SRID 900913 to PostgresSQL”

  1. BMH Says:

    Great tip. Thanks!

  2. Omnibus update: Django 1.0, GeoDjango, Google Maps SRID | Trinity Net Says:

    [...] Maps has its own SRID: 900913. ‘l33t’ speak for Google. If you want to use it with PostGIS, you’ll have to add [...]

  3. Laura Says:

    Hello,

    I have a problem, my code get the latitud and longitud is:

    SELECT “gis_posicion”.”gid” AS geoId, ST_X(ST_transform(“gis_posicion”.”the_geom”,900913)) as longitud,ST_Y(ST_transform(“gis_posicion”.”the_geom”,900913)) as latitud FROM “gis_posicion”
    WHERE “gis_posicion”.”codigo” = ‘$id$’

    My error is:

    Caused by: javax.faces.el.EvaluationException: org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [XX000]; error code [0];
    — The error occurred in es/adif/cmiig/service/geo/sqlmaps/estacion_posicion_punto.xml.
    — The error occurred while applying a parameter map.
    — Check the findGeoEstacionById-InlineParameterMap.
    — Check the statement (query failed).
    — Cause: org.postgresql.util.PSQLException: ERROR: transform: couldn’t project point: -20 (tolerance condition error); nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
    — The error occurred in es/adif/cmiig/service/geo/sqlmaps/estacion_posicion_punto.xml.
    — The error occurred while applying a parameter map.
    — Check the findGeoEstacionById-InlineParameterMap.
    — Check the statement (query failed).
    — Cause: org.postgresql.util.PSQLException: ERROR: transform: couldn’t project point: -20 (tolerance condition error)at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    … 68 more

    What is hte problem?.

    Thanks.

    Laura.

Leave a Reply