[postgis-users] srid on wkb

Brent Pedersen bpederse at gmail.com
Mon Sep 14 08:34:25 PDT 2009


On Mon, Sep 14, 2009 at 2:57 AM, Mark Cave-Ayland
<mark.cave-ayland at siriusit.co.uk> wrote:
> Brent Pedersen wrote:
>
>> hi, i'm seeing some behavior i dont understand, i'm pasting a shell
>> session for postgresql 8.3.7 below.
>> can someone explain why i'm getting the error from the first command?
>> the wkb has srid 4326 as does the dwr_well.geom field. and
>> it's in the geometry_columns table as such. i've found i can get the
>> desired results by wrapping the wkb in st_setsrid(), but it seems
>> that should be necessary. is there something i'm missing.
>> thanks,
>> -brent
>>
>> SELECT dwr_well.geom AS dwr_well_geom, dwr_well.id AS dwr_well_id,
>> dwr_well.well_number AS dwr_well_well_number
>> FROM dwr_well
>> WHERE ST_Intersects(dwr_well.geom,
>>
>> '01030000208C10000001000000050000006666666666665EC06666666666E644406666666666665EC000000000000045409A99999999595EC000000000000045409A99999999595EC06666666666E644406666666666665EC06666666666E64440'::geometry);
>> ERROR:  Operation on two geometries with different SRIDs
>> dwr=# select
>> srid('01030000208C10000001000000050000006666666666665EC06666666666E644406666666666665EC000000000000045409A99999999595EC000000000000045409A99999999595EC06666666666E644406666666666665EC06666666666E64440'::geometry);
>>  srid
>> ------
>>  4236
>> (1 row)
>>
>> dwr=# select distinct(srid(geom)) from dwr_well;
>>  srid
>> ------
>>  4326
>> (1 row)
>>
>> dwr=# select postgis_full_version();
>>                               postgis_full_version
>>
>> ----------------------------------------------------------------------------------
>>  POSTGIS="1.3.3" GEOS="3.1.1-CAPI-1.6.0" PROJ="Rel. 4.6.0, 21 Dec
>> 2007" USE_STATS
>> (1 row)
>>
>> ######################
>> # and the working query requires explicitly setting the srid:
>>
>> dwr=# SELECT dwr_well.geom AS dwr_well_geom, dwr_well.id AS
>> dwr_well_id, dwr_well.well_number AS dwr_well_well_number
>> FROM dwr_well
>> WHERE ST_Intersects(dwr_well.geom,
>>
>> ST_SetSRID('01030000208C10000001000000050000006666666666665EC06666666666E644406666666666665EC000000000000045409A99999999595EC000000000000045409A99999999595EC06666666666E644406666666666665EC06666666666E64440'::geometry,
>> 4326));
>> [ ... expected results ... ]
>
> According the ouput above, your input geometry has a SRID of *4236* whereas
> your dwr_well table has a SRID of *4326*. Looks like an accidental typo in
> your application somewhere...
>
>
> 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 at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>


/me slaps forehead.
thanks mark.



More information about the postgis-users mailing list