Book Image

Leaflet.js Essentials

Book Image

Leaflet.js Essentials

Overview of this book

Table of Contents (13 chapters)
Leaflet.js Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring GeoJSON


GeoJSON is a JSON format that encodes geometries. GeoJSON can encode points, line strings, and polygons. It also allows for multipart geometries. You can encode multipoints, multiline strings, and multipolygons. These should sound familiar because they are pretty close to the geometries you learned to draw in Chapter 1, Creating Maps with Leaflet. The following GeoJSON code shows you two points in a feature collection:

{"type":"FeatureCollection",
  "features":[
      {"type":"Feature",
          "geometry":{
              "type":"Point",
              "coordinates":[-106.62987,35.10418]
                  },
          "properties":{
              "name":"My Point",
              "title":"A point at the Big I"
                  }
      },      {"type":"Feature",
          "geometry":{
              "type":"Point",
              "coordinates":[-106,35]
                  },
          "properties":{
              "name":"MyOther Point",
              "title":"A point near Moriarty...