- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Display a map</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
mapboxgl.accessToken = 'pk.eyJ1Ijoic2x5IiwiYSI6IjdiYzFmZmY5NTExOTQ0MTExMGVhZDBkZTIwMmRlYjJhIn0.hOz2brurCBMGWGU5EI-waQ';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
center: [-3.69964599609375, 40.417874374140474], // starting position [lng, lat]
zoom: 13 // starting zoom
});
map.on('load', function () {
map.addLayer({
'id': 'population',
'type': 'circle',
'source': {
"type": "vector",
"tiles": ["http://localhost:4000/windwalker_test/tiles/test_table/{z}/{x}/{y}.pbf"]
},
'source-layer': 'defaultLayer',
'paint': {
'circle-color': 'red'
}
});
});
</script>
</body>
</html>
我在 http://localhost:4000 上托管一个 node-mapnik 服务器有点数据。来自服务器的样本向量 pbf 是:https://www.dropbox.com/s/m3f5pnt5rjcfxxw/test_table_13_4011_3088.pbf?dl=0
Mapnik 将其渲染为栅格是这样的:https://i.imgur.com/JDH0lQV.png
使用 https://github.com/mapbox/vector-tile-js 读取 protobuf 文件我得到以下信息:
VectorTile {
layers: {
defaultLayer: VectorTileLayer {
version: 2,
name: 'defaultLayer',
extent: 4096,
length: 5,
_pbf: {
buf: < Buffer 1 a cc 03 78 02 0 a 0 c 64 65 66 61 75 6 c 74 4 c 61 79 65 72 28 80 20 1 a 07 61 64 64 72 65 73 73 22 2 a 0 a 28 43 61 6 c 6 c 65 20 64 65 20 50 c3 a9 72 65 7 a... > ,
pos: 463,
type: 2,
length: 463
},
_keys: ['address', 'cartodb_id', 'name'],
_values: ['Calle de Pérez Galdós 9, Madrid, Spain',
1,
'Hawai',
'Calle de la Palma 72, Madrid, Spain',
2,
'El Estocolmo',
'Plaza Conde de Toreno 2, Madrid, Spain',
3,
'El Rey del Tallarín',
'Manuel Fernández y González 8, Madrid, Spain',
4,
'El Lacón',
'Calle Divino Pastor 12, Madrid, Spain',
5,
'El Pico'
],
_features: [107, 187, 278, 366, 443]
}
}
}
哪些信息似乎是正确的。然而,当我查看这些点所在的 map 时,我看不到它们。我错过了什么?
我试过 type: line
和 type: fill
并使用 line-color
和 fill-color
。我也玩过 circle-radius
但运气不好
如果您更改扩展名,mapnik 服务器将生成 png 或 pbf,因此我已经确认在使用 type:raster 并指定 png 时它可以正确呈现栅格,因此一定有我做错的地方
最佳答案
找出答案,结果是我在从节点获取输出之前动态设置了层 ID。
请求关闭此 SO,因为它在未来无法帮助任何人
关于dictionary - 无法在 mapbox GL 上渲染矢量点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55643908/
我正在用 Python (2.6) 编写一个应用程序,需要我使用字典作为数据存储。 我很好奇拥有一个大字典是否更节省内存,或者将其分解为许多(很多)较小的字典,然后拥有一个包含对所有较小字典的引用的“
Convert this [ "Cat" : ["A" : 1, "B": 2], "Mat" : ["C" : 3, "D": 4] ] Into [ "A" : 1,
有什么很酷的快速方法可以让两个字典创建第三个字典,以内连接方式将第一个字典的键映射到第二个字典的值? Dictionary dic1 = new Dictionary {{a1,b1},{a2,b2}
我希望将字典相互嵌套,以便容纳 block 的 xy 坐标。所以我会 IDictionary, IDictionary> 键 Dictionary 包含列、行组合,而值 Dictionary 包含 x
在 C# 中,我需要将数据保存在字典对象中,如下所示: Dictionary> MyDict = new Dictionary>(); 现在我意识到,在某些情况下我需要一些其他(不是字典类的)
第一个Dictionary就像 Dictionary ParentDict = new Dictionary(); ParentDict.Add("A_1", "1")
我似乎无法理解这个问题。我需要使用 LINQ 按内部字典的值对字典进行排序。有什么想法吗? 最佳答案 你的意思是你想要所有的值,按内部值排序? from outerPair in outer from
我想建模一个模式,其中响应是字典: { 'id1': { 'type': 'type1', 'active': true, }, 'id2': { 'type':
我有以下代码要添加或更新(如果已经存在)dict()-dict 中的值: if id not in self.steps: self.steps[ id ] = step else:
我有一个包含字典的 Swift 字典,我想使用存储的属性来访问键值: var json = [NSObject:AnyObject]() var title: String { get
我想创建一个 Dictionary>结构,我想提供一个 IEqualityComparer在包含 APerson 的second 字典中作为关键 如果我只有内部字典,那就是 var f = new D
我有一个集合,其中包含如下文档:文档 1: { "company": "ABC" "application": { "app-1": {"earning_from_src_A": 50,
我正在快速学习。 我发现 dictionary 就像 hash 用于 PHP 或其他一些语言。 那我怎么制作dictionary的dictionary呢?? 我有这样的数据 key:J name:jh
这个问题在这里已经有了答案: Explode a dict - Get all combinations of the values in a dictionary (2 个答案) 关闭 5 个月前
我是编程新手,所以如果我的问题看起来很愚蠢,我很抱歉。我想问一下有没有办法从 Multi.Dictionary 返回key当我有值(value)? 这是我的代码: Dim myDict Set myD
我试图找出标准 Ada 库是否配备了“字典”类型(我的意思是:一种以 格式存储值的数据结构,我可以从中检索 value 使用相应的唯一 key)。 这样的数据结构存在吗?如果是这样,有人可以提供一个
我究竟做错了什么?根据我的测试,objDic.exists 永远不会给出 False! dim objDic set objDic = createobject("scripting.
我想创建一个复合类型,其中包含一个字典作为其命名字段之一。但是明显的语法不起作用。我敢肯定有一些我不明白的基本原理。下面是一个例子: type myType x::Dict() end Jul
julia> hotcell2vocab = Dict([(cell, i-1+vocab_start) for (i,cell) in enumerate(h
我有一个简单的问题:我对 Dictionary.Value 集合进行了很多次迭代,这让我很烦,我必须调用 .ToList() 然后才能调用 .ForEach(),因为它似乎没有可枚举的Dictiona
我是一名优秀的程序员,十分优秀!