mapbox / geojson-vt

Slice GeoJSON into vector tiles on the fly in the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange Clipping issue.

ibrierley opened this issue · comments

commented

This may be related to the other clipping issue, not sure. I note if I bypass clipping it works ok.
Example geojson..

{
    "type": "Feature",
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
              [-178, 10],[20, 85],[178, -5]
            ]
        ]
    },
    "style": {
        "stroke-width": "3",
        "fill-opacity": 0.6
    },
    "className": {
        "baseVal": "highway_primary"
    }
}

In the demo page, it produces for the top layer, which is ok...
mapbox github io_geojson-vt_debug_

But then if you click on the top right quadrant of the demo page, it gives..

mapbox github io_geojson-vt_debug_ (1)

And also seems to add lines on tile boundaries (I can't highlight that on the demo page, as it has tile lines there, but as an example from mine..
localhost_35709_

This is the same on this version in Git, and the hosted demo page. (I've also eliminated wrap and simplify to test further)

Can you try it with the line string closed (last point the same as the first one), as required by the GeoJSON spec for polygons?

commented

ok thanks, that kinda makes sense, but there are still odd tile edge lines...(which aren't there if I comment out the clip code. This is the closed triangle.
localhost_44347_

{
    "type": "Feature",
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
              [-178, 10],[20, 85],[178, -5],[-178, 10]
            ]
        ]
    },
    "style": {
        "stroke-width": "3",
        "fill-opacity": 0.6
    },
    "className": {
        "baseVal": "highway_primary"
    }
}
commented

Just to clarify, thats zoomed into zoom 2 (and thats a screenshot from my version, I think the demo obscures those, as the demo draws borders alongside tile edges anyway.

commented

Actually, is this just a question of whether it's a filled polygon (as you'd use a linestring for an unfilled one) as geojson probably doesn't declare about that? I suspect it's fine isn't it!

commented

Thanks for the help, the original non-closing of the polygon threw my brain about the problem :).