You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dataset:
No results are returned because geoDistance is null. The issue is because geoPoint2 is being returned purely as a string rather than a GeoJSON object.
Replication Factor & Number of Shards (Cluster only):
None
Steps to reproduce
Problem:
geoPoint2 is a string not a GeoJSON. To fix this query I had to wrap the string with JSON_PARSE as follows:
perhaps it was my mistake. I'm using the java driver to create my geoJSON which I saved as a string.
Any idea on how to save a geo JSON using the java driver?
My Environment
Component, Query & Data
Affected feature: Geo queries and/or documentation
AQL query (if applicable):
AQL explain (if applicable):
Query String:
Let geoPoint1 = {"coordinates":[-122.084,37.421997], "type":"Point" }
FOR geo IN Geo
Let geoPoint2 = geo.location
Let geoDistance = GEO_DISTANCE(geoPoint1, geoPoint2)
FILTER geoDistance != null && geoDistance <= 30000
RETURN { "distance" : geoDistance, "location": geo.location}
Execution plan:
Id NodeType Est. Comment
1 SingletonNode 1 * ROOT
10 IndexNode 12 - FOR geo IN Geo /* geo index scan, projections:
location
/5 CalculationNode 12 - LET geoDistance = GEO_DISTANCE({ "coordinates" : [ -122.084, 37.421997 ], "type" : "Point" }, geo.
location
) / simple expression / / collections used: geo : Geo /6 CalculationNode 12 - LET #4 = (geoDistance != null) / simple expression /
7 FilterNode 12 - FILTER #4
8 CalculationNode 12 - LET #6 = { "distance" : geoDistance, "location" : geo.
location
} / simple expression / / collections used: geo : Geo */9 ReturnNode 12 - RETURN #6
Indexes used:
By Type Collection Unique Sparse Selectivity Fields Ranges
10 geo Geo false true n/a [
location
] (GEO_DISTANCE({ "coordinates" : [ -122.084, 37.421997 ], "type" : "Point" }, geo.location
) <= 30000)Functions used:
Name Deterministic Cacheable Uses V8
GEO_DISTANCE true true false
Optimization rules applied:
Id RuleName
1 move-calculations-up
2 move-filters-up
3 remove-unnecessary-calculations
4 move-calculations-up-2
5 move-filters-up-2
6 geo-index-optimizer
7 reduce-extraction-to-projection
Dataset:
No results are returned because geoDistance is null. The issue is because geoPoint2 is being returned purely as a string rather than a GeoJSON object.
Replication Factor & Number of Shards (Cluster only):
None
Steps to reproduce
Problem:
geoPoint2 is a string not a GeoJSON. To fix this query I had to wrap the string with JSON_PARSE as follows:
Let geoPoint2 = JSON_PARSE(geo.location)
Then it works as expected.
Expected result:
According to the documentation here: https://www.arangodb.com/arangodb-training-center/geojson-tutorial/
We should not have to convert the location string to GeoJSON.
Checking my Geo index I have:
The text was updated successfully, but these errors were encountered: