orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Using variable in ST_Intersects causes InvalidShapeException

Open littlemurph opened this issue 1 year ago • 1 comments

OrientDB Version: 3.2.17 & 3.0.8 running in container

Java Version: 1.8 from container base image

OS: RHEL 8.6 Host

Expected behavior

Should return line records that intersect

Actual behavior

Error: com.orientechnologies.orient.core.exception.OStorageException: Error on executing command: select from line let $geom = (SELECT geom from #14:0) where $geom <> null AND ST_Intersects(aline, $geom) = true DB name="trick"

Error: org.locationtech.spatial4j.exception.InvalidShapeException: can't make Geometry from: null

Steps to reproduce

I'm trying to find all the "lines" that intersect a specific polygon. My database structure is:

poly {
  geom: OPolygon
}

line {
 aline: OLineString
}
create class poly
create property poly.geom embedded OPolygon
create index poly.geom on poly(geom) spatial engine lucene
create class line
create property line.aline embedded OLineString
create index line.aline on line(aline) spatial engine lucene
insert into poly set name = 'Poly1', geom = ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))')
insert into line set name = 'Line1', aline = St_GeomFromText('LINESTRING(2 10, 2 -5)')

select from line let $geom = (SELECT geom from #14:0) where $geom <> null AND ST_Intersects(aline, $geom) = true

The last select statement throws the error mentioned above (in 3.0.8 it's a nullpointer exception). I am expecting it to return the line since they intersect.

Replacing the $geom in the ST_Intersects with 'POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))' works. I'm not sure why I can't use a variable there.

littlemurph avatar Apr 07 '23 16:04 littlemurph

Hi @tglman , I would like to start contributing to orientdb , I have significant amount of experience in working with geospatial tools(postgis + psql , qgis etc) . So I was thinking I will start with this issue.

Is this still a valid issue? and any tips and suggestions for starting contributing to orientdb?

sudoStatus200 avatar Mar 31 '24 19:03 sudoStatus200