Operation on mixed SRID geometries

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Operation on mixed SRID geometries

Farrukh Najmi
Dear Colleagues,

I am getting the exception below when I do a spatial query using
hibernate-spatial 1.0/PostgisDialect and hibernate-entitymanager 3.5.x:

     SELECT Object(o) FROM mypkg.GeometryValueType gvt  WHERE
         (within(gvt.geometry, ST_GeomFromText('POLYGON((59 22, 78 22,78
38, 59 38, 59 22))', 4326)) = true);

Caused by:ERROR: Operation on mixed SRID geometries
     at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
     at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
     at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
     at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
     at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
     at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
     at
org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
     at org.hibernate.loader.Loader.getResultSet(Loader.java:1869)
     at org.hibernate.loader.Loader.doQuery(Loader.java:718)
     at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
     at org.hibernate.loader.Loader.doList(Loader.java:2449)
     at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2235)
     at org.hibernate.loader.Loader.list(Loader.java:2184)
     at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
     at
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
     at
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
     at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
     at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
     at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241)

When I do the equivalent spatial query directly using pgadmin3 I get the
same error: Operation on mixed SRID geometries

     SELECT * FROM GeometryValueType gvt WHERE
         (within(gvt.geometry, ST_GeomFromText('POLYGON((59 22, 78 22,78
38, 59 38, 59 22))', 4326)) = true);

Looking at the db I see that there is an expected row in the table
GeometryValueType and a value for the geometry column in that table.

When I do the following query directly using pgadmin3 I see that the
only SRID is 4329.

     SELECT DISTINCT SRID(geometry) FROM GeometryValueType;

When I do the following query directly using pgadmin3 I see that there
are no rows in the geometry_columns table:

     SELECT * FROM geometry_columns;

Does this look right? Is the absence of rows in the geometry_columns the
cause of my "Operation on mixed SRID geometries" error?
If so, should'nt hibernate-spatial be creating a row in
geometry_columns  when it creates a row in my GeomteryValueType table
which has a geometry column?

Or is it that I need to modify my query to somehow specify an SRID?

Thanks for any advice.

--
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Operation on mixed SRID geometries

Jan Boonen
Hi Farrukh,

In the text below, you mention SRIDs 4326 and 4329. These are different
numbers, so it should be expected that PostGIS throws an exception.

Cheers,

Jan

On 5-1-2011 16:51, Farrukh Najmi wrote:

> When I do the equivalent spatial query directly using pgadmin3 I get
> the same error: Operation on mixed SRID geometries
>
>     SELECT * FROM GeometryValueType gvt WHERE
>         (within(gvt.geometry, ST_GeomFromText('POLYGON((59 22, 78
> 22,78 38, 59 38, 59 22))', 4326)) = true);
>
> Looking at the db I see that there is an expected row in the table
> GeometryValueType and a value for the geometry column in that table.
>
> When I do the following query directly using pgadmin3 I see that the
> only SRID is 4329.
>
>     SELECT DISTINCT SRID(geometry) FROM GeometryValueType;
>

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Operation on mixed SRID geometries

Farrukh Najmi
Hi Jan,

How embarrassing! I must be getting dyslexic. It was staring in front of
me and I did not see it.

Thanks very much for catching my oversight.

BTW, I am curious when the geometry_columns table is supposed to be
written to in postgis and why it is empty in my case.

On 01/05/2011 11:07 AM, Jan Boonen wrote:

> Hi Farrukh,
>
> In the text below, you mention SRIDs 4326 and 4329. These are
> different numbers, so it should be expected that PostGIS throws an
> exception.
>
> Cheers,
>
> Jan
>
> On 5-1-2011 16:51, Farrukh Najmi wrote:
>> When I do the equivalent spatial query directly using pgadmin3 I get
>> the same error: Operation on mixed SRID geometries
>>
>>     SELECT * FROM GeometryValueType gvt WHERE
>>         (within(gvt.geometry, ST_GeomFromText('POLYGON((59 22, 78
>> 22,78 38, 59 38, 59 22))', 4326)) = true);
>>
>> Looking at the db I see that there is an expected row in the table
>> GeometryValueType and a value for the geometry column in that table.
>>
>> When I do the following query directly using pgadmin3 I see that the
>> only SRID is 4329.
>>
>>     SELECT DISTINCT SRID(geometry) FROM GeometryValueType;
>>
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users 
>
>


--
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users