我该如何将我的经纬度值转换为GeoJSON对象。我使用的是PHP平台。
如果我理解正确,您想构建像这样的字符串:
$my_geoJSON = '{ "type": "Point", "coordinates": ['.$longitude.' ,'.$latitude.'] }';
正如GeoJSON格式规范(RFC7946)所述:
Point coordinates are in x, y order (easting, northing for projected coordinates, longitude, and latitude for geographic coordinates):
{ "type": "Point", "coordinates": [100.0, 0.0] }
我认为你应该看一下geojson规范(http://geojson.org/geojson-spec.html#id9),你也可以查看简单的示例,这肯定会帮助你使用你的纬度/经度创建一个简单的geojson。