[postgis-users] Coordinate transformation with custom records ofspatial_sys_ref

Francois Hugues hugues.francois at irstea.fr
Fri Jun 29 07:21:25 PDT 2012


Hello,

I think you use wrong srid : for lambert93 you should use 2154 and for lambert 2 carto it is 27582. 

Anyway, if you want to use the SRID 320002120 and 310024140, your problem is related to the geometry_column view and constraints checking on geometry columns. You will have to use AddGeometryColumm with use_typmod option set to false.

http://postgis.refractions.net/docs/AddGeometryColumn.html said : "Changed: 2.0.0 If you require the old behavior of constraints use the default use_typmod, but set it to false."

Hugues.

-----Message d'origine-----
De : postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] De la part de DUPREZ Cédric
Envoyé : vendredi 29 juin 2012 15:46
À : postgis-users at postgis.refractions.net
Objet : [postgis-users] Coordinate transformation with custom records ofspatial_sys_ref


Hi all list members,

I am facing a problem with coordinate transformation, using ST_Transform() function.

First of all, my PostGIS version is 2.0.1 : POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.1, released 2012/05/15" LIBXML="2.7.6" LIBJSON="UNKNOWN" TOPOLOGY RASTER

Here are the steps to reproduce the problem:
1/ Create a table containing points
CREATE TABLE pts (
	code INT,
	xl2 INT,
	yl2 INT,
	geom GEOMETRY,
	CONSTRAINT pts_pkey PRIMARY KEY (code)
)
WITHOUT oids;

INSERT INTO pts (code, xl2, yl2)
VALUES (1, 556866, 1902345)
, (2, 689174, 2448195)
, (3, 729095, 2528577)
, (4, 335755, 2059702)
, (5, 623207, 2210468)
, (6, 850337, 1871486)
, (7, 915275, 1889534)
, (8, 639551, 1778327)
, (9, 584365, 2273523)
, (10, 649599, 2228833);

2/ Import the custom records of spatial_sys_ref specified by the French IGN. The file is provided here: http://lambert93.ign.fr/fileadmin/files/IGNF-spatial_ref_sys.sql

3/ Populate the geom column:
UPDATE pts
SET geom = ST_SetSRID(ST_MakePoint(xl2, yl2), 320002120);
I get the following notices: NOTICE:  SRID value 320002120 > SRID_MAXIMUM converted to 999442

SELECT DISTINCT ST_SRID(geom)
FROM pts;
Gives: 999442

But SELECT * FROM geometry_columns;
Gives: 0

4/ Update geometry SRID:
SELECT UpdateGeometrySRID('pts', 'geom', 320002120);

SELECT * FROM geometry_columns;
Gives: 999442

5/ Try the transformation from 320002120 SRID (Lambert II) to 310024140 SRID (Lambert 93):
SELECT code, ST_Transform(geom, 310024140)
FROM pts;
I get the following error message: Invalid reserved SRID (999442).

With PostGIS 1.5.3, this worked perfectly, without any error message and gave the good coordinate transformation.

What should I change with PostGIS 2.0.1 in order to get the same result again?

Thanks in advance for your help.

Regards,

Cedric Duprez
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list