我正在使用传单绘制控件获取某些区域的几何图形。这些几何图形是多边形、线串、矩形和圆形,我将它们放入数据库中。我想获得从中心点到这些几何图形边缘的距离。
我正在使用https://github.com/mapbox/leaflet-omnivore以这种方式解析几何:
var layer = omnivore.wkt.parse(geometry);
var center = layer.getBounds().getCenter();
Run Code Online (Sandbox Code Playgroud)
我不知道如何获得从中心到边缘的距离。是否可以?
如果已经回答,请提前道歉。我在网上或存储库中找不到任何指向我的问题的内容。
我有一个ArrayList<Position>固定我的线刺。
绘制时此显示很好 addPolyline
我想设置线条的样式,所以我切换到使用线条图层。然而。
这条线不再出现在靠近正确位置的任何地方。该地点位于英格兰坎布里亚郡,但取材于索马里海岸。
我试图在每次转换后输出坐标,它们都显示正常。我不知道如何检查source
Log.d("Tracing 1", route.toString())
val lineString = LineString.fromCoordinates(route)
Log.d("Tracing 2", lineString.coordinates.toString())
val feature = Feature.fromGeometry(lineString)
Log.d("Tracing 3", feature.geometry.coordinates.toString())
val featureCollection = FeatureCollection.fromFeatures(
arrayOf(feature))
val geoJsonSource: Source = GeoJsonSource("line-source", featureCollection)
mapboxMap.addSource(geoJsonSource)
val debugSource = mapboxMap.getSource("line-source") as GeoJsonSource
Log.d("Tracing 4", debugSource.toString())
val lineLayer = LineLayer("linelayer", "line-source")
lineLayer.setProperties(
PropertyFactory.lineDasharray(arrayOf(0.01f, 2f)),
PropertyFactory.lineCap(LINE_CAP_ROUND),
PropertyFactory.lineJoin(LINE_JOIN_ROUND),
PropertyFactory.lineWidth(5f),
PropertyFactory.lineColor(Color.parseColor("#e55e5e"))
)
mapboxMap.addLayer(lineLayer)
val cameraPosition = CameraPosition.Builder()
.target(LatLng(route[0].latitude, route[0].longitude))
.build()
mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
Run Code Online (Sandbox Code Playgroud)
显示Logs 全部相同的日志 cat 输出在这里。
10-05 20:52:37.162 11449-11449/com.xxx.xxx D/Tracing …Run Code Online (Sandbox Code Playgroud) 我无法理解如何使用新的mapbox表达式.例如,如果我需要这样的东西:
如果prop'store'大于0且小于500,则将circle-radius设置为10
如果prop'store'大于500,则将circle-radius设置为20
我怎么能用表达式做呢?谢谢
我正在使用基于外部文件绘制邮政编码轮廓的mapbox,geojson如下所示:
import { Component, OnInit } from '@angular/core';
import * as mapboxgl from 'mapbox-gl';
@Component({
selector: 'app-mapbox',
templateUrl: './mapbox.component.html',
styleUrls: ['./mapbox.component.css']
})
export class MapboxComponent implements OnInit {
ngOnInit() {
mapboxgl.accessToken = 'api-key';
let map = new mapboxgl.Map({
container: 'map',
style: 'styles',
zoom: 5,
center: [-80.118, 25.897]
});
map.addControl(new mapboxgl.NavigationControl());
map.on('load', function () {
map.addSource("route", {
"type": "geojson",
"data": "./assets/shapeGeoJson.json"
});
map.addLayer({
"id": "route",
"type": "line",
"source": "route",
"paint": {
'line-color': "gray"
}
});
});
} …Run Code Online (Sandbox Code Playgroud) 我的问题是,如何从MapBox服务获取指定路线的高程剖面图。
在输入中,我们将路径/路线作为坐标数组(纬度,经度)。结果,我们希望得到坐标对对的数组-高程。
如果高程数据的分辨率高于提供的路线坐标,则结果还应包含原始坐标之间的高程数据。路线上的新点将根据高程数据分辨率生成。如果高程数据的分辨率较低,则应从已知数据中为查询点内插高程值。我们希望获得尽可能精确的结果。
作为我们解决方案的数据源,我们想使用MapBox服务。但是,对于该特定问题,我们没有找到任何记录的MapBox API。我们仅找到了一些不再支持的Surface API的引用。
据我们了解,Mapbox现在以Terrain-RGB地图图块的格式存储高程数据。我们确定了以下步骤可以使用MapBox解决我们的问题:
这个算法正确吗?我认为,针对特定路线生成高程剖面图是一个常见问题,是否有任何工具可以开箱即用地解决我们的问题,也许有一些SDK?我们错过了什么吗?非常感谢。
我是在 iOS 上使用 MapBox 的新手,想知道是否有人有将自定义地图标记放在 iOS MapBox 地图上的经验。
我试过查看他们的文档,但他们只展示了如何使用 CSS 添加 HTML 标记,我不确定如何在 Swift 中实现。( https://docs.mapbox.com/help/tutorials/custom-markers-gl-js/#add-markers-to-the-map )
将我指向正确方向的任何帮助将不胜感激!
我正在尝试为 GeoJSON 中的点分配一个图标。我使用这个片段:
map.addSource('Punti di allerta', {
type: 'geojson',
data: source_attentionpoints,
});
map.addLayer({
'id': 'Punti di allerta',
'type': 'circle',
'source': 'Punti di allerta',
'layout': {
'icon-image': '{% static 'image/webgis/icons/warning50.png' %}',
'icon-size': 0.5
}
});
Run Code Online (Sandbox Code Playgroud)
我看到这两个错误并且点没有呈现:
错误:“layers.Punti di allerta.layout.icon-image:未知属性“icon-image””错误:“layers.Punti di allerta.layout.icon-size:未知属性“icon-size””
但如果我使用这个片段而不是之前的片段,我可以毫无问题地看到所有点:
map.addLayer({
'id': 'Punti di allerta',
'type': 'circle',
'source': 'Punti di allerta',
'paint': {
'circle-radius': 8,
'circle-color': 'rgb(0,0,0)',
'circle-opacity': 1.0,
'circle-stroke-width': 4,
'circle-stroke-color': 'rgb(200,200,200)',
'circle-stroke-opacity': 1.0,
'circle-blur': 0,
}
});
Run Code Online (Sandbox Code Playgroud)
我有什么错吗?
这是我的代码
var map = L.mapbox.map('map', 'examples.map-20v6611k').setView([37.9, -77],4);
var marker = L.marker(new L.LatLng(37.9, -77), {
icon: L.mapbox.marker.icon({'marker-color': 'CC0033'}),
draggable: true
});
marker.bindPopup('This marker is draggable! Move it around.');
marker.addTo(map);
//my code
marker.on('mousedown', function(e){
location = marker.getLatLng();
document.getElementById('locationBox').innerHTML = "poop";
});
Run Code Online (Sandbox Code Playgroud)
地图上的标记可以拖动到任何地方.我正在尝试在标记被拖动到某处之后获取标记的经度和纬度,这就是为什么我使用marker.on('mousedown',function(e){事件处理程序.我有两个问题.我我试图嵌套另一个事件处理程序
marker.on('mouseup', function(e){
Run Code Online (Sandbox Code Playgroud)
在内部,所以一旦标记被拖走就抓住了位置但是'mouseup'方法不起作用.
第二个问题
location = marker.getLatLng();
Run Code Online (Sandbox Code Playgroud)
不存储lat/lon的位置,而只是打开我尚未配置的新URL.
如何在拖动然后删除标记之后使用Javascript或Jquery来获取标记的位置,以及如何将lat/lon适当地存储在变量中?
谢谢!
当前的 MapBox 归属徽标显然是制作的,因此它可以在浅色和深色背景上显示:
然而,从平面设计的角度来看,这种通用显示器的代价是看起来不专业。
有没有办法用无影版本替换它,或者完全替换它以支持回到常规文本版本?