mirror of
https://github.com/maputnik/editor.git
synced 2026-06-09 08:47:26 +00:00
Add PMTiles support (#938)
Add support for pmtiles sources. Solves #807 <strike> There is still an error, probably when adding the source to the Maputnik sources: ``` Failed to process sources for 'pmtiles://https://example.com/data/switzerland.pmtiles' TypeError: NetworkError when attempting to fetch resource. fetchSources App.tsx:642 ``` @bdon How did you solve this for https://editor.protomaps.com/ ? </strike> --------- Co-authored-by: Brandon Liu <bdon@bdon.org> Co-authored-by: WebFreak001 <gh@webfreak.org> Co-authored-by: ShellyDCMS <60476837+ShellyDCMS@users.noreply.github.com> Co-authored-by: Harel M <harel.mazor@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import MaplibreGeocoder, { MaplibreGeocoderApi, MaplibreGeocoderApiConfig } from
|
||||
import '@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css';
|
||||
import { withTranslation, WithTranslation } from 'react-i18next'
|
||||
import i18next from 'i18next'
|
||||
import { Protocol } from "pmtiles";
|
||||
|
||||
function renderPopup(popup: JSX.Element, mountNode: ReactDOM.Container): HTMLElement {
|
||||
ReactDOM.render(popup, mountNode);
|
||||
@@ -148,6 +149,8 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
|
||||
localIdeographFontFamily: false
|
||||
} satisfies MapOptions;
|
||||
|
||||
const protocol = new Protocol({metadata: true});
|
||||
MapLibreGl.addProtocol("pmtiles",protocol.tile);
|
||||
const map = new MapLibreGl.Map(mapOpts);
|
||||
|
||||
const mapViewChange = () => {
|
||||
|
||||
Reference in New Issue
Block a user