8000 GEO_INTERSECTS doesn't support a GEO_Polygon or GEO_MultiPolygon with holes. · Issue #10770 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

GEO_INTERSECTS doesn't support a GEO_Polygon or GEO_MultiPolygon with holes. #10770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
8000
tom919hsu opened this issue Dec 24, 2019 · 1 comment
Closed
Labels
1 Question 2 Solved Resolution 3 AQL Query language related 3 Geo

Comments

@tom919hsu
Copy link
tom919hsu commented Dec 24, 2019

My Environment

  • ArangoDB Version: 3.5.3
  • Storage Engine: MMFiles
  • Deployment Mode: Single Server >
  • Deployment Strategy: Manual Start
  • Configuration: standard
  • Infrastructure: Own
  • Operating System: Redhat 7.6
  • Total RAM in your machine: 256G
  • Disks in use: 900G
  • Used Package: ArangoDB repository

Component, Query & Data

Affected feature: arango engine

AQL query (if applicable):

LET Area = {
      "type": "Feature",
      "properties": {
        "ID" :"Polygon1"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-122.89521,48.07939],
            [-122.88500,48.07939],
            [-122.88500,48.07738],
            [-122.89521,48.07738],
            [-122.89521,48.07939]
          ],
          [
            [-122.88901,48.07939],
            [-122.88701,48.07939],
            [-122.88701,48.07738],
            [-122.88901,48.07738],
            [-122.88901,48.07939]
          ]
        ]
      }
    }
LET polygon = GEO_POLYGON([[-122.89021,48.07839],[-122.89000,48.07839],[-122.89000,48.07738],[-122.89021,48.07738],[-122.89021,48.07839]])
RETURN GEO_INTERSECTS(Area.geometry, polygon)

AQL explain (if applicable):

 LET Area = {
       "type": "Feature",
       "properties": {
         "ID" :"Polygon1"
       },
       "geometry": {
         "type": "Polygon",
         "coordinates": [
           [
             [-122.89521,48.07939],
             [-122.88500,48.07939],
             [-122.88500,48.07738],
             [-122.89521,48.07738],
             [-122.89521,48.07939]
           ],
           [
             [-122.88901,48.07939],
             [-122.88701,48.07939],
             [-122.88701,48.07738],
             [-122.88901,48.07738],
             [-122.88901,48.07939]
           ]
         ]
       }
     }
 LET polygon = 
 GEO_POLYGON([[-122.89021,48.07839],[-122.89000,48.07839],[-122.89000,48.07738],[-122.89021,48.07738],[-122.89021,48.07839]])
 RETURN GEO_INTERSECTS(Area.geometry, polygon)

Execution plan:
 Id   NodeType          Est.   Comment
  1   SingletonNode        1   * ROOT
  4   CalculationNode      1     - LET #2 = null   /* json expression */   /* const assignment */
  5   ReturnNode           1     - RETURN #2

Indexes used:
 none

Optimization rules applied:
 Id   RuleName
  1   move-calculations-up
  2   remove-unnecessary-calculations

Warnings:
 Code   Message
   10   in function 'GEO_INTERSECTS()': Subsequent loop not a hole in polygon

Dataset:

Size of your Dataset on disk:

Replication Factor & Number of Shards (Cluster only):

Steps to reproduce

  1. Execute the query manually and it won't return "true"

Problem:
unable to get "true" result with GEO_INTERSECTS function

Expected result:
expect to get "True" boolean.

@mpoeter
Copy link
Contributor
mpoeter commented Jun 7, 2021

The problem is that the second polygon in Area does not describe a whole inside the first polygon since the upper/lower latitude is the same. So instead of cutting a whole into the first polygon (rectangle), its cuts it into two separate rectangles. This is not supported by the S2 library which we use internally. With a small adaptation to the coordinates of the second polygon it works as expected:

LET Area = {
      "type": "Feature",
      "properties": {
        "ID" :"Polygon1"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-122.89521,48.07939],
            [-122.88500,48.07939],
            [-122.88500,48.07738],
            [-122.89521,48.07738],
            [-122.89521,48.07939]
          ],
          [
            [-122.88901,48.079389],
            [-122.88701,48.079389],
            [-122.88701,48.077381],
            [-122.88901,48.077381],
            [-122.88901,48.079389]
          ]
        ]
      }
    }
LET polygon = GEO_POLYGON([[-122.89021,48.07839],[-122.89000,48.07839],[-122.89000,48.07738],[-122.89021,48.07738],[-122.89021,48.07839]])
RETURN GEO_INTERSECTS(Area.geometry, polygon)

We can (and will) improve the documentation about these limitations and perhaps also improve the error messages, but otherwise we are not going change the current behavior, so I am closing this as won't fix.

@mpoeter mpoeter closed this as completed Jun 7, 2021
@dothebart dothebart added 1 Question 2 Solved Resolution 3 AQL Query language related labels Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 Question 2 Solved Resolution 3 AQL Query language related 3 Geo
Projects
None yet
Development

No branches or pull requests

4 participants
0