Re: [postgis-users] ERROR: Operation on two geometries with different SRIDs

2011-11-07 Thread Stefan Schwarzer
>> Now, trying to import it with:
>> 
>>shp2pgsql -s EPSG:26191 -I -D morocco.shp morocco>  morocco.sql
>>psql -U  my_database<  morocco.sql
> 
> Hi Stefan,
> 
> The SRID argument to shp2pgsql should just be a plain numeric field, and not 
> have the EPSG prefix in front of it, e.g.:
> 
> shp2pgsql -s 26191 -I -D morocco.shp morocco>  morocco.sql
> 
> This should generate you a file with the SRID 26191 which should load without 
> any further issues.

That did the trick! Great. Thanks a lot!!
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] ERROR: Operation on two geometries with different SRIDs

2011-11-07 Thread Mark Cave-Ayland

On 07/11/11 14:07, Stefan Schwarzer wrote:


Now, trying to import it with:

shp2pgsql -s EPSG:26191 -I -D morocco.shp morocco>  morocco.sql
psql -U  my_database<  morocco.sql


Hi Stefan,

The SRID argument to shp2pgsql should just be a plain numeric field, and 
not have the EPSG prefix in front of it, e.g.:


shp2pgsql -s 26191 -I -D morocco.shp morocco>  morocco.sql

This should generate you a file with the SRID 26191 which should load 
without any further issues.



HTH,

Mark.

--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] ERROR: Operation on two geometries with different SRIDs

2011-11-07 Thread Nicolas Ribot
On 7 November 2011 15:07, Stefan Schwarzer  wrote:
> Hi there,
>
> I am somewhat fighting with the projection of my file.
>
> I have a file for Morocco, which, after ArcMap, has the following projection:
>
>       Projected Coordinate System:     zone1
>       Projection:      Lambert_Conformal_Conic
>       False_Easting:   50.
>       False_Northing:  30.
>       Central_Meridian:        -5.4000
>       Standard_Parallel_1:     34.8660
>       Standard_Parallel_2:     31.7250
>       Scale_Factor:    1.
>       Latitude_Of_Origin:      33.3000
>       Linear Unit:     Meter
>       Geographic Coordinate System:    GCS_Merchich_Degree
>       Datum:   D_Merchich
>
> After looking around, it seems to be the EPSG 26191 
> (http://spatialreference.org/ref/epsg/26191/).
>
> Now, trying to import it with:
>
>       shp2pgsql -s EPSG:26191 -I -D morocco.shp morocco > morocco.sql
>       psql -U  my_database < morocco.sql
>
>
> I can see in the SQL file that the SRID is set to -1. If I change this to 
> 26191, and try to import it then, it gives me an error message:
>
>       ERROR:  new row for relation "morocco" violates check constraint 
> "enforce_srid_the_geom"
>

Hi,
Can you explicitly drop the table before re-running the SQL ?

>
> So, I changed the SRID in the geometry_columns manually.
>
> But when trying to map the layer, I receive the error messsage:
>
>        ERROR: Operation on two geometries with different SRIDs
>
>

It is not enough to update the geometry_columns. You also have to
update internal geometries SRID:
update mytable set geom = set_srid(geom).

(looking at the manual, I also see: updateGeometrySrid, that manages
all operations (metadata, constraints and data, did not know this one
:) )

> My Mapserver.map file show only SQLs with 26191, for projection of main 
> document, as well as SQLs such as:
>
>        DATA 'the_geom FROM morocco USING UNIQUE gid USING srid=26191'
>
>
> Extent and units of the mapserver file have been changed to the proper 
> extent/units.
>
> So, I am confused about where the problem comes from. It would be great if 
> someone could give me a hint where the error lies.
>
> Thanks a lot!
>

Nicolas
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] ERROR: Operation on two geometries with different SRIDs

2011-11-07 Thread Stefan Schwarzer
Hi there,

I am somewhat fighting with the projection of my file.

I have a file for Morocco, which, after ArcMap, has the following projection:

   Projected Coordinate System: zone1
   Projection:  Lambert_Conformal_Conic
   False_Easting:   50.
   False_Northing:  30.
   Central_Meridian:-5.4000
   Standard_Parallel_1: 34.8660
   Standard_Parallel_2: 31.7250
   Scale_Factor:1.
   Latitude_Of_Origin:  33.3000
   Linear Unit: Meter
   Geographic Coordinate System:GCS_Merchich_Degree
   Datum:   D_Merchich

After looking around, it seems to be the EPSG 26191 
(http://spatialreference.org/ref/epsg/26191/).

Now, trying to import it with:

   shp2pgsql -s EPSG:26191 -I -D morocco.shp morocco > morocco.sql
   psql -U  my_database < morocco.sql


I can see in the SQL file that the SRID is set to -1. If I change this to 
26191, and try to import it then, it gives me an error message: 

   ERROR:  new row for relation "morocco" violates check constraint 
"enforce_srid_the_geom"


So, I changed the SRID in the geometry_columns manually.

But when trying to map the layer, I receive the error messsage: 

ERROR: Operation on two geometries with different SRIDs


My Mapserver.map file show only SQLs with 26191, for projection of main 
document, as well as SQLs such as: 

DATA 'the_geom FROM morocco USING UNIQUE gid USING srid=26191' 


Extent and units of the mapserver file have been changed to the proper 
extent/units.

So, I am confused about where the problem comes from. It would be great if 
someone could give me a hint where the error lies.

Thanks a lot!



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] ERROR: Operation on two GEOMETRIES with different SRIDs (again)

2011-02-14 Thread Nicklas Avén
Hallo

You have two problems here

first

You don't transform the geometr to another srid with set_srid, you just
tell what srid the geometry has.

use ST_Transform instead

second.

Do your transformation into a new table or at least into a new column to
don't get in trouble with srid-constraints.

But why you get that error message here I can't see at once. 

HTH

Nicklas

On Mon, 2011-02-14 at 08:58 -0500, Farrukh Najmi wrote:
> I have a table GeometryValueType with column of type geometry and name 
> geometry.
>  From advice received on a previous thread on this list I have made sure 
> that all data in geometry column has the same SRID.
> Currently them SRID is 4326 (EPSG:4326). I would now like to transform 
> all values ion the column to use (EPSG:4979) in order to support 3D data.
> 
> So I loaded the EPSG:4979 definition into spatial_ref_system using:
> 
> http://spatialreference.org/ref/epsg/4979 (Page for 4979 CRS)
> http://spatialreference.org/ref/epsg/4979/postgis/ (INSERT statement for 
> postgis)
> 
> I then tried the following statement to transform all data in the 
> geometry column to EPSG:4979 as follows:
> 
>UPDATE GeometryValueType SET geometry = ST_SETSRID(geometry, 4979)
> 
> But this gave me the familiar:
> 
> ERROR:  Operation on two GEOMETRIES with different SRIDs
> 
> I have made sure that all data in the geometry column has srid of 4326 
> using:
> 
>SELECT DISTINCT ST_SRID(geometry) FROM GeometryValueType;
> 
> So why am I getting the "ERROR:  Operation on two GEOMETRIES with 
> different SRIDs"?
> 
> Thanks for your help.
> 


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] ERROR: Operation on two GEOMETRIES with different SRIDs (again)

2011-02-14 Thread Farrukh Najmi


I have a table GeometryValueType with column of type geometry and name 
geometry.
From advice received on a previous thread on this list I have made sure 
that all data in geometry column has the same SRID.
Currently them SRID is 4326 (EPSG:4326). I would now like to transform 
all values ion the column to use (EPSG:4979) in order to support 3D data.


So I loaded the EPSG:4979 definition into spatial_ref_system using:

http://spatialreference.org/ref/epsg/4979 (Page for 4979 CRS)
http://spatialreference.org/ref/epsg/4979/postgis/ (INSERT statement for 
postgis)


I then tried the following statement to transform all data in the 
geometry column to EPSG:4979 as follows:


  UPDATE GeometryValueType SET geometry = ST_SETSRID(geometry, 4979)

But this gave me the familiar:

ERROR:  Operation on two GEOMETRIES with different SRIDs

I have made sure that all data in the geometry column has srid of 4326 
using:


  SELECT DISTINCT ST_SRID(geometry) FROM GeometryValueType;

So why am I getting the "ERROR:  Operation on two GEOMETRIES with 
different SRIDs"?


Thanks for your help.

--
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] ERROR: Operation on two geometries with different SRIDs

2008-01-15 Thread Kevin Neufeld

What do you get when you issue this query?

SELECT ST_SRID(the_geom), count(*)
FROM "public"."kanagawa"
GROUP BY ST_SRID;

-- Kevin

Andrea Maschio wrote:
Hello, while trying to dome this query in geoserver, I've got the 
following error: ERROR: Operation on two geometries with different 
SRIDs. My kanagawa table (downloaded from pgrouting sample app, was 
registered in geometry column with SRID 4326(manually by me). I cannot 
understand what's happening, because I simply don't understand wich is 
the second geometry that (probably) has the SRDI=-1. Any clue?


SELECT "gid", "length", "x1", "y1", "x2", "y2", "source", "target", 
encode(AsBinary(force_2d("the_geom"), 'XDR'),'base64') FROM 
"public"."kanagawa" WHERE "the_geom" && GeometryFromText('POLYGON 
((138.86892242431625 35.10309162139895, 138.86892242431625 
35.69988307952885, 139.90027313232477 35.69988307952885, 
139.90027313232477 35.10309162139895, 138.86892242431625 
35.10309162139895))', 4326) AND intersects("the_geom", 
GeometryFromText('POLYGON ((138.86892242431625 35.10309162139895, 
138.86892242431625 35.69988307952885, 139.90027313232477 
35.69988307952885, 139.90027313232477 35.10309162139895, 
138.86892242431625 35.10309162139895))', 4326))


Thanks

Andrea Maschio



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
  

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] ERROR: Operation on two geometries with different SRIDs

2008-01-15 Thread Andrea Maschio




Hello, while trying to dome this query in geoserver, I've got the
following error: ERROR: Operation on two geometries with different
SRIDs. My kanagawa table (downloaded from pgrouting sample app, was
registered in geometry column with SRID 4326(manually by me). I cannot
understand what's happening, because I simply don't understand wich is
the second geometry that (probably) has the SRDI=-1. Any clue?

SELECT "gid", "length", "x1", "y1", "x2", "y2", "source", "target",
encode(AsBinary(force_2d("the_geom"), 'XDR'),'base64') FROM
"public"."kanagawa" WHERE "the_geom" &&
GeometryFromText('POLYGON ((138.86892242431625 35.10309162139895,
138.86892242431625 35.69988307952885, 139.90027313232477
35.69988307952885, 139.90027313232477 35.10309162139895,
138.86892242431625 35.10309162139895))', 4326) AND
intersects("the_geom", GeometryFromText('POLYGON ((138.86892242431625
35.10309162139895, 138.86892242431625 35.69988307952885,
139.90027313232477 35.69988307952885, 139.90027313232477
35.10309162139895, 138.86892242431625 35.10309162139895))', 4326))

Thanks

Andrea Maschio



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users