maptalks / maptalks.mapboxgl Goto Github PK
View Code? Open in Web Editor NEWMapboxglLayer for maptalks.js
License: MIT License
MapboxglLayer for maptalks.js
License: MIT License
looks like a new problem from mapbox-gl-js v0.44
I'm trying to import the MapboxGL plugin the following way:
import * as MapTalks from 'maptalks/dist/maptalks';
import 'maptalks/dist/maptalks.css';
import { MapboxglLayer } from 'maptalks.mapboxgl';
Getting the following error message:
./node_modules/maptalks.mapboxgl/dist/maptalks.mapboxgl.es.js Module not found: Error: Can't resolve 'mapboxgl' in '/home/xxx/xxx/xxx/app/node_modules/maptalks.mapboxgl/dist'
Any ideas why that is not working?
mapbox 's event is not fire
Uncaught TypeError: this._renderer.onAdd is not a function
at MapboxglLayer.o._initRenderer (maptalks.min.js:6)
at MapboxglLayer.o.load (maptalks.min.js:6)
at l._loadAllLayers (maptalks.min.js:6)
at l._Load (maptalks.min.js:6)
at new l (maptalks.min.js:6)
at (index):35
mapbox does not come up
thanks for your work
After the geojson data is converted to geometry, how do I add click events to the geometry set? When do I want to display some information about the geometry in the geojson data when the click changes。thank you very much indeed
Zooming does not work properly on devices with DPI > 100%. It zooms in at the position where I scroll or pinch with 2 fingers, but after finishing the zoom interaction, the map snaps to another point. As this points is mostly about half the distance from the top and left, I guess that some mouse/finger coordinates are not multiplied with window.devicePixelRatio
somewhere.
现有mapbox地图已经创建(存在),maptalks如何加载现有的mapboxgl,而不是重新创建?
const map = new mapboxgl.Map({
container: containerMap,
center: [0,0],
zoom: 1,
bearing: 1,
pitch: 1,
interactive: true,
antialias: true,
doubleClickZoom: false
});
map已经创建,
如何用 maptalks去加载 现有的mapboxgl ,而不是重新创建?
设置4326投影地图调用mapboxgl图层会出现异常,另,还有没有别的方式调用矢量切片
mapboxglLayer.getGlMap().on('click', ev => {
console.log(ev)
})
此时点击事件不会被触发
执行
npm install maptalks.mapboxgl.
出错
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/maptalks.mapboxgl. - Not found
npm ERR! 404
npm ERR! 404 'maptalks.mapboxgl.@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
在拖动过程中,mapbox 底图会明显滞后于maptalks图层。使用同样的方法集成3D高德和百度地图,也是一样的滞后感。原因可能是mapbox的jumpTo是异步的。
问题:有没有更好的方式集成3D底图,比如mapbox和高德地图?
使用MapboxglLayer,给地图实例设置cssFilter不起作用,如何设置
cssFilter baseLayer : new MapboxglLayer('mapboxgl',{
glOptions : {
'style' : 'mapbox://styles/mapbox/satellite-v9',
},
cssFilter: 'filter: invert(0) sepia(0) saturate(1.25) hue-rotate(0deg) brightness(1.15) contrast(1.35) grayscale(0.5)'
})
Failed to compile.
./node_modules/_maptalks.mapboxgl@[email protected]/dist/maptalks.mapboxgl.es.js
Module not found: Can't resolve 'mapbox-gl' in 'D:\w-code\neweconomy\nc\node_modules_maptalks.mapbo
xgl@[email protected]\dist'
I'm trying to update the style of my base layer, these two methods work but they add a new layer instead of updating the existing one:
map.setBaseLayer(new MapboxglLayer('map', {
glOptions: {
style: selectedStyleUrl,
}
}));
const baseLayer = map.getBaseLayer();
baseLayer.config({
glOptions: {
style: selectedStyleUrl,
}
});
baseLayer.load();
So I always end up with a lot of layers, which is not desirable for performance reasons. Any ideas how I can fix that?
I can go into the DOM manually and remove the layer but that doesn't seem to be the best solution. baseLayer.remove()
doesn't seem to fix this.
创建一个地图,style自行替换
var map = new maptalks.Map('map', {
center: [114, 31],
zoom: 10,
baseLayer: new maptalks.MapboxglLayer('tile', {
glOptions: {
'style': 'http://ip/styles/style.json'
}
})
});
var layer = new maptalks.VectorLayer('vector', {forceRenderOnMoving: true}).addTo(map);
再加入一段线,线务必多于三个点
var start = [114, 31],
middle1 = [114, 31.05],
middle2 = [114.05, 31.05],
end = [114.05, 31.08];
var coords = [start, middle1, middle2, end]
var arrow = new maptalks.LineString(
coords,
{
'id': 'arrow',
'arrowStyle': 'classic',
'arrowPlacement': 'vertex-last'
}
) .addTo(layer);
然后倾斜地图45度角或其他倾斜角度,再旋转地图即可见效果
引入的相关库如下:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.