Skip to content

Commit

Permalink
Make tippecanoe maximum_tile_bytes configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Feb 14, 2024
1 parent 2b2a11a commit a208ea1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fetcher/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def routes(routes_geojson)
}
end

def tippecanoe(pois_layers, features_json, features_layer, mbtiles, attributions)
def tippecanoe(pois_layers, features_json, features_layer, mbtiles, attributions, maximum_tile_bytes)
attributions = attributions.collect{ |attribution| attribution.gsub('©', '©') }
system(
'tippecanoe --force ' +
Expand All @@ -252,6 +252,7 @@ def tippecanoe(pois_layers, features_json, features_layer, mbtiles, attributions
--coalesce-smallest-as-needed \
--drop-smallest-as-needed \
--coalesce-fraction-as-needed \
--maximum-tile-bytes=#{maximum_tile_bytes | 500_000} \
--attribution='#{attributions.join(' ')}' \
-o #{mbtiles}
"
Expand All @@ -268,6 +269,7 @@ def build(source_id, source, config_path)
polygon = "#{config_path}#{source_id}.geojson"
settings = setting("#{data_api_url}/settings.json", polygon)
attributions = settings['attributions'] || []
maximum_tile_bytes = settings['maximum_tile_bytes']

mbtiles = config_path + source['sources']['partial']['mbtiles']

Expand Down Expand Up @@ -304,7 +306,7 @@ def build(source_id, source, config_path)
features: features_data
}))

tippecanoe(pois_layers, features_json, 'features', mbtiles, attributions)
tippecanoe(pois_layers, features_json, 'features', mbtiles, attributions, maximum_tile_bytes)
end


Expand Down

0 comments on commit a208ea1

Please sign in to comment.