Welcome to Advanced GIS, Lecture 5

This is a web page that can be viewed as slides.

→ to move forward

← to go back

Advanced GIS

Class 5

upcoming: 3/5 guest speaker

let's talk about this GeoJSON thing

we all know and love shapefiles, but...

shapefiles are difficult to read

(without proper software) shapefiles are difficult to read

(without proper software) shapefiles are difficult / impossible to write, too

how to write a shapefile:

and the people writing that software are in for some fun

gis.stackexchange.com

"It's like they had a bunch of smart developers with one lunatic thrown in."

okay, maybe you have the software already. there are some other problems:

1. column names limited to ten characters

how do you pronounce "C_DIG2DESC"?

2. multiple files make up a shapefile

3. one geometry type per shapefile

okay, back to GeoJSON

where do file formats come from?

where does GeoJSON work?

AnnieGitUrGun on github

GeoJSON is readable

{
    ...
}
{
    "type": "FeatureCollection",
    "features": [ ... ]
}
{
    "type": "FeatureCollection",
    "features": [
        { ... },
        { ... },
        { ... }
    ]
}
{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "id": 1,
                "Name": "My House",
                "City": "White Hall",
                "Comments": "It's OK"
            },
            "geometry": {
                "type": "Point",
                "coordinates": [-76.596, 39.684]
            }
        }
    ]
}

GeoJSON allows multiple geometry types in one file

GeoJSON is easy for web apps to understand

it's not without its flaws

the files can get big:

the files can get big:

getting GeoJSON files from CartoDB

http://eric.cartodb.com/api/v2/
    sql?q=SELECT * 
          FROM earthquakes 
          WHERE mag > 7
http://eric.cartodb.com/api/v2/
    sql?q=SELECT * 
          FROM earthquakes 
          WHERE mag > 7
    &format=geojson
view results

let's put GeoJSON files online

geojson.io

try it: go to geojson.io, make some features, and save your map

Philly farmers markets
National Park Service: NPMap
The Atlantic

create a github account

fork this repository:

github.com/ebrelsford/geojson-examples

login with geojson.io

find the repository you forked

make some changes and save them

view the commit

or through github