onthegomap / planetiler

Flexible tool to build planet-scale vector tilesets from OpenStreetMap data fast
Apache License 2.0
1.21k stars 101 forks source link

[FEATURE] Speed-up Planetiler by skipping OSM reads when generating only layers which do not need OSM data #823

Closed phanecak-maptiler closed 4 months ago

phanecak-maptiler commented 4 months ago

Is your feature request related to a problem? Please describe.

When I'm working on just one layer, say water (using custom Profile and the layer using only Natural Earth), I'm running Planetiler like this:

java ... --only-layers=water ...

And the problem is, that for this particular layer only data from water_polygons, the rest is skipped, except OSM, which gets read anyway.

Describe the solution you'd like

If I'm generating only layers which do not work with OSM data, reading of OSM data should be skipped.

Describe alternatives you've considered

Using some small dummy OSM source data via --osm_path=...., say "monaco.osb.pbf" even if generating whole "planet".

Additional context

Custom Profile employed, which has water layer using only Natural Earth.

msbarry commented 4 months ago

I think this is already happening, when you filter layers the planetiler-openmaptiles profile decides which sources are needed based on the interfaces that the remaining layers implement:

public class Water implements
  OpenMapTilesSchema.Water,
  Tables.OsmWaterPolygon.Handler,
  OpenMapTilesProfile.NaturalEarthProcessor,
  OpenMapTilesProfile.OsmWaterPolygonProcessor,
  ForwardingProfile.FeaturePostProcessor {

If you remove Tables.OsmWaterPolygon.Handler then it should skip reading osm when you do --only-layers=wayer?

msbarry commented 4 months ago

Oh sorry actually you're right, it does that for the other sources, but not osm.