tippecanoe icon indicating copy to clipboard operation
tippecanoe copied to clipboard

Filter raises 'Polygon begins with an inner ring' without changing that data

Open omrivolk opened this issue 5 years ago • 7 comments

I used tippecane with -C 'python myfilter.pyo' and got an error

Polygon begins with an inner ring

So I reduced the filter to just

-C 'cat'

And I get the same error

But removing the -C script completely doesn't raise an error

My full command:

tippecanoe -n "routing tileset" \
  -P -Z11 -z11 -D12 -d13 --no-feature-limit \
  -x OBJNAM -x FID -x water -x natural -x cc -x tile_x -x tile_y -x error \
  -o routing.mbtiles \
  -C 'cat' \
  --clip-bounding-box=-68.500000,44.583290,-66.500000,46.583290 \
  -Losmwt2:<(cat ./dist/osm/geojson/osm.water.geojsonseq;) 

So it seems like the filter raises 'Polygon begins with an inner ring' without changing that data

omrivolk avatar Apr 09 '19 09:04 omrivolk

Thanks for the report. Can you share your data file so I can try to reproduce the problem?

e-n-f avatar Apr 09 '19 16:04 e-n-f

https://www.dropbox.com/s/ufo6p6vmtta5kh9/osm.water.geojsonseq.zip?dl=0

It's an osmium export of some water polygons from: us-northeast-latest.osm.pbf

omrivolk avatar Apr 10 '19 09:04 omrivolk

Thanks! I'll take a look

e-n-f avatar Apr 10 '19 17:04 e-n-f

I've solved it for now by using a -c postfilter instead, for my use case it does what I want and does not raise an error.

omrivolk avatar Apr 16 '19 08:04 omrivolk

Great, I'm glad you were able to get it working!

e-n-f avatar Apr 16 '19 17:04 e-n-f

I'd still be interested to know if a fix could be applied so we can run the script on -C if possible

jliebrand avatar May 23 '19 07:05 jliebrand

I got the same error when using a prefilter. The error seems to occur on a polygon which is in parts a straight line and contains the same coordinate twice. However, the original input Polygon (JSON input for tippecanoe) is valid and has no straight lines. The malformed polygon seems to be created after converting MVT back to rings in json_writer.cpp. The MVT representation has been scaled to tile resolution before, which is probably the cause for malforming.

The error occurs for zoom 8 with the following command: tippecanoe -z 9 -Z 8 -S 10 ...

Increasing detail fixes the problem: tippecanoe -z 9 -Z 8 -S 10 -d 19 ...

Any ideas how prevent the prefilter from failing at low zoom levels?

Malformed Polygon as it should be written to stdin before the prefilter.

Bildschirmfoto 2020-10-03 um 18 55 41
{
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              12.683372,
              52.570299
            ],
            [
              12.683544,
              52.570925
            ],
            [
              12.683716,
              52.571238
            ],
            [
              12.683544,
              52.570925
            ],
            [
              12.683372,
              52.570403
            ],
            [
              12.683372,
              52.570299
            ]
          ]
        ]
      }

Original Polygon from JSON source:

Bildschirmfoto 2020-10-04 um 10 16 18
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              12.68339599,
              52.5702426
            ],
            [
              12.68343278,
              52.57022606
            ],
            [
              12.68349856,
              52.57039534
            ],
            [
              12.6836822,
              52.57086776
            ],
            [
              12.68382317,
              52.57113737
            ],
            [
              12.68415019,
              52.57176286
            ],
            [
              12.68419578,
              52.57186959
            ],
            [
              12.68426361,
              52.57202743
            ],
            [
              12.68421513,
              52.5719956
            ],
            [
              12.68410935,
              52.57177365
            ],
            [
              12.68363914,
              52.57087399
            ],
            [
              12.68339599,
              52.5702426
            ]
          ]
        ]
      }
    }

mkieselmann avatar Oct 03 '20 16:10 mkieselmann