【发布时间】:2018-08-19 08:30:41
【问题描述】:
我正在使用 google maps api 和 geojson 数据文件进行地图项目。我的问题是我不知道如何将自定义样式应用于我的观点。这就是我加载数据的方式:
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
center: {lat: 43.15, lng: -84.75}
});
map.data.loadGeoJson(
'Maps/Newark.geojson');
map.data.loadGeoJson('Maps/Newark.geojson');
map.data.setStyle(//* I'm not sure what to put here*//)
}
</script>
这是我的 geojson 文件的示例:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [ -84.69729,43.24808 ]
},
"properties": {}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [ -84.58872,43.23395 ]
},
"properties": {}
}
}
【问题讨论】:
标签: html google-maps-api-3 geojson