Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: maplibre 兼容 pmtiles #2666

Merged
merged 29 commits into from
Feb 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/maps/src/maplibre/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { mat4, vec3 } from 'gl-matrix';
import type { Map } from 'maplibre-gl';
import maplibregl from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
import { Protocol } from 'pmtiles';
import Viewport from '../lib/web-mercator-viewport';
import { MapType, type IMapboxInstance } from '../types';
import BaseMapService from '../utils/BaseMapService';
Expand Down Expand Up @@ -112,6 +113,11 @@ export default class Service extends BaseMapService<Map & IMapboxInstance> {
this.$mapContainer = this.map.getContainer();
} else {
this.$mapContainer = this.creatMapContainer(id);

if (typeof style !== 'string') {
XinyueDu marked this conversation as resolved.
Show resolved Hide resolved
const protocol = new Protocol();
maplibregl.addProtocol('pmtiles', protocol.tile);
}
// @ts-ignore
this.map = new window.maplibregl.Map({
container: this.$mapContainer,
Expand Down
Loading