Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [spatial4j-dev] Geo3dSpatialContextFactory


On Wed, Aug 12, 2020 at 10:01 AM William LaForest <lacapaneus@xxxxxxxxx> wrote:

In re-reading my email I realize I was rather sloppy, apologies!  I said "I am not implementing" but meant "I am now implementing".  I am pretty sure you deduced that but just to be safe...

Yep; I figured.
 
In my testing when I do a rectangle with either the WKT or GeoJSON Reader and the default SpatialContextFactory I get the exception "java.text.ParseException: java.lang.UnsupportedOperationException: Unsupported shape of this SpatialContext. Try JTS or Geo3D."  My guess is that I need to configure the factory in some fashion but in looking at the javadocs its not clear to me how.

That exception happens when you try to parse a polygon with the default SpatialContext but will not happen if you use the Jts or Geo3d ones.  Ideally, the default one would parse it to support a rectangular polygon only.
 
When I use the Geo3dSpatialContextFactory it parses fine but I am getting some inaccurate results from the relate function.

If you can supply a simple example then I could look into it.

BTW one common user-error with Geo3d:
When using Geo3D, the order of polygon points matters! You must follow the so-called "right hand rule": the exterior ring must be counter-clockwise order and the interior holes must be clockwise. If the order is wrong then the interpretation is inverted, thus the polygon will be interpreted as encompassing most of the globe.
 
Cheers,
~ David

Back to the top