1 / 176

EnterpriseDB Corporation

EnterpriseDB Corporation. EnterpriseDB is the leading provider of enterprise-class products and services based on PostgreSQL, the world's most advanced open source database. Over 600 customers including: Sony, FTD, British Telecom, TDAmeritrade. Introduction to PostGIS.

Télécharger la présentation

EnterpriseDB Corporation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EnterpriseDB Corporation EnterpriseDB is the leading provider of enterprise-class products and services based on PostgreSQL, the world's most advanced open source database. Over 600 customers including: Sony, FTD, British Telecom, TDAmeritrade

  2. Introduction to PostGIS Installation – Tutorial - Exercises

  3. What is PostGIS? • Like Oracle Spatial, DB2 Spatial, and SQL Server Spatial, PostGIS adds spatial capabilities to an existing relational database, in this case, PostgreSQL. • It could be renamed to “PostgreSQL Spatial” as it functions in the same way as proprietary database extensions.

  4. What is PostGIS? • Adds support for geographic objects to the PostgreSQL object-relational database • PostgreSQL already has “geometric types” but native geometries are too limited for GIS data and analysis

  5. What is PostGIS? • PostGIS adds an indexing mechanism to allow queries with spatial restrictions or filters (“within this bounding box”) to return records very quickly from large tables.

  6. What is PostGIS? • PostGIS adds a “geometry” data type to the usual data types (ie. varchar, integer, date, etc.) • PostGIS adds spatial predicates and functions that use the geometry data type. • ST_Distance(geometry, geometry) • ST_Area(geometry) • ST_Intersects(geometry, geometry))

  7. PostGIS Overview / History • Open source • General Public License (GPL) • Open development and support • History • 2001: First release, Mapserver support • 2002: Improved functions, indexes • 2003: GEOS support, many functions • 2004: SFSQL conformance • 2005: Lightweight geometries • 2006: OpenGIS SFSQL compliance • 2007: SQL/MM, curves & performance • 2008-2010: Performance enhancements

  8. Why PostGIS? • Because databases are better than files • Unified Storage, Management, Access • SQL Everywhere • Transactional Integrity • Multiple Users, Multiple Edits

  9. PostGIS PostGIS in the Spatial Stack LAN Internet Mapserver uDig OpenIMF GeoServer GRASS WebClient QGIS MapGuide ArcGIS OpenJUMP uDig

  10. Who is using PostGIS? • Lots of people … • 1790 mailing list members • 14K visits/month10K visitors/month • 130 source code downloads per day • 970K Google search results • Great Google trends …

  11. Who is using PostGIS? • North Dakota State Water Commission in Bismark uses PostGIS as the cost-effective foundation for managing the use of state-wide water resources. PostGIS tied unobtrusively into their existing desktop systems and pre-empted a costly migration to an ArcIMS/ArcSDE system.

  12. Who is using PostGIS? • The Ministry of Sustainable Resource Management (British Columbia, Canada) uses PostGIS to store, manage and analyze their Digital Road Atlas, a large and complex road network database.

  13. Who is using PostGIS? • Institut Géographique National (IGN France) uses PostGIS to underpin a system containing more than 100 million spatial objects, including a 3D national database of roads, rails, hydrography, vegetation, buildings and administrative boundaries.

  14. Who is using PostGIS? • InfoTerra (United Kingdom) uses PostGIS to store >600 million features of topographic data. Sits at the back-end of their online DataStore. Notable load times of 12 hours for the entire data-suite ~14000 features per second. More notable savings of ~£1000000 per annum.

  15. Workshop Summary • Introduction to Spatial Concepts • Installation (PostgreSQL and PostGIS) • Creating and Loading Data • Creating Indexes • Spatial Operations and Predicates • Spatial SQL • System Configuration

  16. Introduction to Spatial Concepts • A Geographical Information System (GIS) is any system used for capturing, storing, analyzing, managing, or presenting geospatial data. • Geometric Datatypes • Geometry Validity

  17. 2.1 Geometric Datatypes

  18. 2.1 Geometric Datatypes • Each geometry has a Well-Known Text representation (WKT) • A geometry type • A comma-separated list of coordinate pairs

  19. 2.1 Geometric Datatypes • Some examples are: POINT ( 7 6 )

  20. 2.1 Geometric Datatypes • Some examples are: MULTIPOINT ( 1 4, 1 5, -0.5 5.5314 )

  21. 2.1 Geometric Datatypes • Some examples are: LINESTRING ( 1 3, 1 1, 3 0 )

  22. 2.1 Geometric Datatypes • Some examples are: MULTILINESTRING (( 2 1, 2 2, 3 4 ), ( 4 3, 3 2, 4 1, 3 3 ))

  23. 2.1 Geometric Datatypes • Some examples are: POLYGON (( 2 5, 3 8, 6 8, 5 4, 2 5 ), ( 3 6, 4 5, 5 7, 4 6, 3 6 ))

  24. 2.1 Geometric Datatypes • Some examples are: MULTIPOLYGON ((( 6 2, 6 4, 8 4, 9 1, 6 2 ), ( 7 3, 8 2, 8 3, 7 3 )), (( 9 2, 8 5, 10 4, 10 3, 9 2 )))

  25. 2.1 - Exercises • Time for some exercises!

  26. 2.3 - Geometry Validity • PostGIS is compliant with the Open Geospatial Consortium’s (OGC) OpenGIS Specifications • Most functions require / assume geometries are valid and in many cases, simple. • Geometry validity really only applies for areal geometries • Geometry simplicity applies to point and linear geometies

  27. 2.3 - Geometry Validity • A POINT is inherently simple as a 0-dimentional geometry object. • A MULTIPOINT is simple if no two POINTs are the same.

  28. 2.3 - Geometry Validity • By definition, a LINESTRING is always valid • It is simple if it does not pass through the same point twice. SIMPLE NOT SIMPLE SIMPLE NOT SIMPLE

  29. 2.3 - Geometry Validity • MULTILINESTRINGs are simple if all its elements are simple and they only intersect at boundary points. NOT SIMPLE SIMPLE SIMPLE

  30. 2.3 - Geometry Validity • By definition, a POLYGON is always simple. • It is valid if • The boundary is made up of simpleLINEARRINGs • boundary rings don’t cross • holes are completely within the outer ring and touch the outer ring at most one point. • it does not contain cutlines / spikes

  31. 2.3 - Geometry Validity • These POLYGONs are … valid invalid invalid invalid valid invalid

  32. 2.3 - Geometry Validity • By definition, a MULTIPOLYGON is valid iff • All elements are valid • Element interiors cannot intersect • Element boundaries can touch, but only at a finite number of POINTs.

  33. 2.3 - Geometry Validity • These MULTIPOLYGONs are … invalid invalid valid

  34. 3.1 – PostgreSQL Installation • Windows Installer • PostgreSQL 8.4.4 • Automatically installs itself as a Windows Service • PgAdmin III • Psql Interactive SQL Shell

  35. 3.1 – PostgreSQL Installation

  36. 3.1 – PostgreSQL Installation

  37. 3.1 – PostgreSQL Installation

  38. 3.1 – PostgreSQL Installation

  39. 3.1 – PostgreSQL Installation

  40. 3.1 – PostgreSQL Installation

  41. 3.1 – PostgreSQL Installation

  42. 3.1 – PostgreSQL Installation

  43. 3.1 – PostgreSQL Installation • Directories created during installation: • \bin - Executables • \include - Include files for compilation • \lib - DLL shared library files • \share - Extensions

  44. 3.1 – PostgreSQL Installation • Tools included with the install: • PgAdmin III • psql Command Line

  45. 2.1 – PostgreSQL Installation

  46. 3.1 – PostgreSQL Installation

  47. 3.1 – PostgreSQL Installation • Under Linux http://www.postgresql.org/docs/8.4/static/installation.html • ./configure • gmake • su • gmake install • adduser postgres • mkdir /usr/local/pgsql/data • chown postgres /usr/local/pgsql/data • su - postgres • /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data • /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 & • /usr/local/pgsql/bin/createdb dbname • /usr/local/pgsql/bin/psql dbname

  48. 3.2 – PostGIS Installation • As of PostgreSQL 8.3, an Application Stack Builder is used to obtain the latest installers for desired modules. • Demonstrate Installation …

More Related