【问题标题】:PostGIS - certain MultiPolygons cause "BOOM! Could not generate outside point!"PostGIS - 某些 MultiPolygons 导致“BOOM!无法生成外点!”
【发布时间】:2011-05-03 00:26:15
【问题描述】:

我试图表示一个跨越 180 度经度的矩形区域。更多背景见In PostGIS a polygon bigger than half the world is treated as it's opposite

这是我的测试用例:

from django.contrib.gis.geos import Polygon, MultiPolygon
from my_project.my_app.models import Photo

a = Polygon.from_bbox((30, -80, 180, 80))  # the part to the east of 180
b = Polygon.from_bbox((-180, -80, -160, 80))  # a part to the west of 180
c = Polygon.from_bbox((-180, -80, -100, 80))  # a larger part to the west of 180

ok   = MultiPolygon(a,b)
ok2  = MultiPolygon(c)
boom = MultiPolygon(a,c)

# This works
Photo.objects.filter(location__coveredby=ok)[:1]
# This also works so c is ok
Photo.objects.filter(location__coveredby=ok2)[:1]
# This gives "BOOM! Could not generate outside point!"
Photo.objects.filter(location__coveredby=boom)[:1]

# splitting c doesn't help
c1 = Polygon.from_bbox((-180, -80, -140, 80))
c2 = Polygon.from_bbox((-140, -80, -100, 80))
test = MultiPolygon(a,c1,c2)
Photo.objects.filter(location__coveredby=test)[:1]
# BOOM! Could not generate outside point!

通过更改数字,我可以让这个错误来来去去。 (-180, -80, x, 80) 例如在 x

我可以查看正在生成的 SQL,但这些区域以二进制 (EWKB) 表示,我不确定如何读取它。

谁能解释一下?

【问题讨论】:

    标签: postgis geodjango geos


    【解决方案1】:

    在问了这个问题后,我发现了关于 gis.stackexchange.com 的信息,所以我也在那里问了。在那里的好人的帮助下,我发现了问题所在(我认为)和解决方案。

    见: https://gis.stackexchange.com/questions/9217/postgis-certain-multipolygons-cause-boom-could-not-generate-outside-point/9257#9257

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-21
      • 2016-10-05
      • 1970-01-01
      • 1970-01-01
      • 2018-02-14
      • 1970-01-01
      • 2013-02-02
      • 1970-01-01
      相关资源
      最近更新 更多