在我正在构建的地图框应用程序中,我根据用户的地理位置将多个标记加载到页面上,但问题是我需要某些标记高于其他标记,但标记不zIndex符合我设置的标记.这是我的代码.
function addMarker(type, radius, height, lat, long, id, special, name) {
var circle_options;
switch (type) {
case marker.RESTRICTED:
circle_options = {
color: '#D90000',
fillColor: '#D90000', // Fill color
fillOpacity: 0.4, // Fill opacity
stroke: false,
zIndexOffSet: -1
};
break;
case marker.NOT_RECOMMENDED:
circle_options = {
color: '#FF8000',
fillColor: '#FF8000', // Fill color
fillOpacity: 0.75, // Fill opacity
stroke: false,
zIndexOffSet: 1000
};
break;
case marker.USER_RECOMMENDED:
circle_options = {
color: '#9FCC1C',
fillColor: '#9FCC1C', // Fill color
fillOpacity: 0.75, // Fill …Run Code Online (Sandbox Code Playgroud) 有没有办法在离线设置中使用Mapbox GL(询问JS和本机)?使用MBTiles,您可以使用MBTiles文件或提取光栅图像.我想知道是否有类似的东西允许Mapbox GL从本地源加载数据而不是需要与Mapbox服务器的Web连接.不是谈论只是在用户离线时缓存数据,而是实际制作一个始终完全脱机运行的地图.谢谢.
我希望能够使用android sdk在mapbox地图上手动绘制复杂的形状.我继承了地图视图类并重写了ondraw事件,但不幸的是,我绘制的任何内容都被地图本身绘制.
作为一个例子,我需要能够在其他复杂形状中绘制带有菱形边框的多边形.我可以使用自定义磁贴提供程序并覆盖ondraw在GoogleMaps中没有问题.
这是我到目前为止为mapbox唯一的代码:
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint stroke = new Paint();
stroke.setColor(Color.BLACK);
stroke.setStyle(Paint.Style.STROKE);
stroke.setStrokeWidth(5);
stroke.setAntiAlias(true);
canvas.drawLine(0f,0f,1440f,2464f,stroke);
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序使用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) 我正在使用Mabpox-gl-js v0.45对聚类进行POC.
我想自定义我的集群的属性(实际默认值是point_count和point_count_abbreviated).我的每个点(每个城市一个)都有一个表面属性(整数),我希望在点聚集时求和.
我在mapbox的源代码中看到了一个reduce函数的引用来计算自定义属性:
SuperCluster.prototype = {
options: {
minZoom: 0, // min zoom to generate clusters on
// .....
log: false, // whether to log timing info
// a reduce function for calculating custom cluster properties
reduce: null, // function (accumulated, props) { accumulated.sum += props.sum; }
// initial properties of a cluster (before running the reducer)
initial: function () { return {}; }, // function () { return {sum: 0}; },
// properties to use for …Run Code Online (Sandbox Code Playgroud) 有关如何使用D3在地理地图上绘制半径圆(以米为单位)的任何指针都非常有用.
我尝试使用Leaflet,它的Circle(或CircleMarker)接受以米为单位的半径,但我需要更灵活地使用我的数据.D3似乎非常有用,但我不确定如何在地图上绘制一个给定半径的圆,这样圆圈覆盖了与给定半径相对应的区域(并适应缩放和投影变化).
我正在寻找一种在iOS 7中实现自定义地图样式的方法,就像使用Google地图一样.我发现一些帖子说这对MapKit来说是不可能的,但是它们都被发布了一段时间.为了澄清,按照风格我说的是自定义颜色,最好也是字体.下面是自定义Google地图样式的示例.
http://www.servendesign.com/wp-content/uploads/2011/12/zaarley-custom-google-maps.jpg
出于性能原因,我更喜欢使用MapKit,但如果不支持我,我也愿意使用其他框架.我见过的是MapBox和Cloudmade,当然还有Google Maps SDK.
有没有办法用MapKit做到这一点?如果没有,最好的方法是什么?
有没有办法确定缩放级别,以便我的所有标记都适合缩放级别?我正在使用mapbox 0.4.0
我认为答案与此类似,但我找不到Android版本
[ https://www.mapbox.com/mapbox.js/example/v1.0.0/markers-only-at-zoom-level/]
让我们说我在地图集地图上绘制一个形状,并在绘图:crated事件上执行此操作:
e.layer.properties = {};
e.layer.properties.myId = 'This is myId';
Run Code Online (Sandbox Code Playgroud)
如果我这样做featureGroup.toGeoJSON(),geojson功能有一个空的属性对象.有没有什么方法我配置一个传单层,以便当它转换为geoJson时,它将设置某些属性?
使用以下代码将各种行添加到表示路径的地图中:
private LineLayer makeLineLayer(List<GeoPoint> routePoints, String title) {
String sourceTitle = "line-layer-" + lineCount;
List<Position> points = new ArrayList<>(routePoints.size());
List<Feature> routes = new ArrayList<>(routePoints.size());
for (GeoPoint point : routePoints) {
points.add(Position.fromCoordinates(point.getLongitude(), point.getLatitude()));
}
LineString route = LineString.fromCoordinates(points);
Feature routeFeature = Feature.fromGeometry(route);
routeFeature.addStringProperty("custom-line", "0");
routes.add(routeFeature);
GeoJsonSource linesSource = new GeoJsonSource(
sourceTitle,
FeatureCollection.fromFeatures(routes));
mapboxMap.addSource(linesSource);
LineLayer lineLayer = new LineLayer(title, sourceTitle);
lineLayer.setProperties(
//Sets properties...
);
return lineLayer;
}
LineLayer lineLayer = makeLineLayer(getRoutePoints());
mapboxMap.addLayer(lineLayer);
Run Code Online (Sandbox Code Playgroud)
我希望能够确定何时单击其中一行.目前,MapBox调用OnMapClick并传入一个LatLng对象.然后,我可以custom-line使用以下内容查询属性的渲染功能:
PointF pixel = …Run Code Online (Sandbox Code Playgroud) mapbox ×10
android ×3
javascript ×3
ios ×2
leaflet ×2
mapbox-gl ×2
canvas ×1
cloudmade ×1
d3.js ×1
geolocation ×1
google-maps ×1
java ×1
mapbox-gl-js ×1
mapkit ×1
markers ×1
swift ×1