Skip to content
kgrochow edited this page Nov 28, 2013 · 8 revisions

Here are some tools for working geospatial data

ogr2ogr

Great tool for converting formats

Installation

There are examples of using it here.

There is also a site here that provides a web service for conversion

http://ogre.adc4gis.com/

Map Shaper

An opensource tool for simplifying geographic shapes while maintaining topographical relationships. This is particularly useful for simplifying boundary data to be used in interactive websites.

Map shaper can be installed via the node package manager, found on github or be used through their web gui.

Geonames

Open source service and download site for geocoding and reverse geocoding.

http://www.geonames.org/export/

Provides results in both xml and json for most services.

Cesium and Subspace - czml and geojson

For converting from KML and ESRI Shape files to CZML, we use the open source project czml-writer https://github.com/AnalyticalGraphicsInc/czml-writer. As with the previous project, it provides source code and examples for creating a local conversion tool on windows or linux.

The typical command line is:

CesiumLanguageConverter file.kml

This project will probably be quite dynamic as it needs to reflect changes in the internal cesium engine and is an evolving standard for the time being. Frequently checking for project updates is recommended.

ESRI shape files (.shp) are currently not supported by the converter. In order to convert a shape file it must first be converted into kml using ogr2ogr.exe and then it can be converted to czml as described above.

ogr2ogr -f "KML" file.kml file.shp

Tiled Imagery

For creating geo-located tiled image sets from images, we use MapTiler available at http://www.maptiler.org/. This program has a set of dialogs to guide you through the process. The normal process is

  • Launch MapTiler.
  • For Google Earth select Spherical Mercator and for Cesium select that or the WGS84 Plate Caree (Geodetic) kind of tiles and select continue.
  • Load an image and select the Georeference button to set the NSEW extents of the image. Note that this is a different order from the Cesium Extent used to display the tiles in subspace. Select continue.
  • Select continue on the SRS dialog.
  • On the tile pyramid page make sure to set the Minimum zoom to 0. Select continue.
  • Select continue until you get to the page with the render button. Hit render and go get some lunch if it is a large image.
  • The tile set should be ready to go in the destination folder. See the Tiled Imagery demo for an example of how to display the tiles in subspace.

NOTE: We recommend using png images if you want to create tiles with transparency.

Terrain

Changing the appearance of the terrain in subspace can be accomplished by using the gdal tools based on elevation files from sources such as SRTM or Geoscience Australia. Most of these sources will output .ERS formatted files which are used in the example below. Other formats should work as well as long as they are supported by gdal.

Once you have your file, terrain.ers you can create a color relief geotif with the following command:

    gdaldem color-relief -of GTiff -co "TILED=YES" terrain.ers color_file.txt color.tif

where color_file.txt is in the format "elevation_value red green blue" as shown below. This is covered in the gdal documentation here along with other possible views that can be created http://www.gdal.org/gdaldem.html .

    0 110 220 110
    900 240 250 160

To improve the appearance of the image (merge shading and terrain coloring) I would recommend referencing this page http://dirkraffel.com/2011/07/05/best-way-to-merge-color-relief-with-shaded-relief-map/ . I used the following commands after installing imagemagick.

    gdaldem hillshade terrain.ers hills.tif -z 4 -s 111120
    listgeo color.tif > meta.txt
    composite -blend 60 color.tif hills.tif output.tif
    geotifcp -g meta.txt output.tif final.tif
    gdalinfo final.tif

Once you have the geolocated terrain image you like you can use maptiler as described above to make tile sets for subspace.

Netcdf

A lot of environmental data is stored in netcdf format. This is a self tagging binary format that can be a bit complicated to work with. Here are some tools and sample code that will help with the process.

https://github.com/jllodra/ncdump-json