Skip to content
intRobyn edited this page Mar 29, 2017 · 2 revisions

JSON vs GeoJSON

Introduction

JSON

"

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language,Standard ECMA-262 3rd Edition - December 1999.JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.

JSON is built on two structures:

  • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
  • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

These are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangeable with programming languages also be based on these structures.

"

quoted from http://www.json.org/

Additional links: http://blog.scottlowe.org/2013/11/08/a-non-programmers-introduction-to-json/ https://betterexplained.com/articles/using-json-to-exchange-data/

GeoJSON

"

GeoJSON is a format for encoding a variety of geographic data structures using JavaScript Object Notation (JSON) RFC7159. A GeoJSON object may represent a region of space (a Geometry), a spatially bounded entity (a Feature), or a list of Features (a FeatureCollection). GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. Features in GeoJSON contain a Geometry object and additional properties, and a FeatureCollection contains a list of Features.

The format is concerned with geographic data in the broadest sense; anything with qualities that are bounded in geographical space might be a Feature whether or not it is a physical structure. The concepts in GeoJSON are not new; they are derived from preexisting open geographic information system standards and have been streamlined to better suit web application development using JSON.

GeoJSON comprises the seven concrete geometry types defined in the OpenGIS Simple Features Implementation Specification for SQL SFSQL: 0-dimensional Point and MultiPoint; 1-dimensional curve LineString and MultiLineString; 2-dimensional surface Polygon and MultiPolygon;

"

Quoted from https://tools.ietf.org/html/rfc7946#page-3

Additional links http://geojson.org/geojson-spec.html

CHORDS Implementation of JSON

Chords is currently using JSON to show the project, site, affiliation, and what station the instrument is located at. As well as some variables input by the researchers.

Example Code

{"Project":"EarthCube Portal", "Site":"NCAR Foothills Lab", "Affiliation":"NSF EarthCube", "Instrument":"FL Wx Station", "Data":{"Time":["2017-01-25T21:58:31Z"], "wdir":[104.0], "wspd":[1.7], "wmax":[3.2], "tdry":[-1.3], "rh":[44.5], "pres":[833.7], "raintot":[3.1], "batv":[15.5]}}

Definitions:

Instrument: Name of the instrument, define by researchers

Affiliation: Which group researchers are working with on specific projects

Project: Name of the project on CHORDS portal.

Site: Specific lab, college, or general location the instrument is located at.

(Header)

{"Project":"EarthCube Portal", "Site":"NCAR Foothills Lab", "Affiliation":"NSF EarthCube", "Instrument":"FL Wx Station",

(Data)

 "Data":{"Time":["2017-01-25T21:58:31Z"], "wdir":[104.0], "wspd":[1.7], "wmax":[3.2], "tdry":[-1.3], "rh":[44.5], "pres":[833.7], "raintot":[3.1], "batv":[15.5]}}

GeoJSON

"

GeoJSON is a format for encoding a variety of geographic data structures. A GeoJSON object may represent a geometry, a feature, or a collection of features. GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection. Features in GeoJSON contain a geometry object and additional properties, and a feature collection represents a list of features. A complete GeoJSON data structure is always an object (in JSON terms). In GeoJSON, an object consists of a collection of name/value pairs -- also called members. For each member, the name is always a string. Member values are either a string, number, object, array or one of the literals: true, false, and null. An array consists of elements where each element is a value as described above.

"

Quoted from http://geojson.org/geojson-spec.html

Note: When you download the data you'll need to change the delimiter " => " to " : " in the JSON file from CHORDS.

e.x.: "Project"=>"EarthCube Portal", should be changed to, "Project":"EarthCube Portal" (tested in python and ruby)

Example Code

{"Project":"EarthCube Portal", "Site":"NCAR Foothills Lab", "Affiliation":"NSF EarthCube", "Instrument":"FL Wx Station", “Units of measurement”:”mph, m/s, mm, watt”,”Device Used”: “magnetometer (make: Geometrics model: G­882)”:  "Data":
{"Time":["2017-01-25T21:58:31Z"], "wdir":[104.0], "wspd":[1.7], "wmax":[3.2], "tdry":[-1.3], "rh":[44.5], "pres":[833.7], "raintot":[3.1], "batv":[15.5] "coordinates": [102.0, 0.0],
}}

(Header)

{"Project":"EarthCube Portal", "Site":"NCAR Foothills Lab", "Affiliation":"NSF EarthCube", "Instrument":"FL Wx Station", “Units of measurement”:”mph, m/s, mm, watt”,”Device Used”: “magnetometer (make: Geometrics model: G­882)”: 

(Data)

 "Data":
{"Time":["2017-01-25T21:58:31Z"], "wdir":[104.0], "wspd":[1.7], "wmax":[3.2], "tdry":[-1.3], "rh":[44.5], "pres":[833.7], "raintot":[3.1], "batv":[15.5] "coordinates": [102.0, 0.0],
}}

GeoJSON also has the ability to map data points geographically and uses a variety of tools to do so. I’ve listed some of the tools below for those interested.

Links for mapping data through GeoJSON

  • Joining data through python

http://frictionlessdata.io/guides/joining-data-in-python/

  • Quantum GIS Software

http://spatialnews.geocomm.com/articles/qgisreview/

  • Google Maps Data Layers

https://thenextweb.com/dd/2015/04/10/you-can-now-use-google-maps-data-layers-to-create-more-powerful-interactive-apps/

  • Google Maps Android API Utility Library

https://developers.google.com/maps/documentation/android-api/utility/

  • GeoBases: Data Services and Visualization

http://opentraveldata.github.io/geobases/

  • GeoJSON Open Source Geo, Web Maps, etc.

http://geojason.info/

  • Building Custom Maps in Wave

https://developer.salesforce.com/blogs/developer-relations/2016/08/art-possible-building-custom-maps-wave.html

  • GitHub: GeoJSON Dashboard

https://github.com/fulcrumapp/geojson-dashboard

  • QGIS: Free and Open Source Geographic Information System

http://www.qgis.org/en/site/

-- (Tutorial for QGIS)

http://www.qgistutorials.com/en/docs/importing_spreadsheets_csv.html

Comparison

JSON Shows GeoJSON Shows
Project What Station the Instrument is at
Site Affiliation
Affiliation Project
What Station the Instrument is located at Axes (latitude, longitude)
Variables input by the researchers Device Information (What make/model)
Units of Measure

Conclusion

GeoJSON offers more than normal JSON in terms of geoscience with a format that specifies the data and makes it easier not just for machines to read but for people too. It helps to specify measurements and increase accuracy in collecting the data that we read in from our machines around the globe.

Clone this wiki locally