OpenSource GIS 2004 Ottawa, Canada Building MapServer Applications with PostGIS Chris Hodgson & Paul Ramsey Refractions Research.

Slides:



Advertisements
Similar presentations
A Roadmap of Open Source components for GI Web Services and Clients A Paul R Cooper MAGIC.
Advertisements

GIS in the Internet - architectures, standards and OpenSource Team SPADE – Spatial Decision Support.
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
The Relational Model and Relational Algebra Nothing is so practical as a good theory Kurt Lewin, 1945.
Foundations of Relational Implementation n Defining Relational Data n Relational Data Manipulation n Relational Algebra.
Mapserver The PSU Experience David Percy Geospatial Data Manager, Geology Department William Garrick Manager of Academic and Research Computing Portland.
Building an online tool for spatial joins using open source software Karsten Vennemann Seattle.
GI Systems and Science January 30, Points to Cover  Recap of what we covered so far  A concept of database Database Management System (DBMS) 
ArcGIS Geodatabase Miles Logsdon Spatial Information Technologies, UW Garry Trudeau - Doonesbury.
CS 128/ES Lecture 6a1 Attribute Data CampusIDNameTypeFloorsFootprint 6MurphyAcademic HopkinsSupport MaintenanceSupport HickeySupport22367.
Geographic Information Systems
OpenSource GIS 2004 Ottawa, Canada Introduction to PostGIS PostGIS Basics for the New User Paul Ramsey & Chris Hodgson Refractions.
Mapserver The Oregon Experience David Percy Geospatial Data Manager, Geology Department Portland State University Digital Mapping Techniques, 2006 Conference.
Attribute databases. GIS Definition Diagram Output Query Results.
PHP Scripting Language. Introduction “PHP” is an acronym for “PHP: Hypertext Preprocessor.” It is an interpreted, server-side scripting language. Originally.
Introduction to GIS fGRG360G – Summer Geographic Information System Text Computer system GIS software Brainware Infrastructure Ray Hardware Software.
Open Source Databases and GIS
Benjamin Post Cole Kelleher. Encyclopedia Articles: PostGIS, C. Strobl, pp Oracle Spatial, Geometries, R. Kothuri and S. Ravada, page
Introducing FDO Toolbox Jackie Ng. Presentation Overview What is FDO? What is FDO Toolbox? Major Features of FDO Toolbox Demos.
WORKSHOP PLANS ULANBEK TURDUKULOV ITC. 18/1019/1020/1021/1022/10 Introduction WMS MS4W PostgreSQL training Maintaining PostgreSQL/P ostGIS DB Using PostGIS.
Introduction to Open Source GIS, GeoTec 2005
GIS technologies and Web Mapping Services
Attribute Data in GIS Data in GIS are stored as features AND tabular info Tabular information can be associated with features OR Tabular data may NOT be.
SQL and SSQL IT4GIS Keith T. Weber, GISP GIS Director, ISU.
Using PostGIS and MapServer in the Census Interaction Data Service Presentation to AGI Technical SIG 'Open-Source in GIS' British Antarctic Survey, Cambridge,
David Blasby The Open Planning Project New York. Goals Explain what a WFS and WMS are, and when to use them Be able to create simple spatial web applications.
The OpenGIS Consortium Geog 516 Presentation #2 Rueben Schulz March 2004.
 WFS for fun and profit Paul Handcock Julian Parker.
SQLite Cole Hoosier Overview  RDBMS –Relational database management system  ACID Compliant –Atomicity, consistency, isolation, durability.
Computer Science 101 Database Concepts. Database Collection of related data Models real world “universe” Reflects changes Specific purposes and audience.
SQL Queries Relational database and SQL MySQL LAMP SQL queries A MySQL Tutorial and applications Database Building Assignment.
The FalconView Geodata Overlay
Open Source GIS Web Mapping Solutions Sachindra Singh ICT Systems Developer 2010 Pacific Islands Geographical Information Systems and Remote Sensing User.
Implementing Web GIS Solutions using open source software Karsten Vennemann Seattle.
The Open Source Spatial Services Kit: Lowering the Cost of Deploying Services on the Geo-Web Presented by Ben Lewis Advanced Technology Solutions, Inc.
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.
AMS 2003: IIPS, GIS APPLICATIONS 6.4 Iowa Environmental Mesonethttp://mesonet.agron.iastate.edu Using GIS for Environmental Data in Iowa Dr Dennis Todey.
Chapter 4 Multiple-Table Queries
Exploring Spatial Data Infrastructure in an Open Source World Jacqueline Lowe UNC-Asheville National Environmental Modeling and Analysis Center Jacqueline.
PostGIS and Spatial Queries Steve Signell, Instructor Robert Poirier, TA School of Science Rensselaer Polytechnic Institute.
A GeoSpatial Mapping Architecture
Map overlays & Geoprocessing Learn about spatial analysis functions overlays, clipping & buffering Use overlays to analyze multiple spatial criteria Understand.
Spatial Database Tips & Tricks Paul Ramsey
Chapter 9 Databases Objectives Understand a DBMS and define its components. Understand the architecture of a DBMS and its levels. Distinguish between.
Nhóm thực hiện: nhóm 1 Nguyễn Ngọc Trường Trần Minh Khang Bùi Quốc Huy Nguyễn Ngọc Linh Nguyễn Thành Phương Trần.
Introduction to GIS GIS/CAD5.
CD Collection Hector Urtubia Fall Summary Motivation and Objective Technologies Used Project Design Database Design and Integration Demo.
CS453: Databases and State in Web Applications (Part 2) Prof. Tom Horton.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Geographic Data in GIS. Components of geographic data Three general components to geographic information Three general components to geographic information.
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.
What is PostGIS? Spatial DataBlade for Postgresql Store, Query, and Manipulate Spatial data objects as first-class citizens in the Database. Follows the.
W W W. R E F R A C T I O N S. N E T Chris Hodgson –Spatial object models using PostGIS, Hibernate, and the JTS Topology Suite.
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 6 CGI/Perl and databases.
The Finnish ‘DigiRoad’ Dataset in EuroRoadS Schema Lassi Lehto Finnish Geodetic Institute.
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?
An open source spatial database schema and interface for the storage, representation and analysis of interdependent infrastructure networks Mr David Alderson.
IFS180 Intro. to Data Management Chapter 10 - Unions.
Python DB Examples of heavy database usage using Python Comparison of JDBC and Python DB Gadfly SQLObject.
Key Terms Attribute join Target table Join table Spatial join.
Geographic Information Systems
Relational Algebra Chapter 4, Part A
Database.
Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
ISU-GIS Training and Research Center
Relational Algebra Chapter 4, Sections 4.1 – 4.2
Spatial Databases SpatiaLite & PostGIS.
Data Access Layer (Con’t) (Overview)
Presentation transcript:

OpenSource GIS 2004 Ottawa, Canada Building MapServer Applications with PostGIS Chris Hodgson & Paul Ramsey Refractions Research

OpenSource GIS 2004 Ottawa, Canada Spatial Objects for PostgreSQL Store, Query, and Manipulate Spatial data objects as first-class citizens in the Database Follows the OGC Simple Features for SQL specification What is PostGIS?

OpenSource GIS 2004 Ottawa, Canada Why Use PostGIS? Fast Application Development –SQL Interface –Spatial and attribute query engine –Run functions like relate() and intersect() INSIDE the database –Leverage existing DB infrastructure –Already lots of interfaces to PostGIS

OpenSource GIS 2004 Ottawa, Canada Extension of existing Interfaces –SQL –ODBC –JDBC –Other language bindings (i.e. python, perl, php, C, C++, java,…) –WMS –WFS –Mapserver –OGR –FME –Geotools/GeoServer –PostGRASS –Lots of other Why Use PostGIS

OpenSource GIS 2004 Ottawa, Canada Why Use PostGIS? DB Goodies (things a shapefile can’t do) –Concurrent updates –Backup/recovery –Real transactions –Triggers/validation –Attach to existing information –SQL interface

OpenSource GIS 2004 Ottawa, Canada An SQL Join Joining Attribute Data to Geometry Data

Joining two tables Table with Geometry Table with Geometry and Attributes

SELECT * FROM roads LEFT JOIN roads_attr ON roads.gid = roads_attr.gid; For each gid in roads Find the corresponding gid in road_attr Combine the columns from the two tables SELECT * FROM roads, road_attr WHERE roads.gid = road_attr.gid;

OpenSource GIS 2004 Ottawa, Canada Label Uncluttering A MapServer/PostGIS Trick

Label Uncluttering

Basic idea is to group all the independent segments together. This forces MapServer to put at most one label per road, instead of one label for every segment.

OpenSource GIS 2004 Ottawa, Canada What do we do with these groups? 1. Use the GEOS union() function to construct a single line 2. Use collect() which takes a set of lines and produces a MULTILINE.

OpenSource GIS 2004 Ottawa, Canada SELECT street, collect(the_geom) FROM roads GROUP BY street;

MULTILINESTRING ( ( , , ), ( , ), ( , ), ( , , ) ) MULTILINESTRING ( ( , ), ( , ), ( , ), ( , ), ( , ) )

OpenSource GIS 2004 Ottawa, Canada

A Spatial Function “How Far is the Nearest Hospital?”

OpenSource GIS 2004 Ottawa, Canada

SELECT * FROM hospitals, roads;

OpenSource GIS 2004 Ottawa, Canada SELECT distance(hospitals.the_geom,roads.the_geom) FROM hospitals, roads;

OpenSource GIS 2004 Ottawa, Canada The groups are defined by gid, street.

SELECT road.gid, road.street, min(distance(hospitals.the_geom,r.the_geom)) as min_distance FROM roads,hospitals GROUP BY road.gid, street;

OpenSource GIS 2004 Ottawa, Canada