GeoJSON and Javascript Mapping APIs

Topics

  1. What is spatial data?

    Mapping & GIS 101

  2. GeoJSON

    A peek at the GeoJSON format specification

  3. Tile5 in ASP.Net MVC

    Look at usage of GeoJSON in Tile5

  4. Leaflet and PostGIS

    Look at usage of GeoJSON in Leaflet and PostGIS

  5. Object Databases

    GeoJSON in the Object Database

  6. Standardised formats in JSON

    GeoJSON as a standard, and possibilities of other standard industry structures in JSON

GIS 101

What is a GIS?

A geographic information system (GIS) integrates hardware, software, and data for capturing, managing, analyzing, and displaying all forms of geographically referenced information.

gis.com

In the simplest terms, GIS is the merging of cartography, statistical analysis, and database technology.

wikipedia

GIS 101

Maps

  • A map is made up of layers which represent each logical data entity shown on the map
  • Each layer can be thought of as a transparency overlay which can be visualised independently of the other layers in the map
  • Selections can be executed between different layers (or sub selections of layers), allowing spatial analysis to be performed
  • GIS 101

    Feature Classes

  • The data in each layer is modelled as a feature class which best represents the particular type of information
  • The main feature classes for representing data are
  • - Points
    - Lines
    - Polygons

    e.g.
    Points - Drainage Pits, Water Valves, Access Chambers
    Lines - Pipes
    Polygons Cadastral Boundaries (Land Parcels)

    GIS 101

    Who uses GIS?

  • Casual users determine location and directions with GIS technology
  • GIS is used in the enterprise as a decision support system
  • State government uses GIS to manage land titles, natural resources, transport networks, environmental assessments
  • Local government uses GIS to manage zoning, development assessment, asset infrastructure
  • What is GeoJSON?

    GeoJSON is a specification format for representing spatial features in JSON

    Check out the specification at geojson.org

    GeoJSON Geometry

    Point

    { "type": "Point", "coordinates": [100.0, 0.0] }

    LineString

    { "type": "LineString",
      "coordinates": [ [100.0, 0.0], [101.0, 1.0] ]
    }

    Polygon

    { "type": "Polygon",
      "coordinates": [
        [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
        ]
    }

    GeoJSON Features

    Feature

    { "type": "Feature",
      "geometry": {
          "type": "LineString",
          "coordinates": [
              [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
              ]
      },
      "properties": {
          "prop0": "value0",
          "prop1": 0.0
      }
    }

    Tile5 & GeoJSON

    Objective

  • Use Tile5 to create a simple map
  • Display a general base layer that updates as the map is zoomed and panned
  • Include a cadastral overlay that updates as the map is zoomed and panned
  • Utilise GeoJSON to deliver the cadastral data to Tile5 and simplify rendering
  • Data

  • Queensland digital cadastral database in SQL Server
  • Tile5 & GeoJSON Solution

    Code Walkthrough - Source

  • Make AJAX call when map's extents change (zoom and pan)
  • MVC Conntroller Action accepting the map's extent as a parameter
  • Action selects the records that reside within the map's extent using SQL Server spatial query
  • Net Topology Suite used for parsing the query results and structuring into GeoJSON
  • See blog post for more code detail

    Tile5 & GeoJSON

    (Static screenshot of demo)

    Leaflet & GeoJSON

    Objective

  • As per Tile5 example
  • Try to make spatial parsing code leaner
  • Leaflet & GeoJSON Solution

    Code Walkthrough - Source

  • Make AJAX call when map's extents change (zoom and pan)
  • ExpressJS Action accepting the map's extent as a parameter
  • Action selects the records that reside within the map's extent using PostGIS spatial query
  • PostGIS passes back results as GeoJSON strings, so deserialise into a collection of GeoJSON features
  • See blog post for more code detail

    Leaflet & GeoJSON

    (Static screenshot of demo)

    Object Databases

    CouchDB

  • Document Database
  • RESTful JSON APIs
  • Queries provided by Views - Map Reduce functions
  • GeoCouch

  • Extension of CouchDB to provide R-tree indexing
  • Spatial views - output as GeoJSON
  • Is your spatial data suited to storage in an object database?

    Standardised JSON

    REST vs SOAP

  • Resources vs Operations
  • SOAP
  • REST
  • GeoJSON - nice and simple
  • Other Industries

  • Workflow
  • Takeaways

  • Spatial Backgrounder
  • GeoJSON
  • Mapping API examples
  • Object Database Possibilities
  • Thoughts on standardised structures in JSON
  • About

    Todd Jackson

    @stoolrossa

    boomphisto.blogspot.com

    /

    #