我有一个带有普通 json 格式地理数据的服务器,我需要将其更改为 geojson 格式,以便 Mapbox 可以读取它。你怎么做到这一点?
例如,如何转换:
[
{
"id": 0,
"name": "Hotel",
"icon": "Sleep",
"address": "SampleStreet 34",
"latitude": 12,
"longitude": 55
}
]
进入这个:
{
"type": "FeatureCollection",
"features": [
{
"id": 0,
"type": "Feature",
"properties": {
"placeID": 0,
"name": "Hotel",
"icon": "sleep",
"addressFormatted": "SampleStreet 34"
},
"geometry": {
"type": "Point",
"coordinates": [
12,
55
]
}
}