Geo General  1
 All Classes Files Functions Variables Pages
mapRender

Introduction:

mapRender is an executible that can render a map from a vector dataset while filtering the result set using a SQL interface. Currently tested vector formats include shape and geojson, but minor edits to the vector drivers section can make any GDAL/OGR compatible driver available.

Execution Examples:

with a query:

./mapRender ./input.shp ./output.tif -query="SELECT * FROM input WHERE cast(start_time as character) > '2014/01/01'"

This would filter the records in input.shp to the results with a start_time more recent than the start of 2014 and output the results into a vector called output.shp and a global heatmap called output.tif.

without a query:

./mapRender ./input.shp ./output.tif

This will do the same thing but will default to "select * from layername". Additionally, because no filter was applied there is no reason to create an output vector (it would be the same as input), so the sole output would be the raster map.

Execution happens in two main stages:

  1. filtering the vector objects to the search criteria defined in the SQL query
  2. counting the number of feature intersections with the raster for heatmap geotiff output.

Output to the console looks something like:

    executing query: SELECT * FROM infoterra WHERE cast(start_time as character) > '2014/01/01'
    query results: 14852
    band 1 complete, TDX-1_2014-04-04T05_43_2807886
    success!

QueryEngine:

The QueryEngine component is based on OGR SQL dialect. The basic structure is:

    "SELECT * FROM layername WHERE <list of logical expressions>"

the layer name is typically the name of the vector file, but in some cases it may be different. To see the list of avilable layers and the associated attibutes from a vector file, use ogrinfo:

    ogrinfo world_borders.shp -al -so

and you should get something like:

    INFO: Open of `world_borders.shp'
    using driver `ESRI Shapefile' successful.

    Layer name: world_borders
    Geometry: Polygon
    Feature Count: 3784
    Extent: (-180.000000, -90.000000) - (180.000000, 83.623596)
    Layer SRS WKT:
    (unknown)
    CAT: Real (16.0)
    FIPS_CNTRY: String (80.0)
    CNTRY_NAME: String (80.0)
    AREA: Real (15.2)
    POP_CNTRY: Real (15.2)

Please refer to OGR SQL documentation for more info.

Output:

mapRender will output a heatmap of the number of records that meet the search criteria defined in the SQL query with the name defined in the second commandline parameter. Output is a single band unsigned 16-bit integer geotiff allowing us to count up to 65,534 records per pixel. The raster dimensions are 3600 x 1800 with an origin at -180 , 90 and 0.1 degree resolution. We also output a vector file containing the records that meet the search criteria in the SQL query. We do this in a standard container to save space so some attributes may get clipped but geometry is guaranteed to be accurate.

For example, here is an map of the geofuse archive filtered to records in 2014:

geofuse2014.jpeg

...and a similar map of the infoterra archive filtered to records in 2014:

infoterra2014.jpeg

Copyright 2014 Google Inc. All rights reserved.