Database Reference
In-Depth Information
Importing nonspatial tabular data (CSV)
using GDAL
As an alternative approach to the previous recipe, you will import a CSV file to
PostGIS using the
ogr2ogr
GDAL command and the
GDAL OGR virtual format
.
The
Geospatial Abstraction Library
(
GDAL
), is a translator library for raster geo-
spatial data formats. OGR is the related library that provides similar capabilities for
vector data formats.
This time, as an extra step, you will import only a part of the features in the file and
you will reproject them to a different spatial reference system.
Getting ready
You will import the
Global_24h.csv
file to the PostGIS database from NASA's
Earth Observing System Data and Information System
(
EOSDIS
).
You can download the file from the EOSDIS website at
ht-
tp://firms.modaps.eosdis.nasa.gov/active_fire/text/Global_24h.csv
,
orcopyitfromthe
dataset directory of the topic for this chapter.
This file represents the active hotspots detected by the
Moderate Resolution Ima-
ging Spectroradiometer
(
MODIS
) satellites in the world for the last 24 hours. For
eachrow,therearethecoordinatesofthehotspot(latitude,longitude)indecimalde-
grees(intheWGS84spatialreferencesystem,SRID=4326),andaseriesofuse-
fulfieldssuchasthe
acquisition date
,
acquisition time
,and
satellite
type
, just to name a few.
You will import only the active fire data scanned by the satellite type marked as "T"
(Terra MODIS), and you will project it using the Spherical Mercator projection co-
ordinatesystem(
EPSG:3857
,sometimesmarkedas
EPSG:900913
,wherethenum-
ber900913representsGooglein1337speak,asitwasfirstwidelyusedbyGoogle
Maps).