Convert lat long into geojson object
How can i convert my lat and long value into geojson object. I work on php platform.
If I understand well, you want to build a string like this:
$my_geoJSON = '{ "type": "Point", "coordinates": ['.$longitude.' ,'.$latitude.'] }';
As as the specification for GeoJSON format (RFC7946) says:
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] }
Put all your Lat Long data in a CSV file and use the below online tool to create a GeoJson file. Verify it using http://geojson.io/ tool.
http://www.convertcsv.com/csv-to-geojson.htm
I think, you should have a look to the geojson specification (http://geojson.org/geojson-spec.html#id9) you can also view simple example that will certainly help you to create a simple geojson with you lat/lon.
精彩评论