Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Postgres geometry type operation error in CrudRepository custom sql query

10 views
Skip to first unread message

chat...@gmail.com

unread,
Mar 28, 2020, 5:53:12 AM3/28/20
to
I have two WGS 84 points p1(lonul, latul) the up left point and p2(lonbr, latbr) the bottom right point and I want to see which cylinder is intersecting with the rectangle which is defined by these to so I made the following query to a CrudRepository:


CREATE TABLE protected_area
(
id serial not null primary key,
constraint_id integer not null,
radius float not null,
height float not null,
coordinates path not null,
gtype geometrytype not null,
name varchar(50),
);


@Query("SELECT u FROM ProtectedArea u WHERE u.gtype='Cylinder' AND polygon( box(point(:lonul - (180/pi()) * (u.radius/(6378137*cos(pi()*:lonul/180))), :latul - (180/pi()) * (u.radius/6378137)), point(:lonbr + (180/pi()) * (u.radius/(6378137*cos(pi()*:lonbr/180))),:latbr + (180/pi()) * (u.radius/6378137)))) @> polygon(coordinates)")

it seems that the operator @> which indicates if the geometry is contained to another

but I am taking this error

> Caused by: org.hibernate.QueryException: unexpected char: '@' [SELECT
> u FROM ProtectedArea u WHERE u.gtype='Cylinder' AND polygon(
> box(point(:lonul - (180/pi()) *
> (u.radius/(6378137*cos(pi()*:lonul/180))), :latul - (180/pi()) *
> (u.radius/6378137)), point(:lonbr + (180/pi()) *
> (u.radius/(6378137*cos(pi()*:lonbr/180))),:latbr + (180/pi()) *
> (u.radius/6378137)))) @> polygon(coordinates)]

0 new messages