-
Notifications
You must be signed in to change notification settings - Fork 0
Data Conversion
Here are some tools for working geospatial data
Great tool for converting formats
Installation
- Windows - the easiest access to ogr2ogr.exe is by installing FWTools from http://fwtools.maptools.org/.
- Mac - On Mac OS X you can install the “GDAL Complete” Framework from http://kyngchaos.com
- Ubuntu - sudo apt-get install gdal-bin
There are examples of using it here.
There is also a site here that provides a web service for conversion
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.
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.
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
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.
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.
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.