OpenSource GIS 2004 Ottawa, Canada www.refractions.net Introduction to PostGIS PostGIS Basics for the New User Paul Ramsey & Chris Hodgson Refractions.

Slides:



Advertisements
Similar presentations
The Role of Error Map and attribute data errors are the data producer's responsibility, GIS user must understand error. Accuracy and precision of map and.
Advertisements

INTRODUCTION TO POSTGIS ULANBEK TURDUKULOV. Spatial Objects for PostgreSQL  Adds support for geographic objects to the PostgreSQL object-relational database.
Introduction to Databases
Building an online tool for spatial joins using open source software Karsten Vennemann Seattle.
ORACLE Lecture 1: Oracle 11g Introduction & Installation.
ArcGIS Geodatabase Miles Logsdon Spatial Information Technologies, UW Garry Trudeau - Doonesbury.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
GGF Toronto Spitfire A Relational DB Service for the Grid Peter Z. Kunszt European DataGrid Data Management CERN Database Group.
OpenSource GIS 2004 Ottawa, Canada Building MapServer Applications with PostGIS Chris Hodgson & Paul Ramsey Refractions Research.
P2-S1 MySQL 2003 SJSU -- CmpE-- M.E. Fayad Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering.
TECNOLOGIAS DE ARMAZENAMENTO DE INFORMAÇÃO ESPACIAL.
What is Where? u Getting Started With Geographic Information Systems u Chapter 5.
Geographic Information Systems and Science SECOND EDITION Paul A. Longley, Michael F. Goodchild, David J. Maguire, David W. Rhind © 2005 John Wiley and.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
Open Source Databases and GIS
Conceptual Architecture of PostgreSQL
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
1 of 6 Microsoft ® Business Solutions–Navision ® Development I – C/SIDE Introduction Day 4.
SQL Server ® 2008 ® Native Client. Agenda  Introduction to SQL Server Native Client  Building High-Performance Data Access Solutions  Going Beyond.
Confidential ODBC May 7, Features What is ODBC? Why Create an ODBC Driver for Rochade? How do we Expose Rochade as Relational Transformation.
Overview of Database Access in.Net Josh Bowen CIS 764-FS2008.
Introducing FDO Toolbox Jackie Ng. Presentation Overview What is FDO? What is FDO Toolbox? Major Features of FDO Toolbox Demos.
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
Object Oriented Databases by Adam Stevenson. Object Databases Became commercially popular in mid 1990’s Became commercially popular in mid 1990’s You.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
1 Introduction to web mapping Dissemination of results, maps and figures ESTP course on Geographic Information Systems (GIS): Use of GIS for making statistics.
Lecture 4 Data. Why GIS? Ask questions Solve a problem Support a decision Make Maps Involve others, share data, procedures, ideas.
Introduction to Open Source GIS, GeoTec 2005
Week 7 Lecture Web Database Development Samuel Conn, Asst. Professor
“Codd’s Rules for Spatial ORDBMS”
Introduction to PostGIS
1188 New developments in InterBase since Year 2000 Sriram Balasubramanian Staff Engineer Borland Software Corporation.
Shaowen Wang CyberInfrastructure and Geospatial Information Laboratory (CIGI) Department of Geography and National Center for Supercomputing Applications.
Learningcomputer.com SQL Server 2008 Configuration Manager.
MySQL. Dept. of Computing Science, University of Aberdeen2 In this lecture you will learn The main subsystems in MySQL architecture The different storage.
OpenSource GIS 2004 Ottawa, Canada A Survey of Open Source GIS “The View from 30,000 Feet” or “A Mile Wide and an Inch Deep” Paul Ramsey.
Chapter 6 PHP Interacts with Mysql Database. Introduction In PHP, there is no consolidated interface. Instead, a set of library functions are provided.
CVSQL 2 The Revenge of the SQL. The present Read-only access to CVS repository logs Language is a subset of SQL XML interface for returning results Built-in.
Information Technology Exchange Meeting A New Decade in Support of Science Silence is Golden…. This is an atmosphere for learning - so please make EVERY.
Windows PostgreSQL installation. Pre-requisites Define a local non-administrative Windows account (eg. postgres) Must install on Console, not through.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
Creating and Maintaining Geographic Databases. Outline Definitions Characteristics of DBMS Types of database Relational model SQL Spatial databases.
Spatial Database Tips & Tricks Paul Ramsey
Spatial Databases: Lecture 1 DT211-4 DT228-4 DT249-4 Semester Pat Browne
Intro to GIS | Summer 2012 Attribute Tables – Part 1.
Benjamin Post Cole Kelleher.  Availability  Data must maintain a specified level of availability to the users  Performance  Database requests must.
Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application.
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
1 Chapter Overview What is Microsoft SQL Server 2000? What are the SQL Server 2000 Components? What is the Relational Database Architecture? What is the.
Module 1 Introduction to SQL Server® 2008 R2 and its Toolset.
What is PostGIS? Spatial DataBlade for Postgresql Store, Query, and Manipulate Spatial data objects as first-class citizens in the Database. Follows the.
Lecture 10 Creating and Maintaining Geographic Databases Longley et al., Ch. 10, through section 10.4.
Mining real world data RDBMS and SQL. Index RDBMS introduction SQL (Structured Query language)
Basics of JDBC Session 14.
GeoConnections Secretariat May 2000 NRCan/GeoConnections OGC activities Brian McLeod Canada Centre for Remote Sensing.
What is PostgreSQL? Object-relational database management system (ORDBMS) Based on POSTGRES at Berkeley Computer Science Department. Sponsored by the Defense.
W W W. R E F R A C T I O N S. N E T PostGIS Case Studies What is it, who is using it, and why?
Retele de senzori Curs 1 - 1st edition UNIVERSITATEA „ TRANSILVANIA ” DIN BRAŞOV FACULTATEA DE INGINERIE ELECTRICĂ ŞI ŞTIINŢA CALCULATOARELOR.
The GUCS: A Three-Hour Tour. What are GUCS? # “Grand Unified Configuration Settings” – A large set of global and session database settings which live.
The GUCS: A Three-Hour Tour. What are GUCS? # “Grand Unified Configuration Settings” – A large set of global and session database settings which live.
DEPTT. OF COMP. SC & APPLICATIONS
Module 1: SQL Server Overview
SQL Server 2000 and Access 2000 limits
PostgreSQL Database and C++ Interface (and Midterm Topics)
Database.
Tiers vs. Layers.
Conceptual Architecture of PostgreSQL
Building an online tool for spatial joins using open source software
Module 10: Implementing Managed Code in the Database
JTLS-GO 6.0 PostgreSQL Information
Presentation transcript:

OpenSource GIS 2004 Ottawa, Canada Introduction to PostGIS PostGIS Basics for the New User Paul Ramsey & Chris Hodgson Refractions Research

OpenSource GIS 2004 Ottawa, Canada PostgreSQL 1986 : Postgres project at Berkley –Successor to Ingres –Relational Model –Complex Objects –Extensibility 1995 : Postgres95 adds SQL Support 1996 : Open Source Community

OpenSource GIS 2004 Ottawa, Canada PostGIS PostgreSQL 7.1 (Tuple Toaster) Real GIS Support First Release in 2001 OpenGIS “Simple Features for SQL” Current Release 0.8.2

OpenSource GIS 2004 Ottawa, Canada Why PostGIS? Because Databases are Better than Files! Unified Storage, Management, Access –SQL Everywhere Transactional Integrity –Multiple Users, Multiple Edits

OpenSource GIS 2004 Ottawa, Canada PostGIS Users Data Handlers Unified Access Language (SQL) Unified Metadata Location –GlobeXplorer –i-cubed –Refractions

OpenSource GIS 2004 Ottawa, Canada PostGIS Users Real Time Systems Developers Unified Access Language (SQL) Standard Access Protocols –JDBC –ODBC

OpenSource GIS 2004 Ottawa, Canada Team CIMAR : DARPA Grand Challenge

OpenSource GIS 2004 Ottawa, Canada PostGIS Users Spatial Infrastructures LAN WMS / WFS PostGIS Internet JUMP QGIS WFS Client WMS Client

OpenSource GIS 2004 Ottawa, Canada PostgreSQL Version 7.5 Native Windows Support

OpenSource GIS 2004 Ottawa, Canada Windows PostgreSQL \bin Executables \include Include files for compilation \lib DLL shared library files \share Extensions env.bat Command prompt initdb.bat Initialize \data area pgstart.bat Start the database server

OpenSource GIS 2004 Ottawa, Canada Create a Database createdb postgis –Make the database psql postgis –Connect to the database create, insert, select –Try the database

OpenSource GIS 2004 Ottawa, Canada Load PostGIS PostgreSQL Extension –libpostgis.so –postgis.sql Requires PL/PgSQL createlang plpgsql postgis psql -f postgis.sql postgis psql -f spatial_ref_sys.sql postgis

OpenSource GIS 2004 Ottawa, Canada Simple Spatial SQL POINT(5 5) POINT(5 0) POINT(0 5) POINT(0 0)

OpenSource GIS 2004 Ottawa, Canada Load Shape Files select count(*) from bc_roads select count(*) from bc_voting_areas

OpenSource GIS 2004 Ottawa, Canada bc_pubs

OpenSource GIS 2004 Ottawa, Canada bc_roads

OpenSource GIS 2004 Ottawa, Canada bc_hospitals

OpenSource GIS 2004 Ottawa, Canada bc_municipality

OpenSource GIS 2004 Ottawa, Canada bc_voting_areas

OpenSource GIS 2004 Ottawa, Canada bc_voting_areas

OpenSource GIS 2004 Ottawa, Canada Creating Spatial Indexes

OpenSource GIS 2004 Ottawa, Canada Using Spatial Indexes select gid, name from bc_roads where crosses( the_geom, GeomFromText(‘LINESTRING(…)’,42102) ) select gid, name from bc_roads where crosses( the_geom, GeomFromText(‘LINESTRING(…)’,42102) ) and the_geom && GeomFromText(‘LINESTRING(…)’,42102)

OpenSource GIS 2004 Ottawa, Canada Query Plans

OpenSource GIS 2004 Ottawa, Canada # # CONNECTIONS AND AUTHENTICATION # # - Connection Settings - #listen_addresses = 'localhost'# what IP interface(s) to listen on; # defaults to localhost, '*' = any #port = 5432 max_connections = 100 #superuser_reserved_connections = 2 #rendezvous_name = ''# defaults to the computer name # - Security & Authentication - #authentication_timeout = 60# 1-600, in seconds #ssl = false #password_encryption = true #db_user_namespace = false # # RESOURCE USAGE (except WAL) # # - Memory - shared_buffers = 1000# min 16, at least max_connections*2, 8KB each #work_mem = 1024# min 64, size in KB #maintenance_work_mem = 16384# min 1024, size in KB #max_stack_depth = 2048# min 100, size in KB #vacuum_cost_page_hit = 1# credits #vacuum_cost_page_miss = 10# credits PostgreSQL Optimization

OpenSource GIS 2004 Ottawa, Canada Data Integrity ValidInvalid

OpenSource GIS 2004 Ottawa, Canada Distance Queries select sum(upbc) as unity_voters from bc_voting_areas where the_geom && setsrid( expand(‘POINT(…)’::geometry,2000) ) and distance( the_geom, geomfromtext(‘POINT(…)’, 42102) ) < 2000;

OpenSource GIS 2004 Ottawa, Canada Spatial Joins Associate two tables based on a spatial relationship, rather than an attribute relationship.

OpenSource GIS 2004 Ottawa, Canada select m.name, sum(v.ndp) as ndp, sum(v.lib) as liberal, sum(v.gp) as green, sum(v.upbc) as unity, sum(v.vtotal) as total from bc_voting_areas v, bc_municipality m, where v.the_geom && m.the_geom and intersects(v.the_geom, m.the_geom) group by m.name order by m.name;

OpenSource GIS 2004 Ottawa, Canada Overlays Table on table overlays are possible with the Intersection() function. Our example will only overlay one polygon with another table.

OpenSource GIS 2004 Ottawa, Canada create table pg_voting_areas as select intersection(v.the_geom, m.the_geom) as intersection_geom, area(v.the_geom) as va_area, v.*, m.name from bc_voting_areas v, bc_municipality m where v.the_geom && m.the_geom and intersects(v.the_geom, m.the_geom) and m.name = ‘PRINCE GEORGE’;

OpenSource GIS 2004 Ottawa, Canada Coordinate Projection SRID=42102;MULTILINESTRING(( , )) SRID=4326;MULTILINESTRING(( , ))

OpenSource GIS 2004 Ottawa, Canada Exercises & Questions