How can i convert my lat and long value into geojson object. I work on php platform.
Nothing is in the wrong order. Leaflet uses lat-lng (or northing-easting ) whereas GeoJSON uses lng-lat (or easting-northing ).
Launch geojson.io from http://geojson.io/#map=2/20.0/0.0. I will be using a polygon in this instance. Draw your AOI by clicking desired points on the map to outline your AOI. Once you complete the polygon it will be shaded and the associated JSON will be generated in the output area to the left.
GeoJSON is an open standard geospatial data interchange format that represents simple geographic features and their nonspatial attributes. Based on JavaScript Object Notation (JSON), GeoJSON is a format for encoding a variety of geographic data structures.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With