Open Source GIS at Pierce County Using OpenLayers, PostGIS, and GeoTools with ESRI Jared Erickson GISP Pierce County IT/GIS jericks@co.pierce.wa.us
Introduction How we use Open Source & ESRI GIS Why we use Open Source & ESRI GIS Case studies Pros and Cons
Open Source GIS
Open Source GIS
Case Studies QuickView Critical Areas Neighborhood Crime Direction Maps CountyView Web Migrations
PostGIS Adds spatial types to a PostgreSQL database Lets you add spatial queries to your SQL statements Works with ArcGIS
OpenLayers JavaScript slippy maps Many layers TMS Google/Bing WMS Vector KML GeoJSON GML
GeoTools Java GIS Library Geometry module (Java Topology Suite) DataSource module PostGIS ArcSDE Shapefiles Feature module Projection module Rendering module Much more
QuickView
QuickView What does it do? Parcel based search Drill down multi feature identify, results for entire parcel Identify, Proximity/Closest Spatial Queries Why Open Source? Map Objects was too unstable and slow ArcIMS unable to do proximity queries effectively What does it use? PostGIS, ArcIMS Pros PostGIS spatial queries are fast Able to update data without restarting ArcIMS One location for data, no longer in SDE & Shapefiles Found MultiPolygon bug. Already fixed. Recompiled GEOS.
QuickView Cons Had to move data from SDE SQLServer to PostGIS Not yet using SQLServer 2008 Select Nearest SELECT ST_Distance(g1.shape, g2.shape) AS Distance FROM atr.taxpar AS g1, sewer.main_lines AS g2 WHERE tax_parcel_num = '0420315001' AND ST_DWithin(g1.shape, g2.shape, 1500) ORDER BY Distance LIMIT 1
Critical Areas http://yakima.co.pierce.wa.us/criticalareas/
Critical Areas What does it do? Public site for environmental information Drill down identify on 18 layers Public version of QuickView Why Open Source? Map Objects unstable, ArcIMS too slow. Preprocessing with ArcGIS fragile and time consuming (6 hours) What does it use? PostGIS, ArcIMS Pros PostGIS is fast. No preprocessing. Easier updates. Same performance as SQL Server 2008 Cons None
Critical Areas Queries 18 layers by Tax Parcel Uses a store procedure ST_Intersects and ST_Buffer Get parcel potential flood SELECT array_to_string(array( SELECT DISTINCT g2.fld_hazard as flood_potential FROM taxpar_pg as g1, potential_flood_hazard_areas_pg As g2 WHERE (g1.tax_parcel_num = parcelno AND ST_Intersects(ST_Buffer(g1.Shape, 1), g2.shape)) ORDER BY flood_potential), ',') INTO flood; IF length(trim(flood))<1 THEN flood = 'No'; ELSE flood = 'Yes'; END IF;
Neighborhood Crime http://yakima.co.pierce.wa.us/neighborhoodcrime/index.cfm
Neighborhood Crime What does it do? Public crime web site Why Open Source? Slippy map and Spatial Queries What does it use? OpenLayers, PostGIS, JTS, ArcIMS & TileCache Pros PostGIS is fast OpenLayers is versatile Cons OpenLayers Vector layers (the points) slow down IE
Neighborhood Crime OpenLayers Vector Layer Client side Interactive GeoJSON Styling BBox Strategy Overlap Exploder
Neighborhood Crime Server Side Clustering
Direction Maps http://yakima.co.pierce.wa.us/directions/
Direction Maps What does it do? Public site with maps to all County Facilities Why Open Source? Slippy map and Spatial Queries What does it use? OpenLayers, PostGIS, ArcIMS TileCache Pros Replaced 100 lines of ArcIMS Spatial Query with 1 line PostGIS SQL Statement OpenLayers is better than our home grown ArcIMS viewer Cons None
Direction Maps (ArcIMS) 189 Lines of Code
Direction Maps (PostGIS) 4 Lines of Code
CountyView Web
CountyView Web What does it do? Entry level enterprise GIS on the Web Why Open Source? Needed tools not provided by ArcIMS and ArcSDE What does it use? Latitude s Internet Mapping Framework (IMF) ArcIMS, ArcSDE JTS, GeoTools Pros GeoTools has good documentation Very flexible Cons GeoTools is a HUGE library. Steep learning curve Library mismatch. IMF uses GeoTools but a very old version.
CountyView Web Local Shapefile Toolbox Editing Create a new Shapefile Calculate columns Add/Delete fields Analysis Buffer (with dissolve) Extract centroids Clip Merge Convex hull Extent
GeoTools (Web) Commands Java library Command Design Pattern Clip Command Buffer Command Create Shapefile Command Restful(ish) web services Jersey framework (JAX RS) Zip file in, Processing, Zip file out
CountyView Web Clip
CountyView Web Buffer
Migrations
Migrations What does it do? Moves tabular data with XY into ArcSDE Why Open Source? Java API for ArcSDE is really under documented and hard to use. What does it use? GeoTools Pros Let the GeoTools Developers figure out the Java API for ArcSDE Found NString bug. Submitted Patch, Fixed same day. GeoTools DataStore abstraction will make it easy to migrate to PostGIS Cons None
Conclusions Open source GIS and ESRI software can be used together It s doesn t have to be either/or, it can be both PostGIS, OpenLayers, and GeoTools can be used with ESRI technology Open Source is diverse Database (PostGIS) Slippy map (OpenLayers) Powerful Libraries (GeoTools & JTS)
Thank you! Jared Erickson GISP jericks@co.pierce.wa.us