Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.postgresql > #890
| Newsgroups | comp.databases.postgresql |
|---|---|
| Date | 2020-03-28 02:53 -0700 |
| Message-ID | <3371e5b6-53c1-41b4-8bc6-7c6d982fcc69@googlegroups.com> (permalink) |
| Subject | Postgres geometry type operation error in CrudRepository custom sql query |
| From | chatzich@gmail.com |
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)]
Back to comp.databases.postgresql | Previous | Next | Find similar
Postgres geometry type operation error in CrudRepository custom sql query chatzich@gmail.com - 2020-03-28 02:53 -0700
csiph-web