Time Series Foundation Models - current state and future directions
02 Geographic scripting in uDig - halfway between user and developer
1. Open Source GIS
Geographic scripting in uDig - halfway
between user and developer
Geoinformation Research Group, Department of Geography
University of Potsdam
March 2013
Data in uDig
Tutor: Andrea Antonello
ydroloGIS nvironmental ngineering
HydroloGIS S.r.l. - Via Siemens, 19 - 39100 Bolzano www.hydrologis.com
2. Which are the main vector geo-objects?
The main spatial data types that are usually dealth with are:
Point
GeometryCollection
MultiPoint
LineString
MultiLineString
LinearRing
Polygon MultiPolygon
5. (Multi)Polygon
Polygons have a length (perimeter) and an area. They can also have holes.
An example of MultiPolygons can be seen above. Alaska is part of the USA
but not attached to it, more than one polygon is merged into a single feature.
6. Vector data: Feature and FeatureType
The Feature represents probably the most central object for GIS
applications. The FeatureType can be seen as the blueprint of the data.
Vector data are composed of a geometry part and an attribute table.
SimpleFeatureType:
the_geom: LineString
id: Integer
road1 name: String
length: Double
id name length
1 road1 56.4
road2
2 road2 120.0
geometry attributes
7. Filters
A Filter defines a constraint that can be checked against an object.
A filter can be seen as the WHERE clause of an SQL statement. It can apply
both to the alphanumeric values of an attribute table as well as to the
geometry.
One example could be: give me all the cities of Canada that count more
than 10000 inhabitants.
8. Constraint Query Language
The Constraint Query Language is used to define expressions and filters in
several parts of the uDig application.
The uDig user help explains quite well how to use CQL. Online that can be
found here.
Examples:
• CITY = 'Nelson'
• ATTR1 < (1 + ((2 / 3) * 4))
• ATTR1 < abs(ATTR2)
• ATTR1 < 10 AND ATTR2 < 2 OR ATTR3 > 10
9. A few examples of CQL in uDig
Select every feature that contains a text rome.
10. Select all the cities in Italy that have more than 500000 inhabitants.
11. Style
Style is that part that allows us to make maps look pretty and get the needed
symbolization and coloring of the contained data. The OGC defines the
Styled Layer Descriptor (SLD) as the standard to style maps.
To create SLD styles, the style editor of uDig can be used.
12. Raster data: GridCoverage
A GridCoverage is what in the real world we usually call Raster or Grid, i.e.
a rectangular regular grid of pixels, each containing a value. The following
schema contains the main definitions we will use:
cols
grid space
raster values
north
rows
0,0 1200 1800 1800 1800
1200 1170 1130 1130
y (northing)
west 2,1 1200 1170 1130 1100
east
x res
y res
equator
x (easting) south
world space
13. When we talk about raster data in GIS we usually mean digital
elevation/terrain/surface models (DEM/DTM/DSM). DEMs can be used to
extract various attributes useful for hydrologic, geomorphologic analyses.
From the DEM maps like aspect, flowdirections, curvatures, gradient and
extracted network can be calculated.
Also ortophotos and in general georeferenced imagery is technically
speaking raster data.
The difference between the two, is that imagery contains in each cell the
information of the pixel color, while DEM or similar contain the value of the
scientific entity (ex. the elevation value in a DEM).
14. CoordinateReferenceSystem
WIKIPEDIA: "A spatial reference system (SRS) or coordinate reference
system (CRS) is a coordinate-based local, regional or global system used
to locate geographical entities. A spatial reference system defines a
specific map projection, as well as transformations between different
spatial reference systems. Spatial reference systems are defined by the
OGC's Simple feature access using well-known text, and support has been
implemented by several standards-based geographic information systems.
Spatial reference systems can be referred to using a SRID integer, including
EPSG codes defined by the International Association of Oil and Gas
Producers."
15. The Datum
The datum is a reference surface from which measurements are made
(Wikipedia).
Datums can be local, which are locally orientated ellissoid (no deviation on
the vertical, locally tangent), or global, which are used to cover the whole
globe and designed to support satellitar measurements.
global ellipsoid
local ellipsoid
geoid
16. Example Datums
Roma 40
local datum based on Hayford ellipsoid, with prime meridian on Monte
Mario
European Datum 50
local datum based on Hayford ellipsoid, tangent in Potsdam area,
with prime meridian in Greenwich. Used for UTM-ED50 CRS.
World Geodetic System WGS84
global datum with origin on the earth's mass center. Used for
example in the classic GPS CRS (EPSG:4326)
17. The Universal Transverse Mercator (UTM)
UTM maps the Earth with a transverse cylinder projection using 60 different
meridians, each of which is a standard "UTM Zone". By rotating the cylinder
in 60 steps (six degrees per step, about 800Km) UTM assures that all spots
on the globe will be within 3 degrees from the center of one of the 60
cylindrical projections.
18. Coordinate reprojection and transform, the (not so small) difference
Often reproject and transform are used the same way without much care.
There is a big difference though.
reproject
This is what we would call coordinate transform (CT). A CT can be
resolved in a well defined mathematical manner that doesn't lead to
precision loss (even if usually there is some minor due to data
precision and roundings).
transform
This is what we could call datum transform. Since datums are local
approximations of the geoid, transformations between datums are
based on statistical methods and lead most of the times to precision
loss.
19. CoordinateReferenceSystems in uDig
In uDig data that have a projection information are reprojected on the fly. The
data from the Natural Earth dataset are in the geographic Lat/long WGS84.
Is it possible to reproject them in WGS 84 / UTM zone 32N?
Sure, open the CRS dialog and set it to the UTM zone of choice:
21. This work is released under Creative Commons Attribution Share
Alike (CC-BY-SA)
Much of the knowledge needed to create this training material has
been produced by the sparkling knights of the GeoTools, JTS and
uDig community. Another essential source has been the Wikipedia
community effort.
Particular thanks go to those friends that directly or indirectly helped
out in the creation and review of this series of handbooks.
This tutorial is brought to you by HydroloGIS.