Reading Vector Tiles HERON

Hi @Brian_Washburn

I am having an issue with the import vector componet. When importing a .pbf file based on the EPSG:4326 coordinate system every thing goes wel. When I want to import a file based on the EPSG:28992 coordinate system an error occures.

  1. Solution exception:TopologyException: Input geom 0 is invalid: Self-intersection at or near point 29627.033705196714 -31035.822140914668 at 29627.033705196714 -31035.822140914668

HERON.7z (356.1 KB)

Hi @Erik_Beeren,
I don’t think it’s a problem with the coordinate system, it’s the fact that some of the polygons are self-intersecting. This can happen when you vectorize a raster, which it appears the source has done.

QGIS screenshot

When geometry is invalid like this, the GDAL/OGR libraries Heron relies on can’t read it. A common way to fix this particular issue is to do a Buffer with zero offset (or zero buffer) in QGIS (Processing > Processing Toolbox > Vector Geometry > Buffer using 0 as the buffer distance). The annoying part is you can only do this one layer at a time, so, given the multiple layers in the PBF, you would need to execute the QGIS Buffer as a batch process.

There is a way with Heron’s Ogr2Ogr component to automate it a bit, but it’s a bit of a hack. First, extract the layers of the PBF into individual shapefiles. These shapefiles will still have the self-intersecting geometries. Then, perform the zero buffer processing on each shapefile with the Ogr2Ogr component, saving the results to a folder which can then be used as input for the ImportVector component. Make sure to create the destination folders prior to these steps. (38.5 KB)

1 Like