Excuse me, Do you have a minute to talk about GeoJSON?
02 Mar 2019The Shapefile is the most common file format for vector data in social sciences, but I am not very fan of it. Each Shapefile contains the information of only one layer and is composed by several files. If you are working with several layers, things become complicated:
The basic composition of a Shapefile is:
.shp
stores the feature geometry;.shx
stores the index of the feature geometry;.dbf
stores the dataset associated. Complementary files are composed by.prj
(very important) stores the coordinate system information;.xml
stores metadata;.sbn
,.sbx
,.fbn
, and.fbx
(spatial indexes);.ain
,.aih
, and.atx
, (attribute indexes);.ixs
, and.mxs
(geocoding indexes).
It’s too much.
When taking Matt’s course on Spatial Analysis, I came across KML
and GeoJSON
, and really liked them. KML
and GeoJSON
files are lighter than Shapefiles, and can store several layers within a single file. (Although KML
seems to be even better,) GeoJSON
became my preferred file format to store my spatial data.
GeoJSON
is based on JSON, which is usually more efficient for storing data. GeoJSON’s simplicity makes it easy to use, read, and share. As said, you can store multpile layers (any type, points, lines and polygons) in just one file, as well as store a coordinate reference system. There are some nice tools in the web for working with GeoJSON: geojsonlit to validate your data in a map; ogre.adc4gis.com for transforming from GeoJSON to Shapefile or viceversa; geojson.io for editing your map’s features.
KML
is an Open Geospatial Consortium (OGC) standard data formatand is the standard file format to work with Google’s platforms (Google Earth, Google Maps, etc.). KML is restrained to a single projection standard (EPSG:4326), which makes things more simple when proyecting maps. Ah, and there is also the OSM
file format (native for Open Street Maps). As GeoJSON and KML files, OSM can include multiple layers in one file.
Epilogue: Introduction to GeoJSON and its advantages compared to ESRI Shapefile