Tips and tricks to manage (geo) spatial data
(Geo) Spatial data models
Spatial data can be defined as data that have a specific spatial extent over the earth surface. Two main data models exists for
(geo) spatial data representation:
- raster data: such model is based on a continuous representation of spatial elements, being the pixel it minimum unit. Most commonly used raster files are Tiff/Geotiff, jpeg, png, ERDAS Imagine. All these files generally need an external file for georeferencing (e.g. .tfw for Tiff, .jpgw for jpg, pngw for png), a simple text file stating the coordinates of the upper left corner coordinates and the pixel size ((in degrees for geographical ones, in meters for projected ones). The pixel size is a direct measure of the resolution of the image;
- vector data: such model is based on a discrete respresentation of spatial elements, distinct one from another; geometrical primitives that are user to represent spatial objects are: points, lines (polylines), polyogns (multi-polygons). Most commonly user vector files are: ESRI Shapefile, KML/KMZ, Map Info, CSV, GML. All these files include the geographical/metrical coordinates of their elements (the geometry) and an attribute table that associates to each element (record) a set of information (fields). Generally these files need an external file (e.g. .prj for ESRI Shapefile) to define the specific reference system in which coordinates are expressed.
There are several software solution to display, edit and process
(geo)spatial data, both commercial and free/open source.
Most commonly used commercial solutions are:
- ESRI ArcGIS, a solution mailnly for vector data manipuation and processing, raster/vector data integration and representation;
- ERDAS Imagine, a solution mainly for raster data manipuation and processing, with some vector processing tools;
- ENVI, a solution mainly for raster data manipuation and processing, with some vector processing tools;;
- PCI Geomatics, a solution mainly for raster data manipuation and processing, with some vector processing tools;;
- Socet Set, a solution mainly for raster data manipuation and processing;
- Photoshop, a solution for raster data manipulation.
Most commonly known free/open source solutions are:
- Quantum GIS, a complete GIS solution for displaying most vector/raster data sources;
- GIMP, a complete solution for raster data manipulation;
- Google Earth, a free solution with a huge worldwide image database and KML/KMZ manipulating capabilities;
- FW Tools, a complete scriptable solution for raster/vector data manipulation, exploiting GDAL/OGR libraries;
- gvSIG, a complete GIS solution for displaying most vector/raster data sources.
Simple operations with (geo) spatial data
Basic operations with
(geo)spatial data are:
- View: use a free GIS such Quantum GIS or gvSIG to diplay and overlay raster and vector layers;
- Edit: use a GIS for editing existing objects or adding new ones;
- Query: use a free GIS such Quantum GIS or gvSIG to make queries over your vector data and display results;
- Reproject: use FW tools utilities (gdalwarp or ogr2ogr) to reproject both raster and vector layers;
- Change format: use FW tools utilities (gdal_translate or ogr2ogr) to change format of most raster and vector layers;
Examples
How do I check basic information (projection parameters, pixel size, number of featiures, extent) of my raster / vector file?
- Install FWTools installation package;
- Launch the command line shell;
- Raster: type the following string "gdalinfo <input file path "C:/Users/pippo_4326.tif">
- Vector: type the following string "ogr2ogr -summary <input file path "C:/Users/pippo_4326.shp"> <input layer name pippo_4326">
How do I reproject a shapefile/image from lat/lon WGS84 (EPSG:4326) to UTM WGS84 30N (EPSG:32630)?
- Install FWTools installation package;
- Launch the command line shell;
- Raster: type the following string "gdalwarp -s_srs EPSG:4326 -t_srs EPSG:32630 <input file path "C:/Users/pippo_4326.tif"> <output file path "C:/Users/pippo_3260.tif">"
- Vector: type the following string "ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:32630 <output file path "C:/Users/pippo_32630.shp"> <input file path "C:/Users/pippo_4326.shp">"
Note that
EPSG code is the unique reference to every geographic / projected reference system. Look for the EPSG code of your preferred reference system.
How do I change the format of a raster / vector file?
- Install FWTools installation package;
- Launch the command line shell;
- Raster: type the following string "gdal_translate -a_srs EPSG:4326 -of "GTiff" <input file path "C:/Users/pippo_4326.jpg"> <output file path "C:/Users/pippo_4326.tif">"
- Vector: type the following string "ogr2ogr -a_srs EPSG:4326 -f "ESRI Shapefile" <output file path "C:/Users/pippo_4326.shp"> <input file path "C:/Users/pippo_4326.kml">" (set -f "KML" for transforming shapefiles into KMLs)
Go back to WIKI Home page