[postgis-users] Coordinate transformation with custom records of spatial_sys_ref

947 views
Skip to first unread message

DUPREZ Cédric

unread,
Jun 29, 2012, 9:45:47 AM6/29/12
to postgi...@postgis.refractions.net

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
postgi...@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Francois Hugues

unread,
Jun 29, 2012, 10:21:25 AM6/29/12
to PostGIS Users Discussion

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-us...@postgis.refractions.net [mailto:postgis-us...@postgis.refractions.net] De la part de DUPREZ Cédric
Envoyé : vendredi 29 juin 2012 15:46
À : postgi...@postgis.refractions.net
Objet : [postgis-users] Coordinate transformation with custom records ofspatial_sys_ref

DUPREZ Cédric

unread,
Jun 29, 2012, 10:31:47 AM6/29/12
to PostGIS Users Discussion
Thank you for the answer.

I will test with AddGeometryColumm.

Unfortunately, the coordinate transformation between 27582 and 2154 SRID gives wrong results, since it does not consider the correction grid specified by the French IGN. The custom SRIDs does.

Regards,

Cedric

-----Message d'origine-----
De : postgis-us...@postgis.refractions.net [mailto:postgis-us...@postgis.refractions.net] De la part de Francois Hugues
Envoyé : vendredi 29 juin 2012 16:21
À : PostGIS Users Discussion
Objet : Re: [postgis-users] Coordinate transformation with custom recordsofspatial_sys_ref

DUPREZ Cédric

unread,
Jul 17, 2012, 5:34:46 AM7/17/12
to PostGIS Users Discussion
Hi all,

I am still facing the same problem using function AddGeometryColumn.

Taking the same example I gave previously, here is what I do:

CREATE TABLE pts (
code INT,
xl2 INT,
yl2 INT,
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);

SELECT AddGeometryColumn('public', 'pts', 'geom', 320002120, 'POINT', 2, false);

This gives me the following error message: "ERROR: AddGeometryColumn() - SRID must be <= 998999
État SQL :P0001
Contexte : SQL statement "SELECT AddGeometryColumn('',$1,$2,$3,$4,$5,$6,$7)"
PL/pgSQL function "addgeometrycolumn" line 5 at SQL statement"

How can I use the correct 320002120 SRID specified by French IGN?

Thanks in advance for your help,

Cedric Duprez


-----Message d'origine-----
De : postgis-us...@postgis.refractions.net [mailto:postgis-us...@postgis.refractions.net] De la part de DUPREZ Cédric
Envoyé : vendredi 29 juin 2012 16:32

Sandro Santilli

unread,
Jul 17, 2012, 5:49:00 AM7/17/12
to DUPREZ Cédric, PostGIS Users Discussion
On Tue, Jul 17, 2012 at 11:34:46AM +0200, DUPREZ Cédric wrote:

> SELECT AddGeometryColumn('public', 'pts', 'geom', 320002120, 'POINT', 2, false);
>
> This gives me the following error message: "ERROR: AddGeometryColumn() - SRID must be <= 998999
>
> How can I use the correct 320002120 SRID specified by French IGN?

Is 320002120 in your spatial_ref_sys already ?
You'll need to assign it a different SRID, the spatial_ref_sys has provision
for "auth_srid" so you can put 320002120 in there and use something
valid for PostGIS' "srid" field.

Unfortunately we never got around writing a page about SRID ranges in
PostGIS manual (contributions welcome!) but the idea is that you put
your "custom" entries somewhere from 910000 and below 999000.

--strk;

,------o-.
| __/ | Delivering high quality PostGIS 2.1
| / 2.1 | http://strk.keybit.net - http://vizzuality.com
`-o------'

Robert...@doh.state.fl.us

unread,
Jul 17, 2012, 8:49:21 AM7/17/12
to postgi...@postgis.refractions.net
One easy way to generate the syntax required to add a custom projection is to select something similar at spatialreference.org and click "PostGIS spatial_ref_sys INSERT statement," then copy and paste into a text or query editor to revise. Blinding flash of the obvious, perhaps, but hope it's helpful to someone.

-Rob

DUPREZ Cédric

unread,
Jul 19, 2012, 3:22:29 AM7/19/12
to PostGIS Users Discussion
Thank you for your help.
I have modified the SRIDs of each entry in the IGNF file, by incrementing them from 910001 to 910320.

But now, when I try the conversion with ST_Transform, I get the following error message:

"transform: couldn't project point (556866 1.90234e+06 0): failed to load datum shift file (-38)"
With the following notice: "PostGIS was unable to transform the point because either no grid shift files were found, or the point does not lie within the range for which the grid shift is defined. Refer to the ST_Transform() section of the PostGIS manual for details on how to configure PostGIS to alter this behaviour."

I tried the conversion directly in Proj4 with cs2cs and it works correctly.
This should mean that Proj.4 is build with the grid-shift files, as it is said in the ST_Transform documentation.
Here is the command I execute in Proj4 : cs2cs -I +init=IGNF:LAMBE +to +init=IGNF:LAMB93
Then, giving Lambert II coordinates transform them correctly.
But in Postgis, it does not work.

What am I doing wrong?

Regards,

Cedric



-----Message d'origine-----
De : postgis-us...@postgis.refractions.net [mailto:postgis-us...@postgis.refractions.net] De la part de Robert...@doh.state.fl.us
Envoyé : mardi 17 juillet 2012 14:49
À : postgi...@postgis.refractions.net
Objet : Re: [postgis-users] Coordinate transformation withcustomrecordsofspatial_sys_ref

DUPREZ Cédric

unread,
Oct 22, 2012, 11:16:22 AM10/22/12
to PostGIS Users Discussion
Hi all,

After several tries, I am still unable to get this feature to work within Postgis 2.0...
And with PostgreSQL 9.2, it is no more possible to downgrade to Postgis 1.5...
I am completely locked.

I try, once again, to give the steps to reproduce my bug:

1/ insert spatial_ref_sys entries which used to work in Postgis 1.5 :
insert into spatial_ref_sys values (320002120,'IGNF',320002120,'PROJCS["Lambert II étendu",GEOGCS["Nouvelle Triangulation Française Paris grades",DATUM["NTF",SPHEROID["Clarke 1880 IGN",6378249.2000,293.4660210000000,AUTHORITY["IGNF","ELG010"]],TOWGS84[-168.0000,-60.0000,320.0000,0,0,0,0],AUTHORITY["IGNF","REG002"]],PRIMEM["Paris",2.337229167,AUTHORITY["IGNF","LGO02"]],UNIT["grad",0.01570796326794897],AXIS["Longitude",EAST],AXIS["Latitude",NORTH],AUTHORITY["IGNF","NTFP"]],PROJECTION["Lambert_Conformal_Conic_1SP",AUTHORITY["IGNF","PRC0120"]],PARAMETER["semi_major",6378249.2000],PARAMETER["semi_minor",6356515.0000],PARAMETER["latitude_of_origin",46.800000000],PARAMETER["central_meridian",0.000000000],PARAMETER["scale_factor",0.99987742],PARAMETER["false_easting",600000.000],PARAMETER["false_northing",2200000.000],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["IGNF","LAMBE"]]','+init=IGNF:LAMBE +title=Lambert II etendu +proj=lcc +nadgrids=ntf_r93.gsb,null +wktext +towgs84=-168.0000,-60.0000,320.0000 +a=6378249.2000 +rf=293.4660210000000 +pm=2.337229167 +lat_0=46.800000000 +lon_0=0.000000000 +k_0=0.99987742 +lat_1=46.800000000 +x_0=600000.000 +y_0=2200000.000 +units=m +no_defs');
insert into spatial_ref_sys values (310024140,'IGNF',310024140,'PROJCS["Lambert 93",GEOGCS["Réseau géodésique français 1993",DATUM["Réseau géodésique français 1993",SPHEROID["IAG GRS 1980",6378137.0000,298.2572221010000,AUTHORITY["IGNF","ELG037"]],TOWGS84[0.0000,0.0000,0.0000,0,0,0,0],AUTHORITY["IGNF","REG024"]],PRIMEM["Greenwich",0.000000000,AUTHORITY["IGNF","LGO01"]],UNIT["degree",0.01745329251994330],AXIS["Longitude",EAST],AXIS["Latitude",NORTH],AUTHORITY["IGNF","RGF93G"]],PROJECTION["Lambert_Conformal_Conic_2SP",AUTHORITY["IGNF","PRC0140"]],PARAMETER["semi_major",6378137.0000],PARAMETER["semi_minor",6356752.3141],PARAMETER["latitude_of_origin",46.500000000],PARAMETER["central_meridian",3.000000000],PARAMETER["standard_parallel_1",44.000000000],PARAMETER["standard_parallel_2",49.000000000],PARAMETER["false_easting",700000.000],PARAMETER["false_northing",6600000.000],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["IGNF","LAMB93"]]','+init=IGNF:LAMB93');

2/ This raises an when adding a geometry column : "ERROR: AddGeometryColumn() - SRID must be <= 998999"

3/ I reaffect a neuw SRID to those 2 entries :
insert into spatial_ref_sys values (910002,'IGNF',320002120,'PROJCS["Lambert II étendu",GEOGCS["Nouvelle Triangulation Française Paris grades",DATUM["NTF",SPHEROID["Clarke 1880 IGN",6378249.2000,293.4660210000000,AUTHORITY["IGNF","ELG010"]],TOWGS84[-168.0000,-60.0000,320.0000,0,0,0,0],AUTHORITY["IGNF","REG002"]],PRIMEM["Paris",2.337229167,AUTHORITY["IGNF","LGO02"]],UNIT["grad",0.01570796326794897],AXIS["Longitude",EAST],AXIS["Latitude",NORTH],AUTHORITY["IGNF","NTFP"]],PROJECTION["Lambert_Conformal_Conic_1SP",AUTHORITY["IGNF","PRC0120"]],PARAMETER["semi_major",6378249.2000],PARAMETER["semi_minor",6356515.0000],PARAMETER["latitude_of_origin",46.800000000],PARAMETER["central_meridian",0.000000000],PARAMETER["scale_factor",0.99987742],PARAMETER["false_easting",600000.000],PARAMETER["false_northing",2200000.000],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["IGNF","LAMBE"]]','+init=IGNF:LAMBE +title=Lambert II etendu +proj=lcc +nadgrids=ntf_r93.gsb,null +wktext +towgs84=-168.0000,-60.0000,320.0000 +a=6378249.2000 +rf=293.4660210000000 +pm=2.337229167 +lat_0=46.800000000 +lon_0=0.000000000 +k_0=0.99987742 +lat_1=46.800000000 +x_0=600000.000 +y_0=2200000.000 +units=m +no_defs');
insert into spatial_ref_sys values (910001,'IGNF',310024140,'PROJCS["Lambert 93",GEOGCS["Réseau géodésique français 1993",DATUM["Réseau géodésique français 1993",SPHEROID["IAG GRS 1980",6378137.0000,298.2572221010000,AUTHORITY["IGNF","ELG037"]],TOWGS84[0.0000,0.0000,0.0000,0,0,0,0],AUTHORITY["IGNF","REG024"]],PRIMEM["Greenwich",0.000000000,AUTHORITY["IGNF","LGO01"]],UNIT["degree",0.01745329251994330],AXIS["Longitude",EAST],AXIS["Latitude",NORTH],AUTHORITY["IGNF","RGF93G"]],PROJECTION["Lambert_Conformal_Conic_2SP",AUTHORITY["IGNF","PRC0140"]],PARAMETER["semi_major",6378137.0000],PARAMETER["semi_minor",6356752.3141],PARAMETER["latitude_of_origin",46.500000000],PARAMETER["central_meridian",3.000000000],PARAMETER["standard_parallel_1",44.000000000],PARAMETER["standard_parallel_2",49.000000000],PARAMETER["false_easting",700000.000],PARAMETER["false_northing",6600000.000],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["IGNF","LAMB93"]]','+init=IGNF:LAMB93');

4/ Performing a ST_Transform fails :
select xl, yl, ST_X(geom)::INT AS xl93, ST_Y(geom)::INT AS yl93
from (
select *, ST_Transform(ST_SetSRID(ST_MakePoint(xl, yl), 910143), 910142) AS geom from (values (556866, 1902345)
, (689174, 2448195)
, (729095, 2528577)
, (335755, 2059702)
, (623207, 2210468)
, (850337, 1871486)
, (915275, 1889534)
, (639551, 1778327)
, (584365, 2273523)
, (649599, 2228833)) as t(xl, yl)
)g order by xl;
Gives : " PostGIS was unable to transform the point because either no grid shift files were found, or the point does not lie within the range for which the grid shift is defined. Refer to the ST_Transform() section of the PostGIS manual for details on how to configure PostGIS to alter this behaviour."

I repeat that this conversion works good under proj4 : cs2cs -I +init=IGNF:LAMBE +to +init=IGNF:LAMB93

I have tried to specify the proj4text of IGNF:LAMBE with its nadgrids, but I get the same result.

Any help would be appreciated.

Thanks in advance,

Cedric



-----Message d'origine-----
De : postgis-us...@postgis.refractions.net [mailto:postgis-us...@postgis.refractions.net] De la part de DUPREZ Cédric
Envoyé : jeudi 19 juillet 2012 09:22
À : PostGIS Users Discussion
Objet : Re: [postgis-users] Coordinate transformationwithcustomrecordsofspatial_sys_ref

Stephen Woodbridge

unread,
Oct 22, 2012, 11:26:44 AM10/22/12
to postgi...@postgis.refractions.net
Hi Cédric,

+nadgrids=ntf_r93.gsb is a reference to the file:

/usr/share/proj/ntf_r93.gsb or
/usr/local/share/proj/ntf_r93.gsb

Have you verified that you have this file and the permissions are
something like 644?

-Steve W

DUPREZ Cédric

unread,
Oct 22, 2012, 11:33:59 AM10/22/12
to PostGIS Users Discussion
It is a reference to the file :
/usr/share/proj/ntf_r93.gsb
The permissions are the following : -rw-r--r--

Cedric

-----Message d'origine-----
De : postgis-us...@postgis.refractions.net [mailto:postgis-us...@postgis.refractions.net] De la part de Stephen Woodbridge
Envoyé : lundi 22 octobre 2012 17:27

Cedric Duprez

unread,
Jan 7, 2013, 8:37:28 AM1/7/13
to PostGIS Users Discussion
Hi all and let me wish you a happy new year!

I am back with my coordinate transformations with custom records of spatial_sys_ref.

I have a little bit improved. First, I upgraded to Postgis 2.0.2 and PostgreSQL 9.2.1.
Then, I recompiled Proj4 with proj-datum grid 1.5 in the /nad directory of proj4 (what I forgot during the last installation).

Now, I insert my custom spatial references like this:

insert into spatial_ref_sys values (910001,'IGNF',310024140,'PROJCS["Lambert 93",GEOGCS["Réseau géodésique français 1993",DATUM["Réseau géodésique français 1993",SPHEROID["IAG GRS 1980",6378137.0000,298.2572221010000,AUTHORITY["IGNF","ELG037"]],TOWGS84[0.0000,0.0000,0.0000,0,0,0,0],AUTHORITY["IGNF","REG024"]],PRIMEM["Greenwich",0.000000000,AUTHORITY["IGNF","LGO01"]],UNIT["degree",0.01745329251994330],AXIS["Longitude",EAST],AXIS["Latitude",NORTH],AUTHORITY["IGNF","RGF93G"]],PROJECTION["Lambert_Conformal_Conic_2SP",AUTHORITY["IGNF","PRC0140"]],PARAMETER["semi_major",6378137.0000],PARAMETER["semi_minor",6356752.3141],PARAMETER["latitude_of_origin",46.500000000],PARAMETER["central_meridian",3.000000000],PARAMETER["standard_parallel_1",44.000000000],PARAMETER["standard_parallel_2",49.000000000],PARAMETER["false_easting",700000.000],PARAMETER["false_northing",6600000.000],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["IGNF","LAMB93"]]','+init=IGNF:LAMB93');
insert into spatial_ref_sys values (910002,'IGNF',320002120,'PROJCS["Lambert II étendu",GEOGCS["Nouvelle Triangulation Française Paris grades",DATUM["NTF",SPHEROID["Clarke 1880 IGN",6378249.2000,293.4660210000000,AUTHORITY["IGNF","ELG010"]],TOWGS84[-168.0000,-60.0000,320.0000,0,0,0,0],AUTHORITY["IGNF","REG002"]],PRIMEM["Paris",2.337229167,AUTHORITY["IGNF","LGO02"]],UNIT["grad",0.01570796326794897],AXIS["Longitude",EAST],AXIS["Latitude",NORTH],AUTHORITY["IGNF","NTFP"]],PROJECTION["Lambert_Conformal_Conic_1SP",AUTHORITY["IGNF","PRC0120"]],PARAMETER["semi_major",6378249.2000],PARAMETER["semi_minor",6356515.0000],PARAMETER["latitude_of_origin",46.800000000],PARAMETER["central_meridian",0.000000000],PARAMETER["scale_factor",0.99987742],PARAMETER["false_easting",600000.000],PARAMETER["false_northing",2200000.000],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["IGNF","LAMBE"]]','+init=IGNF:LAMBE');

Then, I try to convert Lambert II coordinates into Lambert 93 like this:

SELECT *, ST_Transform(ST_SetSRID(ST_MakePoint(xl, yl), 910002), 910001) AS geom
FROM (values (556866, 1902345) , (689174, 2448195) , (729095, 2528577) , (335755, 2059702) , (623207, 2210468) , (850337, 1871486) , (915275, 1889534) , (639551, 1778327) , (584365, 2273523) , (649599, 2228833)) as t(xl, yl);

But I get the following error: "lwgeom_transform: Cannot handle type 'Invalid type'"
Any idea of what causes this error?

Thanks in advance for your help.

Regards,

Cedric Duprez

_______________________________________________
postgis-users mailing list
postgi...@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Sandro Santilli

unread,
Jan 7, 2013, 9:06:46 AM1/7/13
to PostGIS Users Discussion
On Mon, Jan 07, 2013 at 02:37:28PM +0100, Cedric Duprez wrote:

> I have a little bit improved. First, I upgraded to Postgis 2.0.2 and PostgreSQL 9.2.1.

[...]

> SELECT *, ST_Transform(ST_SetSRID(ST_MakePoint(xl, yl), 910002), 910001) AS geom
> FROM (values (556866, 1902345) , (689174, 2448195) , (729095, 2528577) , (335755, 2059702) , (623207, 2210468) , (850337, 1871486) , (915275, 1889534) , (639551, 1778327) , (584365, 2273523) , (649599, 2228833)) as t(xl, yl);
>
> But I get the following error: "lwgeom_transform: Cannot handle type 'Invalid type'"

How did you upgrade ?
The error sounds like due to a mixed use of old and new library functions.
Try this query:

select distinct p.probin from pg_proc p where p.probin like '%postgis%';

You should get only 2 rows.

--strk;

http://www.cartodb.com - Map, analyze and build applications with your data

~~ http://strk.keybit.net

Cedric Duprez

unread,
Jan 7, 2013, 9:42:20 AM1/7/13
to PostGIS Users Discussion
Thanks for your help.

>The error sounds like due to a mixed use of old and new library functions.
>Try this query:
>
> select distinct p.probin from pg_proc p where p.probin like '%postgis%';
>
>You should get only 2 rows.

The query gives me the following lines:
$libdir/postgis-2.0
$libdir/rtpostgis-2.0

So, it seems to be OK, no?

>How did you upgrade ?
I am on an Ubuntu 12.04 server.
I uninstalled postgis extension 2.0.1, uninstalled postgis using make uninstall under the compiled sources directory.
Then I uninstalled Proj4 in the same way, recompiled after having unzipped proj-datum grid 1.5 in the nad directory.
Then I recompiled the new postgis 2.0.2 from sources and finally installed the extensions.

Have I done something wrong? How can I do to correct my installation?

Cedric

Sandro Santilli

unread,
Jan 7, 2013, 10:05:22 AM1/7/13
to PostGIS Users Discussion
On Mon, Jan 07, 2013 at 03:42:20PM +0100, Cedric Duprez wrote:
> Thanks for your help.
>
> >The error sounds like due to a mixed use of old and new library functions.
> >Try this query:
> >
> > select distinct p.probin from pg_proc p where p.probin like '%postgis%';
> >
> >You should get only 2 rows.
>
> The query gives me the following lines:
> $libdir/postgis-2.0
> $libdir/rtpostgis-2.0
>
> So, it seems to be OK, no?

Yes

> >How did you upgrade ?
> I am on an Ubuntu 12.04 server.
> I uninstalled postgis extension 2.0.1, uninstalled postgis using make uninstall under the compiled sources directory.
> Then I uninstalled Proj4 in the same way, recompiled after having unzipped proj-datum grid 1.5 in the nad directory.
> Then I recompiled the new postgis 2.0.2 from sources and finally installed the extensions.
>
> Have I done something wrong? How can I do to correct my installation?

Actually it seems all fine to me.
Can you reproduce with any other SRID value ?

--strk;

Cedric Duprez

unread,
Jan 8, 2013, 5:25:25 AM1/8/13
to PostGIS Users Discussion
>> I am on an Ubuntu 12.04 server.
>> I uninstalled postgis extension 2.0.1, uninstalled postgis using make uninstall under the compiled sources directory.
>> Then I uninstalled Proj4 in the same way, recompiled after having unzipped proj-datum grid 1.5 in the nad directory.
>> Then I recompiled the new postgis 2.0.2 from sources and finally installed the extensions.
>>
>> Have I done something wrong? How can I do to correct my installation?

>Actually it seems all fine to me.
>Can you reproduce with any other SRID value ?

Yes, I can reproduce it with any other SRID values. Example:
SELECT ST_X(g) AS x, ST_Y(g) AS y
FROM (
SELECT ST_Transform(ST_GeomFromText('POINT (2.017400 49.024761)', 4326), 27582) AS g
) AS req;
I get the same error message: ERROR: lwgeom_transform: Cannot handle type 'Invalid type'
État SQL :XX000

What should I do to perform a complete reinstallation from sources?

Cedric

Sandro Santilli

unread,
Jan 8, 2013, 5:28:16 AM1/8/13
to PostGIS Users Discussion
On Tue, Jan 08, 2013 at 11:25:25AM +0100, Cedric Duprez wrote:
> >> I am on an Ubuntu 12.04 server.
> >> I uninstalled postgis extension 2.0.1, uninstalled postgis using make uninstall under the compiled sources directory.
> >> Then I uninstalled Proj4 in the same way, recompiled after having unzipped proj-datum grid 1.5 in the nad directory.
> >> Then I recompiled the new postgis 2.0.2 from sources and finally installed the extensions.
> >>
> >> Have I done something wrong? How can I do to correct my installation?
>
> >Actually it seems all fine to me.
> >Can you reproduce with any other SRID value ?
>
> Yes, I can reproduce it with any other SRID values. Example:
> SELECT ST_X(g) AS x, ST_Y(g) AS y
> FROM (
> SELECT ST_Transform(ST_GeomFromText('POINT (2.017400 49.024761)', 4326), 27582) AS g
> ) AS req;
> I get the same error message: ERROR: lwgeom_transform: Cannot handle type 'Invalid type'
> État SQL :XX000
>
> What should I do to perform a complete reinstallation from sources?

Can you reproduce droping the ST_GeomFromText call ?

SELECT ST_X(g) AS x, ST_Y(g) AS y
FROM (
SELECT ST_Transform('SRID=4326;POINT (2.017400 49.024761)'::geometry, 27582) AS g
) AS req;

And with a simpler query ?

SELECT ST_Summary('SRID=4326;POINT (2.017400 49.024761)'::geometry);

--strk;

Cedric Duprez

unread,
Jan 8, 2013, 9:04:21 AM1/8/13
to PostGIS Users Discussion
>Can you reproduce droping the ST_GeomFromText call ?

> SELECT ST_X(g) AS x, ST_Y(g) AS y
> FROM (
> SELECT ST_Transform('SRID=4326;POINT (2.017400 49.024761)'::geometry, 27582) AS g
> ) AS req;

>And with a simpler query ?

> SELECT ST_Summary('SRID=4326;POINT (2.017400 49.024761)'::geometry);

OK, the first query gave me the same error (lwgeom_transform: Cannot handle type 'Invalid type')

The second one gives: Point[S]

Cedric

Sandro Santilli

unread,
Jan 8, 2013, 9:23:17 AM1/8/13
to PostGIS Users Discussion
On Tue, Jan 08, 2013 at 03:04:21PM +0100, Cedric Duprez wrote:
> >Can you reproduce droping the ST_GeomFromText call ?
>
> > SELECT ST_X(g) AS x, ST_Y(g) AS y
> > FROM (
> > SELECT ST_Transform('SRID=4326;POINT (2.017400 49.024761)'::geometry, 27582) AS g
> > ) AS req;
>
> >And with a simpler query ?
>
> > SELECT ST_Summary('SRID=4326;POINT (2.017400 49.024761)'::geometry);
>
> OK, the first query gave me the same error (lwgeom_transform: Cannot handle type 'Invalid type')
> The second one gives: Point[S]

Uhm, what about:

select n.nspname, p.proname, p.prosrc, p.probin from pg_proc p, pg_type t, pg_namespace n where p.pronamespace = n.oid and p.proargtypes[0] = t.oid and t.typname = 'geometry' and proname = 'st_transform';

You may also keep trying to simplify the case, ie:

SELECT ST_Transform('SRID=4326;POINT(0 0)'::geometry, 27582)
SELECT ST_Transform('SRID=4326;POINT(0 0)'::geometry, 4326)

--strk;

Cedric Duprez

unread,
Jan 8, 2013, 9:29:04 AM1/8/13
to PostGIS Users Discussion
>select n.nspname, p.proname, p.prosrc, p.probin from pg_proc p, pg_type t, pg_namespace n where p.pronamespace = n.oid and p.proargtypes[0] = t.oid and t.typname = 'geometry' and proname = 'st_transform';

It gives : public;st_transform;transform;$libdir/postgis-2.0

> SELECT ST_Transform('SRID=4326;POINT(0 0)'::geometry, 27582)
ERROR: lwgeom_transform: Cannot handle type 'Invalid type'

> SELECT ST_Transform('SRID=4326;POINT(0 0)'::geometry, 4326)
D820000001000010E600000000000000000000000000000000


The problem seems to come from proj-datum grid, isn't is ?

Sandro Santilli

unread,
Jan 8, 2013, 9:37:09 AM1/8/13
to PostGIS Users Discussion
On Tue, Jan 08, 2013 at 03:29:04PM +0100, Cedric Duprez wrote:
> >select n.nspname, p.proname, p.prosrc, p.probin from pg_proc p, pg_type t, pg_namespace n where p.pronamespace = n.oid and p.proargtypes[0] = t.oid and t.typname = 'geometry' and proname = 'st_transform';
>
> It gives : public;st_transform;transform;$libdir/postgis-2.0
>
> > SELECT ST_Transform('SRID=4326;POINT(0 0)'::geometry, 27582)
> ERROR: lwgeom_transform: Cannot handle type 'Invalid type'
>
> > SELECT ST_Transform('SRID=4326;POINT(0 0)'::geometry, 4326)
> D820000001000010E600000000000000000000000000000000
>
>
> The problem seems to come from proj-datum grid, isn't is ?

Possibly, but first try a different SRID (4326 both for source
and destination is likely short-circuited).

--strk;

Cedric Duprez

unread,
Jan 8, 2013, 10:42:29 AM1/8/13
to PostGIS Users Discussion
>Possibly, but first try a different SRID (4326 both for source
>and destination is likely short-circuited).

OK. I tried these queries:
SELECT ST_Transform('SRID=4326;POINT(0 0)'::geometry, 32148)
It gives the same error.

Whatever SRID I use, different from 4326, gives me an error.

Sandro Santilli

unread,
Jan 9, 2013, 3:38:47 AM1/9/13
to PostGIS Users Discussion
On Tue, Jan 08, 2013 at 04:42:29PM +0100, Cedric Duprez wrote:
> >Possibly, but first try a different SRID (4326 both for source
> >and destination is likely short-circuited).
>
> OK. I tried these queries:
> SELECT ST_Transform('SRID=4326;POINT(0 0)'::geometry, 32148)
> It gives the same error.
>
> Whatever SRID I use, different from 4326, gives me an error.

Can you try with a new install in another database ?
If the problem persist please file a ticket with all details.

--strk;

Cedric Duprez

unread,
Jan 9, 2013, 8:21:49 AM1/9/13
to PostGIS Users Discussion
> Can you try with a new install in another database ?
> If the problem persist please file a ticket with all details.

OK, after install in a new database, ST_Transform works correctly with pre-defined SRIDs.

I still have an error on my custom SRIDs, which is different from the last error:

select *, ST_Transform(ST_SetSRID(ST_MakePoint(xl, yl), 910002), 910001) AS geom
from (values (556866, 1902345) , (689174, 2448195) , (729095, 2528577) , (335755, 2059702) , (623207, 2210468) , (850337, 1871486) , (915275, 1889534) , (639551, 1778327) , (584365, 2273523) , (649599, 2228833)) as t(xl, yl);

ERROR: AddToPROJ4SRSCache: could not parse proj4 string '+init=IGNF:LAMBE' no system list, errno: 2

However, the proj-datumgrid-1.5 was compiled with Proj4.

Any suggestion?

Thanks a lot.

Cedric Duprez

unread,
Jan 18, 2013, 12:10:23 PM1/18/13
to PostGIS Users Discussion
I'll try to give you a better idea of my configuration :
Server: Ubuntu 12.04 (server version), 64-bit
PostgreSQL: version 9.2.2, compiled in directory /opt/postgreSQL/9.2
Geos: version 3.3.5, installed like this: ./configure --prefix=/opt/postgreSQL/9.2 && make && make install
Proj4: version 4.8.0 with proj-datumgrid-1.5.zip unzipped in its /nad directory, compiled like this:./configure --prefix=/opt/postgreSQL/9.2 && make && make install
Postgis: version 2.0.2, ./configure --with-pgconfig=/opt/postgreSQL/9.2/bin/pg_config --with-geosconfig=/opt/postgreSQL/9.2/bin/geos-config && make && make install

I installed the postgis extensions in postgreSQL from pgAdmin.

I add my 2 custom SRID as this:

insert into spatial_ref_sys values (910001,'IGNF',310024140,'PROJCS["Lambert 93",GEOGCS["Réseau géodésique français 1993",DATUM["Réseau géodésique français 1993",SPHEROID["IAG GRS 1980",6378137.0000,298.2572221010000,AUTHORITY["IGNF","ELG037"]],TOWGS84[0.0000,0.0000,0.0000,0,0,0,0],AUTHORITY["IGNF","REG024"]],PRIMEM["Greenwich",0.000000000,AUTHORITY["IGNF","LGO01"]],UNIT["degree",0.01745329251994330],AXIS["Longitude",EAST],AXIS["Latitude",NORTH],AUTHORITY["IGNF","RGF93G"]],PROJECTION["Lambert_Conformal_Conic_2SP",AUTHORITY["IGNF","PRC0140"]],PARAMETER["semi_major",6378137.0000],PARAMETER["semi_minor",6356752.3141],PARAMETER["latitude_of_origin",46.500000000],PARAMETER["central_meridian",3.000000000],PARAMETER["standard_parallel_1",44.000000000],PARAMETER["standard_parallel_2",49.000000000],PARAMETER["false_easting",700000.000],PARAMETER["false_northing",6600000.000],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["IGNF","LAMB93"]]','+init=IGNF:LAMB93');
insert into spatial_ref_sys values (910002,'IGNF',320002120,'PROJCS["Lambert II étendu",GEOGCS["Nouvelle Triangulation Française Paris grades",DATUM["NTF",SPHEROID["Clarke 1880 IGN",6378249.2000,293.4660210000000,AUTHORITY["IGNF","ELG010"]],TOWGS84[-168.0000,-60.0000,320.0000,0,0,0,0],AUTHORITY["IGNF","REG002"]],PRIMEM["Paris",2.337229167,AUTHORITY["IGNF","LGO02"]],UNIT["grad",0.01570796326794897],AXIS["Longitude",EAST],AXIS["Latitude",NORTH],AUTHORITY["IGNF","NTFP"]],PROJECTION["Lambert_Conformal_Conic_1SP",AUTHORITY["IGNF","PRC0120"]],PARAMETER["semi_major",6378249.2000],PARAMETER["semi_minor",6356515.0000],PARAMETER["latitude_of_origin",46.800000000],PARAMETER["central_meridian",0.000000000],PARAMETER["scale_factor",0.99987742],PARAMETER["false_easting",600000.000],PARAMETER["false_northing",2200000.000],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["IGNF","LAMBE"]]','+init=IGNF:LAMBE');

When I try the following query:
select *, ST_Transform(ST_SetSRID(ST_MakePoint(xl, yl), 910002), 910001) AS geom
from (values (556866, 1902345) , (689174, 2448195) , (729095, 2528577) , (335755, 2059702) , (623207, 2210468) , (850337, 1871486) , (915275, 1889534) , (639551, 1778327) , (584365, 2273523) , (649599, 2228833)) as t(xl, yl);

I get the following error: ERROR: AddToPROJ4SRSCache: could not parse proj4 string '+init=IGNF:LAMBE' no system list, errno: 2

What is wrong in my configuration that could explain this error?
Is my ntf_rgf93.gsb file at the wrong place?

Thanks in advance for your help.

Cedric

ced

unread,
Jan 28, 2013, 11:43:44 AM1/28/13
to postgi...@postgis.refractions.net
I tried an install under WinXP.
Everything works good and projection results are OK.

So, the problem, on my Ubuntu server, seems to come from my build from
sources.
The postgis_full_version() gives :
POSTGIS="2.0.2 r10789" 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.8"
LIBJSON="UNKNOWN" TOPOLOGY RASTER

This means that PROJ4 is detected as version 4.8.0, which is OK.

Why doesn't ST_Transform find my IGNF:LAMBE system?

Thanks for your help.

cedric



--
View this message in context: http://postgis.17.n6.nabble.com/Coordinate-transformation-with-custom-records-of-spatial-sys-ref-tp4998668p5002455.html
Sent from the PostGIS - User mailing list archive at Nabble.com.

Cedric Duprez

unread,
Jan 31, 2013, 10:47:36 AM1/31/13
to PostGIS Users Discussion
After a full uninstall from sources and complete recompilation from sources, everything works correctly.
I don't know the reason of the error message.

The only thing I changed was the GEOS version (3.3.7).

So, now, it's OK.

Thanks for the help.
Regards,

Cedric

> I tried an install under WinXP.
> Everything works good and projection results are OK.
>
> So, the problem, on my Ubuntu server, seems to come from my build from
> sources.
> The postgis_full_version() gives :
> POSTGIS="2.0.2 r10789" 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.8"
> LIBJSON="UNKNOWN" TOPOLOGY RASTER
>
> This means that PROJ4 is detected as version 4.8.0, which is OK.

> Why doesn't ST_Transform find my IGNF:LAMBE system?

> Thanks for your help.

> cedric
Reply all
Reply to author
Forward
0 new messages