digidem / mapeo-offline-map

Fallback offline map data and styles for Mapeo
1 stars 0 forks source link

feat: Add country & city labels #1

Open gmaclennan opened 4 years ago

gmaclennan commented 4 years ago

It would be useful to show labels for country names and major cities, in order to help users orient themselves with the map. This requires SDF files to be available to Mapbox-GL. For Mapeo offline maps we download SDF files from the Mapbox API. It would be preferable to statically generate our own SDF files from font .ttf files, using node-fontnik as part of the build process in this repo.

Currently mapeo-mobile loads this map style via an asset:// reference, which works for the style.json. We have not tested whether mapbox-gl Android SDK will also accept asset:// references for SDF files, if not we will need to serve these locally on mobile.

For country labels we can use Natural Earth Sovereign States and process them with polylabel to get label points (labelling country polygons with mapbox-gl requires shipping un-needed polygon data and also results in badly placed labels across tile boundaries).

For settlement (city) labels this repo already contains code to download them. They need to be styled according to settlement size / importance, with both font size and the zoom level they appear at.

gmaclennan commented 1 week ago

When we switch to styled-map-package, it will be easy to bundle fonts with the SMP.