2

Following Paul Ramsey's article about ST_Subdivide I was able to split the Natural Earth boundaries dataset. Generating tiles which intersect the boundaries of Canada and Russia on the fly is now significantly improved.

How would I go about styling these tiles in OpenLayers?

enter image description here

We tried to ST_Union the MVT geometries but this process requires validation due to self intersections. The union geometries then must be dumped since geometry collections are not valid for MVT geometries. Even with all the steps in place there are still kinks due to PostGIS not always adhering to the winding order of geometries.

Ideally I would like to remove boundaries between features with the same ID inside the MVT as generated by the ST_MVT method.

Any pointer whether this is possible?

I am aware that mapbox-gl provides recipes to union features from MVT tiles based on an attribute but look for a way to achieve similar with ol/layer/VectorTile

2
  • 1
    Could you not keep two tables on sub_divided and the other for display?
    – Ian Turton
    Commented Sep 25, 2020 at 8:35
  • The sub dividied geometries are meant for the display. A top level tile intersecting Canada takes about 12 seconds to be processed with ST_asMVT(ST_AsMVTGeom()). This process takes less than a second on the sub divided geometries. Commented Sep 25, 2020 at 9:39

1 Answer 1

2

Create separate datasets for the countries and for the borders. (They can be subdivided independently.) Then you can simply fill the land polygons without a border.

You might want to style coastlines and borders on land differently; Natural Earth alreay has those datasets.

1
  • This approach would make selection and highlight of the polygon features difficult. Commented Sep 28, 2020 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.