Commit Graph

25 Commits

Author SHA1 Message Date
tidwall 2c643996e7 Immutable Object type 2022-09-20 14:20:53 -07:00
tidwall ba9a767988 Changed the collection rectangle dimension type
Previously used float64s, now using float32s.
Saving about 15% on rectangle memory.
Uses the Roundoff trick from Sqlite.
2022-09-19 17:51:14 -07:00
tidwall d5c148ca41 Field overhaul 2022-09-19 17:47:38 -07:00
Benjamin Ramser 33e8e28a83 feat: add distance to NEARBY IDS response 2022-09-17 11:02:20 +02:00
tidwall 498bbe23ff Updated btree and rtree
This commit updates to the latest btree and rtree.

The rtree algorithm has been modified in `tidwall/rtree@v1.7`
which now keeps internal and leaf rect sorted by the min-x
coordinate. This make for much faster (up to 50%) faster
searches and replacements, but slightly slower inserts.

Because of the R-tree update, the tests needed to be updated to
account for the change in order for undeterministic WITHIN and
INTERSECTS commands.
2022-09-11 14:31:00 -07:00
tidwall f24c251ee6 Allow for multiple MATCH patterns
Each MATCH is inclusive OR, thus

    WITHIN fleet MATCH train* truck* BOUNDS 33 -112 34 -113

will find all trains and trucks that within the provides bounds.
2022-09-01 19:43:30 -07:00
tidwall 8e61f8163e Fix test on Apple silicon
The returned distance value for the kNN test was failing on a
Apple M1 machine. The test expected a hardcoded value.

amd64: 13053.885940801563
apple: 13053.885940801567

Not sure why the difference between the two cpus but I changed
the test to not compare for exact equality.
2022-06-16 16:02:37 -07:00
tidwall 241117c7ba Added BUFFER option for Within and Intersects
This commit allows for buffering any GeoJSON object.

For example:

    INTERSECTS fleet BUFFER 1000 OBJECT {...LineString...}

This will buffer add a 1 kilometer buffer to a linesting and
search the 'fleet' collection for all objects that
intersect the buffered linestring.

This commit also allows for performing INTERSECTS with a POINT
type. Thus allowing for a polygon-over-point operation, which is
an inverted point-in-polygon.
2021-12-09 18:14:50 -07:00
Benjamin Ramser c87fd4836e test: add more tests 2021-09-05 12:56:45 +02:00
Benjamin Ramser 6eb1cca78c fix: point -> circle fallthrough 2021-09-05 12:05:33 +02:00
tidwall 401670e621 Fix NEARBY with SPARSE returning too many results
fixes #618
2021-07-22 08:39:57 -07:00
tidwall 3c699183e0 Additional KNN test 2021-07-11 14:49:23 -07:00
tidwall 579a41abae Merge branch 'housecanary-fix-knn' 2021-07-11 10:02:59 -07:00
Josh 1467cba769
Merge pull request #552 from rshura/clip-by
Add CLIPBY subcommand to INTERSECTS/WITHIN
2021-07-10 09:24:57 -07:00
Benjamin Ramser 2a8b98778b fix: distance if point and object have the same coordinates 2021-03-19 09:42:38 +01:00
Mike Poindexter fe6e3863ba Add bench tests for knn 2020-04-08 11:36:37 -07:00
Alex Roitman 34cb2affdc Add clipby subcommand to INTERSECTS/WITHIN 2020-04-03 16:49:06 -07:00
Melissa Baker bedddcbe13 Added RESP output fields test for NEARBY/WITHIN 2019-06-04 10:43:32 -07:00
Melissa Baker 4ba237b10e Added test for correct json fields output 2019-05-28 12:28:56 -07:00
tidwall fc3e8b4359 Fix nearby with match query invalid results
closes #421
2019-03-01 06:55:26 -07:00
Alex Roitman 0933c541f4 Refactor cursor/paging. 2018-10-31 22:01:37 -07:00
Alex Roitman 7c803f355b Make NEARBY always use knn 2018-10-25 16:37:06 -07:00
tidwall cc75cf22a8 Fix #369 poly in hole query 2018-10-18 06:28:31 -07:00
Alex Roitman 1517a2a770 Add unit tests for WITHIN and INTERSECTS. 2018-10-17 13:34:11 -07:00
tidwall 6257ddba78 Faster point in polygon / GeoJSON updates
The big change is that the GeoJSON package has been completely
rewritten to fix a few of geometry calculation bugs, increase
performance, and to better follow the GeoJSON spec RFC 7946.

GeoJSON updates

- A LineString now requires at least two points.
- All json members, even foreign, now persist with the object.
- The bbox member persists too but is no longer used for geometry
  calculations. This is change in behavior. Previously Tile38 would
  treat the bbox as the object's physical rectangle.
- Corrections to geometry intersects and within calculations.

Faster spatial queries

- The performance of Point-in-polygon and object intersect operations
  are greatly improved for complex polygons and line strings. It went
  from O(n) to roughly O(log n).
- The same for all collection types with many children, including
  FeatureCollection, GeometryCollection, MultiPoint, MultiLineString,
  and MultiPolygon.

Codebase changes

- The pkg directory has been renamed to internal
- The GeoJSON internal package has been moved to a seperate repo at
  https://github.com/tidwall/geojson. It's now vendored.

Please look out for higher memory usage for datasets using complex
shapes. A complex shape is one that has 64 or more points. For these
shapes it's expected that there will be increase of least 54 bytes per
point.
2018-10-13 04:30:48 -07:00