SlideShare a Scribd company logo
Building Location Aware Apps -
   Get Started with PostGIS

            PART I

          Lasma Sietinsone
       l.sietinsone@ed.ac.uk
Slides




  http://gismatic.com/dev8d/docs/
Who am I?

• Work for EDINA, University of Edinburgh
• GIS Technician & Database Engineer
• Manage UK data for online maps & services
  (approaching terabytes of data!)
• Provide geo-support for spatially enabled
  apps
My Aim?
• Stimulate your creative thinking!
• Give you an ability to integrate spatial technologies
  in your own stuff!

    Space is a natural join between otherwise
            seemingly unrelated things!

• Save you hours/days of faffing around on your own!
• Give you a kick for accelerated
learning of new technology!

           Hands-on!
      I MUST get you rolling
         independently!
Who are you?

• Who attended prep-workshop?
• Experience of audience:
  – SQL?
  – RDBMS?
  – OS?

• This demo requires:
  – SQL – basic knowledge (SELECT, UPDATE,
    DELETE) – check your cheat-sheet!
  – RDBMS – none
  – Windows but Mac OS, Linux will do too
Contents
1. Pre-workshop (Install and configure
   PostgreSQL 9.1 with PostGIS 1.5)


2. Some background (~15 mins)
3. Practical (1hr & 15 minutes):
  •   Import some data
  •   Use some PostGIS functions
  •   View data externally
  •   Demo with OpenStreetMap data to perform
      location based queries
4. Questions and answers (~15 mins)
What is PostgreSQL?

            • Proper object-relational
              database management system
            • Massive OS project
            • Super advanced
            • Fast!
            • Standard compliant
            • Well documented
            • Global user community
Advantages of a DBMS

• Data Independence from application
  programs
• Efficient Data Access
• Data Integrity and Security
• Centralized Data Administration
• Concurrent Access and Crash Recovery
• Reduced Application Development Time
  – common data access functions
PostGIS what?

PostGIS is a spatial extension to the
    PostgreSQL object-relational
 database that supports work with
          geographic data
PostGIS extension provides

• Geometry/geography data types for
  points, linestrings, polygons, curves,
  geometry collections, 3D geometries

• Use geometry to store object:
                 (A) shape
                 (B) centroid
                 (C) bounding box
PostGIS extension provides (cont.)

 • Spatial operators such as contains @,
   overlaps, intersects &&, same as =, is
   to the left/right/below/above

 • Loads of spatial functions
Spatial functions

 • Constructors
   e.g. ST_GeomFromText(), ST_MakePoint(),
     ST_MakePolygon
 • Output
   e.g. ST_AsGML(), ST_AsGeoJSON(), ST_AsBinary()
 • Accessors: getters and setters
   e.g. ST_Transform(), ST_GeometryType(),
     ST_IsValid(), ST_NPoints(), ST_SetDRID()
 • Measurement
   e.g. ST_Distance_Sphere(), ST_Length_2D(),
     ST_Perimeter(), ST_Azimuth()
Spatial functions (continued)

• Decomposition
  e.g. ST_Centroid(), ST_Box2D(), ST_Boundary(),
    ST_GeometryN(), ST_DumpRings()
• Composition
  e.g. ST_MakePoint(), ST_MakePolygon(),
    ST_BuildArea(), ST_Polygonize()
• Simplification
  e.g. ST_Simplify(), ST_SimplifyPreserveTopology(),
    ST_SnapToGrid()
Common workflow

1. Load/populate table
2. Add geometry column with certain
   dimensions and spatial reference
   system (SRS/SRID)
3. [Register geometry column in
   geometry_columns table]
4. Optimise performance by:
  – Creating spatial index
  – Clustering data based on spatial index
Common workflow (continued)

5. View/Edit/Query data with:
  – desktop GIS, e.g. QGIS, OpenJUMP,
    GRASS etc.
  – Web map servers, e.g. GeoServer,
    MapServer, Deegree etc.
  – Custom applications communicating via
    database connectors such as JDBC
Use online references

PostgreSQL docs *****
 http://www.postgresql.org/docs/9.0/interacti
 ve/index.html

PostGIS docs *****
 http://www.postgis.org/docs/

More Related Content

PDF
Foss4 g 2017-kansai-ryoo-kim
PPT
PPTX
Creating A Multi-wavelength Galactic Plane Atlas With Amazon Web Services
PPTX
Defination of gis and components of arc gis
PPTX
Introduction to GIS
PPTX
Database testing in postgresql query
PDF
Building Location Aware Apps - Get Started with PostGIS, PART II
Foss4 g 2017-kansai-ryoo-kim
Creating A Multi-wavelength Galactic Plane Atlas With Amazon Web Services
Defination of gis and components of arc gis
Introduction to GIS
Database testing in postgresql query
Building Location Aware Apps - Get Started with PostGIS, PART II

Similar to Pg intro part1-theory_slides (20)

PDF
Getting Started with PostGIS
 
PDF
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial World
PPTX
FOSS4G 2017 Spatial Sql for Rookies
PPT
Building a Spatial Database in PostgreSQL
PDF
Discover PostGIS: Add Spatial functions to PostgreSQL
 
PPTX
Why is postgis awesome?
PDF
Building A Spatial Database In Postgresql (Ppt).pdf
PPTX
PostGIS and Spatial SQL
PDF
Post gispguk
PPT
Getting started with PostGIS geographic database
PPT
Getting Started with PostGIS geographic database - Lasma Sietinsone, EDINA
PDF
Leicester 2010 notes
PPT
Building a Spatial Database in PostgreSQL
PDF
Postgres Vision 2018: PostGIS and Spatial Extensions
 
PDF
Managing GeoData with PostGIS @ KhmelnytskyiPy #1
PDF
Osgis 2010 notes
PPTX
Day 6 - PostGIS
PDF
Comparing Geospatial Implementation in MongoDB, Postgres, and Elastic
ODP
Intro To PostGIS
PDF
Postgis for Enterprise
Getting Started with PostGIS
 
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial World
FOSS4G 2017 Spatial Sql for Rookies
Building a Spatial Database in PostgreSQL
Discover PostGIS: Add Spatial functions to PostgreSQL
 
Why is postgis awesome?
Building A Spatial Database In Postgresql (Ppt).pdf
PostGIS and Spatial SQL
Post gispguk
Getting started with PostGIS geographic database
Getting Started with PostGIS geographic database - Lasma Sietinsone, EDINA
Leicester 2010 notes
Building a Spatial Database in PostgreSQL
Postgres Vision 2018: PostGIS and Spatial Extensions
 
Managing GeoData with PostGIS @ KhmelnytskyiPy #1
Osgis 2010 notes
Day 6 - PostGIS
Comparing Geospatial Implementation in MongoDB, Postgres, and Elastic
Intro To PostGIS
Postgis for Enterprise
Ad

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Sensors and Actuators in IoT Systems using pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Spectroscopy.pptx food analysis technology
PDF
KodekX | Application Modernization Development
PPTX
MYSQL Presentation for SQL database connectivity
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Modernizing your data center with Dell and AMD
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Dropbox Q2 2025 Financial Results & Investor Presentation
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Sensors and Actuators in IoT Systems using pdf
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Spectroscopy.pptx food analysis technology
KodekX | Application Modernization Development
MYSQL Presentation for SQL database connectivity
GamePlan Trading System Review: Professional Trader's Honest Take
Modernizing your data center with Dell and AMD
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Ad

Pg intro part1-theory_slides

  • 1. Building Location Aware Apps - Get Started with PostGIS PART I Lasma Sietinsone [email protected]
  • 3. Who am I? • Work for EDINA, University of Edinburgh • GIS Technician & Database Engineer • Manage UK data for online maps & services (approaching terabytes of data!) • Provide geo-support for spatially enabled apps
  • 4. My Aim? • Stimulate your creative thinking! • Give you an ability to integrate spatial technologies in your own stuff! Space is a natural join between otherwise seemingly unrelated things! • Save you hours/days of faffing around on your own! • Give you a kick for accelerated learning of new technology! Hands-on! I MUST get you rolling independently!
  • 5. Who are you? • Who attended prep-workshop? • Experience of audience: – SQL? – RDBMS? – OS? • This demo requires: – SQL – basic knowledge (SELECT, UPDATE, DELETE) – check your cheat-sheet! – RDBMS – none – Windows but Mac OS, Linux will do too
  • 6. Contents 1. Pre-workshop (Install and configure PostgreSQL 9.1 with PostGIS 1.5) 2. Some background (~15 mins) 3. Practical (1hr & 15 minutes): • Import some data • Use some PostGIS functions • View data externally • Demo with OpenStreetMap data to perform location based queries 4. Questions and answers (~15 mins)
  • 7. What is PostgreSQL? • Proper object-relational database management system • Massive OS project • Super advanced • Fast! • Standard compliant • Well documented • Global user community
  • 8. Advantages of a DBMS • Data Independence from application programs • Efficient Data Access • Data Integrity and Security • Centralized Data Administration • Concurrent Access and Crash Recovery • Reduced Application Development Time – common data access functions
  • 9. PostGIS what? PostGIS is a spatial extension to the PostgreSQL object-relational database that supports work with geographic data
  • 10. PostGIS extension provides • Geometry/geography data types for points, linestrings, polygons, curves, geometry collections, 3D geometries • Use geometry to store object: (A) shape (B) centroid (C) bounding box
  • 11. PostGIS extension provides (cont.) • Spatial operators such as contains @, overlaps, intersects &&, same as =, is to the left/right/below/above • Loads of spatial functions
  • 12. Spatial functions • Constructors e.g. ST_GeomFromText(), ST_MakePoint(), ST_MakePolygon • Output e.g. ST_AsGML(), ST_AsGeoJSON(), ST_AsBinary() • Accessors: getters and setters e.g. ST_Transform(), ST_GeometryType(), ST_IsValid(), ST_NPoints(), ST_SetDRID() • Measurement e.g. ST_Distance_Sphere(), ST_Length_2D(), ST_Perimeter(), ST_Azimuth()
  • 13. Spatial functions (continued) • Decomposition e.g. ST_Centroid(), ST_Box2D(), ST_Boundary(), ST_GeometryN(), ST_DumpRings() • Composition e.g. ST_MakePoint(), ST_MakePolygon(), ST_BuildArea(), ST_Polygonize() • Simplification e.g. ST_Simplify(), ST_SimplifyPreserveTopology(), ST_SnapToGrid()
  • 14. Common workflow 1. Load/populate table 2. Add geometry column with certain dimensions and spatial reference system (SRS/SRID) 3. [Register geometry column in geometry_columns table] 4. Optimise performance by: – Creating spatial index – Clustering data based on spatial index
  • 15. Common workflow (continued) 5. View/Edit/Query data with: – desktop GIS, e.g. QGIS, OpenJUMP, GRASS etc. – Web map servers, e.g. GeoServer, MapServer, Deegree etc. – Custom applications communicating via database connectors such as JDBC
  • 16. Use online references PostgreSQL docs ***** http://www.postgresql.org/docs/9.0/interacti ve/index.html PostGIS docs ***** http://www.postgis.org/docs/