I have this table below

CREATE TABLE public.geometry_polyline_volume (
    id          serial not null primary key,
    distance    float not null,
    height      float not null,
    coordinates path not null );

I am trying to make this query:

    FROM public.geometry_polyline_volume 
    WHERE box'((15,47),(16,48))' ?# coordinates;

I am getting this error:

ERROR:  operator does not exist: box ?# path
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

How can I find if a path is intersecting with a box?

  • Maybe the overlap operator : SELECT box('((15,47),(16,48))')::polygon && path::polygon ? But beware, it can be not exact ... – J. Monticolo Feb 13 at 9:50
  • I have solved it with this SELECT * FROM public.geometry_polyline_volume WHERE path(polygon(box'((15,47),(16,48))')) ?# coordinates or polygon(box'((15,47),(16,48))') @> polygon(coordinates); – chatzich Feb 13 at 10:12
  • Post this solution for your question, in Stack, you can self-answer. – J. Monticolo Feb 13 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.