02 Geographic scripting in uDig - halfway between user and developer

1,017 views
916 views

Published on

Part 02 - Geographic scripting in uDig - halfway
between user and developer

Course I gave at the University of Potsdam about Geoscripting in uDig.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,017
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

02 Geographic scripting in uDig - halfway between user and developer

  1. 1. Open Source GISGeographic 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. 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
  3. 3. (Multi)PointA Point models a single Coordinate, a MultiPoint models a collection ofpoints.
  4. 4. (Multi)LineStringThe LineString is what we generally call line. It has a length, but 0 area.
  5. 5. (Multi)PolygonPolygons 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 USAbut not attached to it, more than one polygon is merged into a single feature.
  6. 6. Vector data: Feature and FeatureTypeThe Feature represents probably the most central object for GISapplications. 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. 7. FiltersA 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 applyboth to the alphanumeric values of an attribute table as well as to thegeometry.One example could be: give me all the cities of Canada that count morethan 10000 inhabitants.
  8. 8. Constraint Query LanguageThe Constraint Query Language is used to define expressions and filters inseveral parts of the uDig application.The uDig user help explains quite well how to use CQL. Online that can befound here.Examples: • CITY = Nelson • ATTR1 < (1 + ((2 / 3) * 4)) • ATTR1 < abs(ATTR2) • ATTR1 < 10 AND ATTR2 < 2 OR ATTR3 > 10
  9. 9. A few examples of CQL in uDigSelect every feature that contains a text rome.
  10. 10. Select all the cities in Italy that have more than 500000 inhabitants.
  11. 11. StyleStyle is that part that allows us to make maps look pretty and get the neededsymbolization and coloring of the contained data. The OGC defines theStyled Layer Descriptor (SLD) as the standard to style maps.To create SLD styles, the style editor of uDig can be used.
  12. 12. Raster data: GridCoverageA 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 followingschema 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. 13. When we talk about raster data in GIS we usually mean digitalelevation/terrain/surface models (DEM/DTM/DSM). DEMs can be used toextract various attributes useful for hydrologic, geomorphologic analyses.From the DEM maps like aspect, flowdirections, curvatures, gradient andextracted network can be calculated.Also ortophotos and in general georeferenced imagery is technicallyspeaking raster data.The difference between the two, is that imagery contains in each cell theinformation of the pixel color, while DEM or similar contain the value of thescientific entity (ex. the elevation value in a DEM).
  14. 14. CoordinateReferenceSystemWIKIPEDIA: "A spatial reference system (SRS) or coordinate referencesystem (CRS) is a coordinate-based local, regional or global system usedto locate geographical entities. A spatial reference system defines aspecific map projection, as well as transformations between differentspatial reference systems. Spatial reference systems are defined by theOGCs Simple feature access using well-known text, and support has beenimplemented by several standards-based geographic information systems.Spatial reference systems can be referred to using a SRID integer, includingEPSG codes defined by the International Association of Oil and GasProducers."
  15. 15. The DatumThe datum is a reference surface from which measurements are made(Wikipedia).Datums can be local, which are locally orientated ellissoid (no deviation onthe vertical, locally tangent), or global, which are used to cover the wholeglobe and designed to support satellitar measurements. global ellipsoid local ellipsoid geoid
  16. 16. Example DatumsRoma 40 local datum based on Hayford ellipsoid, with prime meridian on Monte MarioEuropean 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 earths mass center. Used for example in the classic GPS CRS (EPSG:4326)
  17. 17. The Universal Transverse Mercator (UTM)UTM maps the Earth with a transverse cylinder projection using 60 differentmeridians, each of which is a standard "UTM Zone". By rotating the cylinderin 60 steps (six degrees per step, about 800Km) UTM assures that all spotson the globe will be within 3 degrees from the center of one of the 60cylindrical projections.
  18. 18. Coordinate reprojection and transform, the (not so small) differenceOften 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 doesnt 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. 19. CoordinateReferenceSystems in uDigIn uDig data that have a projection information are reprojected on the fly. Thedata 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:
  20. 20. CoordinateReferenceSystems messRemeber: a CRS has an area of validity. On small portions one cantransform between lat/long and UTM32N without problems.
  21. 21. This work is released under Creative Commons Attribution ShareAlike (CC-BY-SA)Much of the knowledge needed to create this training material hasbeen produced by the sparkling knights of the GeoTools, JTS anduDig community. Another essential source has been the Wikipediacommunity effort.Particular thanks go to those friends that directly or indirectly helpedout in the creation and review of this series of handbooks.This tutorial is brought to you by HydroloGIS.

×