Intro to PostGIS. .org G EO E XT { G EO S ERVER G EO W EB C ACHE P OST GIS

Similar documents
The State of PostGIS. .org G EO E XT { G EO S ERVER G EO W EB C ACHE P OST GIS

Cross Comparison of Spatially Enabled Databases: PostGIS, SQL Server and JASPA

Karsten Vennemann, Seattle. QGIS Workshop CUGOS Spring Fling 2015

Why GIS & Why Internet GIS?

ESRI Survey Summit August Clint Brown Director of ESRI Software Products

GeoPackage, das Shapefile der Zukunft

Innovation. The Push and Pull at ESRI. September Kevin Daugherty Cadastral/Land Records Industry Solutions Manager

EEOS 381 -Spatial Databases and GIS Applications

Geodatabase 101 Why, What, & How

SPATIAL INDEXING. Vaibhav Bajpai

The File Geodatabase API. Craig Gillgrass Lance Shipman

Introduction-Overview. Why use a GIS? What can a GIS do? Spatial (coordinate) data model Relational (tabular) data model

PostGIS knows where you are!

Free and Open Source Software for Cadastre and Land Registration : A Hidden Treasure? Gertrude Pieper Espada. Overview

OBEUS. (Object-Based Environment for Urban Simulation) Shareware Version. Itzhak Benenson 1,2, Slava Birfur 1, Vlad Kharbash 1

ArcGIS Enterprise: What s New. Philip Heede Shannon Kalisky Melanie Summers Shreyas Shinde

Working with the Geodatabase

Existing Open Source Tools and Possibilities for Cadastre Systems

ArcGIS. for Server. Understanding our World

YYT-C3002 Application Programming in Engineering GIS I. Anas Altartouri Otaniemi

Performing. Geospatial Analysis. Using Latitude and Longitude Data. Ginger Ni - Software Engineer

Technical Trends in Geo Information

ST-Links. SpatialKit. Version 3.0.x. For ArcMap. ArcMap Extension for Directly Connecting to Spatial Databases. ST-Links Corporation.

Among various open-source GIS programs, QGIS can be the best suitable option which can be used across partners for reasons outlined below.

Leveraging Your Geo-spatial Data Investments with Quantum GIS: an Open Source Geographic Information System

What s New. August 2013

October 2011 ArcGIS 10 for Server Functionality Matrix

Carson J. Q. Farmer National Centre for Geocomputation National University of Ireland Maynooth

Introduction to Geographic Information Systems

Questions and Answers

GIS Lecture 4: Data. GIS Tutorial, Third Edition GIS 1

Spatial Data Cooler Than You d Think. Hope Foley

Are You Maximizing The Value Of All Your Data?

Geodatabase An Introduction

Key Questions and Issues. What is GIS? GIS is to geographic analysis as: What is GIS? 9/3/2013. GEO 327G/386G, UT Austin 1

Hosted by Esri Official Distributor

Technical Specifications. Form of the standard

Bentley Map V8i (SELECTseries 3)

D2D SALES WITH SURVEY123, OP DASHBOARD, AND MICROSOFT SSAS

Esri Overview for Mentor Protégé Program:

POSITION DESCRIPTION. Position Title: Geographic Information Systems (GIS) Coordinator Department: Engineering

SRJC Applied Technology 54A Introduction to GIS

GIS Software. Evolution of GIS Software

Open Source Technologies and Remotely Sensed Data in Protecting Elephants. Rosemary Alles Dr. Justine Blanford Penn State World Campus July 2015

CS 350 A Computing Perspective on GIS

How to Pick a GIS. GIS Software Chapter 8 in Longley, Goodchild, Maguire, and Rhind,, 2001

Experiences and Directions in National Portals"

Beyond points: How to turn SMW into a complete Geographic Information System

Visualizing Big Data on Maps: Emerging Tools and Techniques. Ilir Bejleri, Sanjay Ranka

December 2009 ArcGIS Server Functionality Matrix

ArcGIS Enterprise: What s New. Philip Heede Shannon Kalisky Melanie Summers Sam Williamson

ArcGIS Platform For NSOs

Features and Benefits

Bentley Map Advancing GIS for the World s Infrastructure

An Enterprise Geodatabase: Montgomery County, Maryland ESRI 2004 User Conference Paper #1674

Cobb County GIS: Beyond the Map

DATA SOURCES AND INPUT IN GIS. By Prof. A. Balasubramanian Centre for Advanced Studies in Earth Science, University of Mysore, Mysore

Oracle s Spatial Technologies. Oracle Locator Oracle Spatial OracleAS MapViewer

Bentley Map Advancing GIS for the World s Infrastructure

gvsig: Open Source Solutions in spatial technologies

Steve Pietersen Office Telephone No

A Distributed GIS Architecture for Research in Baalbek Based on CISAR

8/27/2015 M. Helper, U. Texas, Austin

PostGIS Cookbook. open source I community experience distilled

Houston Plat Tracker puts the GIS in Land Development

Canadian Board of Examiners for Professional Surveyors Core Syllabus Item C 5: GEOSPATIAL INFORMATION SYSTEMS

Administering your Enterprise Geodatabase using Python. Jill Penney

Welcome to NR502 GIS Applications in Natural Resources. You can take this course for 1 or 2 credits. There is also an option for 3 credits.

The (new) GIS Toolkit:

The Challenge of Geospatial Big Data Analysis

Course Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface.

Infrastructure Industry Vertical Solutions and Beyond

Digital Map of Mexico Platform and MxSIG. March 2017

Application of GIS in Public Transportation Case-study: Almada, Portugal

Corporate. Information. Railway Infrastructure Administrator. Year indracompany.com

The Canadian Spatial Data Foundry

GEOGRAPHIC INFORMATION SYSTEMS AND IT SOLUTIONS FOR THE ENVIRONMENT

Geodatabase Essentials Part One - Intro to the Geodatabase. Jonathan Murphy Colin Zwicker

Oracle Spatial: Essentials

Popular Mechanics, 1954

Imagery and the Location-enabled Platform in State and Local Government

Geometric Algorithms in GIS

Introduction to ArcGIS Server Development

A Spatial Data Infrastructure for Landslides and Floods in Italy

Powerful Combination: GIS and Web Services

A Geographer s role in a Google Maps World. Jeremy Bartley ESRI

Robert D. Borchert GIS Technician

Introducing GIS analysis

SDI Standards at work

Overview of Geospatial Open Source Software which is Robust, Feature Rich and Standards Compliant

Paths Toward CAD and GIS Interoperability

GIS Geographical Information Systems

Development of Univ. of San Agustin Geographic Information System (USAGIS)

GIS at JLAB. T. Larrieu Jefferson Lab, Newport News, VA 23606, USA. Controls Group. October 2006 PCaPAC

Safe to Save? Archive Options for Geodatabases. Jeff Essic North Carolina State University Libraries

SpatialKit and SEXTANTE

Techniques for Science Teachers: Using GIS in Science Classrooms.

Geometric Algorithms in GIS

Lesson 16: Technology Trends and Research

Transcription:

Intro to PostGIS pramsey @.org G EO S ERVER G EO E XT { G EO W EB C ACHE P OST GIS Whole product Adding value w/ bundling, ease-of-use, integration testing, support for all components

Types Database string, float, date Spatial Database? Indexes b-tree, hash Functions strlen(string), pow(float, float), now() PostGIS is a spatial database, but what is a spatial database? database provides random access data storage system types, indexes, functions for STANDARD TYPES

Spatial Types geometry, geography Spatial Indexes Database Open Geospatial Consortium (OGC) r-tree, quad-tree, kd-tree Spatial Functions ST_Length(geometry), ST_X(geometry) Simple Features for SQL (SFSQL) spatial database provides random access data storage system SPATIAL types, SPATIAL indexes, SPATIAL functions spatial databases follow international standard SFSQL = Guideline for function names/behaviors PostGIS is certified compliant, has been through testing

ST_Intersects(a, b) ST_Distance(a, b) ST_Area(a) ST_Union(a, b) ST_Buffer(a, d) SFSQL standard defines and described relationships and operations between geometries like intersection, union, difference, symmetric difference and SFSQL defines standard function signatures for those operations you ll find these signatures, or close(ish) variants of them in all SFSQL databases

SpatiaLite spatial databases you re likely to run into are PostGIS, Oracle, SQL Server and SpatiaLite. Others include DB2 Spatial, Informix Spatial, Netezza, Teradata. Spatial functionality has gone from being a rarity to being a standard feature. Is MySQL a spatial database? Not yet. (Still) There are spatial types and a spatial index. The spatial types are defined in MyISAM tables only, no transactions The functions only work against bounding boxes. There are patches to add wider support for true geometry tests (http://forge.mysql.com/wiki/ GIS_Functions) but they have not been added to either the general releases (v5.1) or to the development releases (v5.5) thus far.

extends Is SDE a spatial database? No, it is spatial middleware. It sits on top of a database and interprets requests. Depending on the database it sits on top of, it might pass queries back to a native spatial database (Oracle, PostGIS, ST_Geometry) but SDE itself is not a spatial database. PostGIS is great spatial database, and it is build on top of a great standard database, PostgreSQL. The core database provides transaction management, disk storage routines, SQL processing and planning. PostGIS provides spatial types, functions and indexes

Open Source (BSD) Enterprise Database ACID, hot backup, replication, partitioning triggers, constraints, foreign keys, user functions PL/PGSQL, PL/Perl, PL/TCL, PL/Java, PL/R Corporate support Enterprise DB SRA What does PostGIS do? By building on PostgreSQL, we get these good things! That is interesting, but... what does it do? PostGIS answers questions that have a spatial component. It can answer questions on very large collections of spatial data, and against very complex data models.

What parcels are within 1km of this fire? SELECT owner_phone FROM parcels WHERE ST_DWithin( geom, POINT(), 1000 ); That sounds like a GIS question! How many lines of code should it take to solve it? One line! Using one spatial function, a coordinate, and a table of parcel data, we can generate a classic GIS alert list of people to phone about the fire.

How far did the bus travel last week? SELECT Sum(ST_Length(geom)) FROM vehicle_paths WHERE id = 12 AND date > Now() - 7d ; One SQL statement to answer a location services query.

How much land is there in each zoning category? SELECT category, Sum(ST_Area(geom)) FROM zoning GROUP BY category; We can use SQL to summarize our whole data set, with just one query! SQL in a database is very powerful, more powerful than desktop GIS in terms of amount of code required and the size of datasets than can be queried.

History! I didn t write PostGIS. I ve been a major developer since 2008. The first versions (0.1 to 0.7) were done by Dave Blasby on my left. I did the build system, documentation and Java components. This picture is actually a little too new, at the time of PostGIS 0.1 (around 2001) there were only 5 people in company.

Managing changing data in shape files is a pain in the! Table Date Geometry Haida 19991213 POLYGON() Haida 20000213 POLYGON() Haida 20000219 POLYGON() Carrier 20010412 POLYGON() Carrier 20010421 POLYGON() Klahoose 20011023 POLYGON() Klahoose 20011203 POLYGON() PostGIS was the answer to the question how are we going to manage this changing data?! We had a collection of areas of interest for treaty negotiations that were passed through modeling software. The negotiators would provide ever changing versions they wanted analyses on, so knowing what the history was, was important. <X> Database model could provide history, easy publication distribution, and automation of analysis runs. (That was the theory, in fact we never got around to using the database for this purpose.)

Database Advantages Query all areas at once Publish in one step Manage in one place History!!! That was the beginning, but there is more.

Type and index WKT WKB OGC standards PgSQL 7.2 Repr Regression tests Linemerge ISO SQL/MM Performance 0.1 0.5 0.6 0.7 1.1 1.2 2001 2002 2003 2006 2007 2008 Distance Point-inpolygon Index selectivity J LRS SRS performance Curves Stabilit Basic functionality all done in year one (2001). Mapserver! P-i-P! Started to implement SFSQL standards in 2002. Complete full SFSQL in 2004. Changed to a new binary format in 2005 and complete the transition and released 1.0 in 2006. 2006 and 2007 added more functions, both ISO standard ones and speciality ones like LineMerge and Polygonize. 2008 things stabilized and performance was the key focus 2009 more performance with prepared geometry and developer improvements like code reorganization 2010 and 1.5 added geography and GUI tools for loading

3D/4D Indexing Typemod for GEOMETRY Raster 2011 PolyhedralSurface 2.0 2012 2013 Topology More History!!! This year and most of last year has been about 2.0. Changing the binary format again, adding multi-dimensional indexes, rasters, topology, 3D objects and more. We re looking forward to XP, which will be the ultimate release, including a sentient interface. Which may lead to some problems with the Vista release, but we remain optimistic. More to history than just software features. PostGIS has gone from curiosity to industry standard.

2001 2002 2003 2004 O ArcGIS Server 2006 2007 2008 2009 FDO lots of proprietary companies at the end of this timeline!

Why are these companies supporting PostGIS? because it makes them money

We want PostGIS! GeoConcept and CadCorp both supported PostGIS because IGN (national mapping agency of France) wanted PostGIS-enabled tools. It gave them access to more business. Even the big three ESRI, MapInfo and InterGraph have come on board because their customers have been saying they want it.

Corporations Who is using PostGIS? And who are those customers? They are legion. On the private sector side, WSI also known as the Weather channel The New York Times, running PostGIS behind their Django instance. InfoTerra in the UK, managing all of Ordnance Survey in their PostGIS DigitalGlobe, managing their web-based image delivery SAIC, BAE, Ball Systems, all doing defence systems. RedFin and Zonar, startup companies,

Governments Institut Geographique National On the government side, National levels in France and Portugal and Canada Regional levels like MN, and Quebec Local levels like Pierce County, the City of St Paul, and many more and quasi-governmental outfits like NREL and NavCanada all use PostGIS. So, I mentioned (twice) that IGN is using PostGIS...what is IGN?...what is BDuni?

PostGIS? DB2? Oracle? Can it handle 100M spatial features? Can it do spatial transactions? Yes! Yes! Yes! Database Evaluation Scalability Enterprise 1 Dual-Core 2 Quad-Core Oracle $40,000 $160,000 IBM DB2 $36,400 $145,600 MS SQL Server $25,000 $50,000 IBM Informix $50,000 $200,000 PostGIS $0 $0 Vendors like to talk about scalability as if customers have infinite money to address their problems. With modern hardware, the main cost driver in scaling up an installation is no longer hardware, it s software. You can buy a dual-quad server with 24Gb of memory from Dell for less than $10K. Your software licensing for that server will be many times your hardware cost, and that is not a good scalability situation. Oracle Enterprise Edition pricing 2007-07: $40K * NCORES * 0.5 (for Standard Edition, use $15K instead of $40K) IBM (2007-07) uses value unit now, https://www-112.ibm.com/software/howtobuy/passportadvantage/ valueunitcalculator/vucalc.wss 100 value units for Intel dual core chip, 400 value units for dual Intel quads DB2 Enterprise = $364 / value unit DB2 Workgroup = $100 / value unit Informix Enterprise = $500 / value unit Microsoft (page updated 2005) SQLServer http://www.microsoft.com/sql/howtobuy/default.mspx Only multiply by processor, not cores! Nice! http://www.microsoft.com/sql/howtobuy/multicore.mspx

GSM startup companies are using postgis zonar makes vehicle tracking hardware and runs software service to map fleets locations come in from hardware are stored in PostGIS and mapped by MapServer

Price GSM GSM GSM GSM GSM VALUE Functionality as the number of vehicles goes up the data volume goes up and zonar can scale their system by adding more mapserver and more postgis postgis is scalable other databases have good features or good prices postgis has the best price/functionality

Cool Features! SQL Goodness! OK, so that business talk is fine, but talk some tech to me. You have heard of the NoSQL movement, perhaps? The number one feature of PostGIS is that it puts the power of hundreds of complex, performance optimized spatial functions at your fingertips through powerful declarative language we call SQL

Costed, Planned Spatial Queries! Try this on MySQL! SELECT... FROM geotable_a a JOIN geotable_b b ON ST_Intersects(b.geo,a.geo) JOIN attrtable_c c ON (b.id = c.id) JOIN attrtable_d d ON (a.id = d.id) Fun Formats! ST_AsGeoJSON() ST_AsGML() ST_AsKML() ST_GeomFromGML() ST_GeomFromKML() ST_GeomFromGeoJSON() The spatial type is fully integrated into the query planner. Even the PostgreSQL gurus at PgCon didn t know this. (So I added this slide) That means that complex multi-table queries like this one execute efficiently. Thanks to the work of Oslandia, PostGIS supports a veritable zoo of XML and other hipster formats like JSON for both output and input.

Geometry Construction! ST_Polygonize() ST_LineMerge() ST_Union() ST_Collect() ST_BuildArea() Linear Referencing! ST_LocateAlong() ST_LocateBetween() ST_AddMeasure() ST_Line_Locate_Point() We have exposed the geometry processing capabilities of the GEOS C++ library to allow fancy construction of geometries (come to my Friday talk for more on these) There is a set of linear referencing functions so you can build data models that include both measured and proportional linear references.

Cascaded Union! Cascaded Union! And our standard functions keep getting faster. The cascaded union improvement came in version 1.4 The picture is the example we were sent: why is this operation so slow he asked Cascaded union merges polygons in the optimal order. It made this example 40 times faster. Cascaded union does that melting process in a particular order Merging neighbors first This example became 5 times faster.

SELECT... FROM points, polygons WHERE ST_Intersects ( polygons.geom, points.geom ) Prepared Geometry! Prepared Geometry! Similarly, prepared geometries make standard spatial join queries faster. Calculating (for example) a point-in-polygon is quite expensive.

Prepared Geometry! Point in Polygon Prepared Geometry! Point in Polygon = O(n) First you draw a stab line. Then you check every edge to see if it hits the line. Then you count up the number of hits. Odd => inside. Even => outside. This point has three hits, so it s inside. Calculate cost is proportional to the number of edges.

Prepared Geometry! Build spatial index on edges! Point-in-polygon == O(log(n)) Line-in-polygon == O(m log(n)) But, Building an index takes O(n) So, Cache index and re-use it! Prepared Geometry! Prepared geometry makes repeated tests on large geometries very fast. (ST_Intersects, ST_Contains) But, if we index the edges, we can get the cost down to log(n)! But indexing the edges takes O(n) time! So we temporarily cache the index the first time we build it and use it on subsequent queries that hit the same polygon. that s fun geek talk important to remember... between 2 and 5 times faster depending on complexity of inputs (more complex, means better improvement)

Curves! CURVESTRING COMPOUNDCURVE Geography! CURVEPOLYGON ST_CurveToLine() ST_LineToCurve() Since 1.2, we ve had curve types which are part of ISO SQL/MM standard And our curve support has been getting more complete with each release. You can convert curves to linestrings, and even convert linestrings to curves! Curve types are useful for storing CAD data, which uses curves In 1.5, we added the geography type models data on a sphere

Geography! Geography! geometry type models data on a plane but that Simple Plate-Carre view, has lots of problem cases. a polygon that covers the pol

Geography! Geography! is wrong if you interpret it on the plane a polygon that crosses the dateline

Geography! Geography! thinks it crosses the whole world if you interpret it on the plane this wasn t just a problem for postgis even google earth has a hard time with the dateline and polygons also the poles

Geography! GeoNewbies Who is geography for? I want to find all the address points within one mile! My data is in lat/lon! Google Maps rocks! Geography! GeoHugies Yeah, I own a freaking satellite, you got a problem with that? Who is geography for? There two kinds of users who find GEOGRAPHY useful the first is geonewbies, users who do not know any GIS or anything about map projections GEOGRAPHY lets them work with lat/lon data without knowing about projections The geohugies are really big organizations that have truly global data, that covers the poles and datelines and everything in between there is no map projection that works for them

Indexes spherical data Geography! ST_Intersects() ST_Distance() ST_DWithin() ST_Area() Casts to/from GEOMETRY Geography functions? shp2pgsql the implementation of GEOGRAPHY currently only has support for a few functions but you can use casts to convert to GEOMETRY and access all the geometry function PostGIS 1.5 added a GUI loader tool The 2.0 version includes the ability to load multiple files in a batch!

Intro to PostGIS 2.0!?! pramsey @.org When is 2.0 coming?!!?! We have to stabilize the features we have, and close tickets Realistically, not before early 2012. Yes, we want it to be done too! Thanks!