我的应用程序使用Geojson
文件.我使用MapBox SDK添加MGLPolyline
到地图.但问题是我的文件太大,以至于应用程序崩溃并收到错误:Message from debugger: Terminated due to memory issue
.我在第一次循环时面对66234个对象.我试图将数组块化为新数组,但没有成功.请帮我解决问题.这是我在地图上绘制的代码,这里是我在github上的测试项目使用Xcode 8.1 如果有任何不同的第三方可以解决我的问题,也欢迎:
func drawPolyline() {
// Parsing GeoJSON can be CPU intensive, do it on a background thread
DispatchQueue.global(qos: .background).async {
// Get the path for example.geojson in the app's bundle
let jsonPath = Bundle.main.path(forResource: "KMLMAPNew", ofType: "json")
let jsonData = NSData(contentsOfFile: jsonPath!)
do {
// Load and serialize the GeoJSON into a dictionary filled with properly-typed objects
guard …
Run Code Online (Sandbox Code Playgroud) 工作mapboxgl与ionic3,angular4和科尔多瓦.
我已经构建了.apk和.ipa文件.我在我的Android设备上安装了.apk文件,它按预期工作(ie mapbox tiles, my icons (I have added some icons to custom some functionalities for eg. added an icon to switch the map style) and my markers are loaded successfully)
.
当我在我的Iphone中安装.ipa文件时,我的图标只加载但mapbox图块没有加载.也是标记.我得到空白的白色屏幕.
我的实施有什么问题?
let data = {myJson data};
mapboxgl.accessToken = 'My access token';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v9',
attributionControl: false,
center: [-74.50, 40],
zoom: 12
});
map.on('load', function () {
map.addSource("place", {
type: "geojson",
data: data,
cluster: true,
clusterMaxZoom: 14, …
Run Code Online (Sandbox Code Playgroud) 我在尝试显示放置在完全相同的坐标处的 2 个不同标记时遇到了一些麻烦。
情况是:我们正在展示商店,其中一些商店位于同一栋建筑(即购物中心),因此,它们是不同的商店,但共享相同的公共/坐标。
我们的 json 源内容如下所示:
{
"properties" : {
"id" : "1",
"name" : "Store 1"
},
"geometry" : {
"coordinates" : [-70.66667, -33.45],
"type" : "Point"
}
},
{
"properties" : {
"id" : "2",
"name" : "Store 2"
},
"geometry" : {
"coordinates" : [-70.66667, -33.45],
"type" : "Point"
}
}
Run Code Online (Sandbox Code Playgroud)
问题是,只有其中一个被显示。
我的问题是,对于这个用例是否有开箱即用的解决方案?或者我们应该实施我们自己的解决方案?
提前致谢!
我开始失去理智。
根据Mapbox API,我应该能够更改默认标记颜色,但我在文档中没有找到任何不使用自定义标记的示例,并且最有可能的语法不起作用。
我在用 mapbox-gl-js/v0.44.2
var marker = new mapboxgl.Marker({ "color": "#b40219" })
.setLngLat([0, 0])
.addTo(map);
Run Code Online (Sandbox Code Playgroud)
使用此代码,地图显示时没有标记,如果我删除颜色选项,标记会正确显示,但颜色错误。
对我搞砸的地方有什么建议吗?
我正在使用mapbox supercluster制作聚簇地图。我面临的问题是群集不在正确的位置。例如,我只养狗,the netherlands
但缩小时它们在法国。
当我进一步放大时,星团缓慢地移动到荷兰。当我滚动时,簇在地图上移动。
在我的网站https://v2.sayhi.dog/?dog-map=true上可以看到问题。
我的代码如下所示(我使用vue.js):
<template>
<div class="w-full h-full" id="map"></div>
</template>
<script>
import mapboxgl from 'mapbox-gl'
import Supercluster from 'supercluster';
export default {
props: ['locations'],
data() {
return {
map: null,
copyLocations: this.locations,
clusters: [],
markers: [],
clustersGeojson: {},
clusterIndex: null,
}
},
mounted() {
mapboxgl.accessToken = 'my-token';
// init the map
this.map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/sayhi/cjkp9e59x3m3y2rm1zbcc0c',
zoom: 2,
});
this.addControls();
this.map.on("load", () => { this.addMarkers() });
this.map.addControl(new …
Run Code Online (Sandbox Code Playgroud) hierarchical-clustering mapbox vue.js mapbox-gl mapbox-marker
我正在使用Mapbox-gl.js (v0.38.0) 和Maki图标、Ionic3 和 angular4。我不想使用mapbox.js。我已经完成了我想要的操作,但默认情况下图标颜色为“棕色”。但我希望它的颜色为“绿色”。
我尝试了与mapbox-gl 示例类似的以下链接,
如何自定义颜色和其他图标属性
我正在尝试在 MapBox GL JS 中聚集自定义标记,但我不知道如何将自定义标记图像从 url 获取到符号层?它要么不起作用,要么根本不显示任何标记。它是如何完成的?我需要知道如何使用带有符号层的 url 中的自定义图像。非常感谢。
map.addSource('parcelpoints', {
type: 'geojson',
data: geojson,
cluster: true,
clusterMaxZoom: 14, // Max zoom to cluster points on
clusterRadius: 50 // Radius of each cluster when clustering points (defaults to 50)
});
map.addLayer({
id: 'clusters',
type: 'circle',
source: 'parcelpoints',
filter: ['has', 'point_count'],
paint: {
// Use step expressions (https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-step)
// with three steps to implement three types of circles:
// * Blue, 20px circles when point count is less than 100
// …
Run Code Online (Sandbox Code Playgroud) 我正在使用 Mapbox 制作地图,并且访问令牌是公开的,访问该网站的人们可以轻松复制。有没有办法隐藏此访问令牌或限制仅访问我的网站?似乎其他人正在使用我的访问代码来执行 Python 地理编码请求。
\n\n<!DOCTYPE html>\n<html>\n<head>\n <title>Quick Start - Leaflet</title>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0"> \n <link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />\n <link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin=""/>\n <script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js" integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw==" crossorigin=""></script>\n</head>\n<body>\n<div id="mapid" style="width: 600px; height: 400px;"></div>\n<script>\n\n var mymap = L.map(\'mapid\').setView([51.505, -0.09], 13);\n\n L.tileLayer(\'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw\', {\n maxZoom: 18,\n attribution: \'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, \' +\n \'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, \' +\n \'Imagery \xc2\xa9 <a href="https://www.mapbox.com/">Mapbox</a>\',\n id: \'mapbox.streets\'\n }).addTo(mymap);\n\n L.marker([40.7127837, -74.0059413]).addTo(mymap)\n .bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();\n\n var popup …
Run Code Online (Sandbox Code Playgroud) 我正在使用mapBoxGL 1.0版JS库,并且正在使用集群地图功能。但是我注意到,在某些缩放级别上,图层中的某些符号会消失,然后在其他缩放级别上会再次出现。我似乎无法弄清楚配置有什么问题。我附上了图像,注意到群集的总大小也与总符号不对应。
map.addSource("dayplaces", {
type: "geojson",
// Point to GeoJSON data. This example visualizes all M1.0+ earthquakes
// from 12/22/15 to 1/21/16 as logged by USGS' Earthquake hazards program.
data: geojson,
cluster: true,
clusterMaxZoom: 12, // Max zoom to cluster points on
clusterRadius: 50 // Radius of each cluster when clustering points (defaults to 50)
});
map.addLayer({
id: "clusters",
type: "circle",
source: "dayplaces",
filter: ["has", "point_count"],
paint: {
// Use step expressions (https://docs.mapbox.com/mapbox-gl-js/style-spec/#expressions-step)
// with three steps to implement three …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,其中我必须根据用户导航旋转箭头。
我正在使用最新的 Mapbox SDK。
我尝试过设置障碍(使用纬度和经度计算)但未能成功。
我不知道如何实现它。
它(箭头标记)应该在预定义的多边形路径上导航。
mapbox-marker ×10
mapbox ×8
mapbox-gl-js ×6
mapbox-gl ×5
ios ×2
android ×1
java ×1
swift ×1
vue.js ×1