Postgis 2.4.2 Manual SVN Revision
Total Page:16
File Type:pdf, Size:1020Kb
PostGIS 2.4.2 Manual i PostGIS 2.4.2 Manual SVN Revision () PostGIS 2.4.2 Manual ii Contents 1 Introduction 1 1.1 Project Steering Committee . .1 1.2 Core Contributors Present . .1 1.3 Core Contributors Past . .2 1.4 Other Contributors . .2 1.5 More Information . .3 2 PostGIS Installation 4 2.1 Short Version . .4 2.2 Install Requirements . .5 2.3 Getting the Source . .7 2.4 Compiling and Install from Source: Detailed . .7 2.4.1 Configuration . .7 2.4.2 Building . .9 2.4.3 Building PostGIS Extensions and Deploying them . .9 2.4.4 Testing . 11 2.4.5 Installation . 20 2.5 Creating a spatial database using EXTENSIONS . 21 2.6 Create a spatially-enabled database without using extensions . 21 2.7 Installing and Using the address standardizer . 22 2.7.1 Installing Regex::Assemble . 23 2.8 Installing, Upgrading Tiger Geocoder and loading data . 23 2.8.1 Tiger Geocoder Enabling your PostGIS database: Using Extension . 23 2.8.1.1 Converting a Tiger Geocoder Regular Install to Extension Model . 25 2.8.2 Tiger Geocoder Enabling your PostGIS database: Not Using Extensions . 26 2.8.3 Using Address Standardizer Extension with Tiger geocoder . 26 2.8.4 Loading Tiger Data . 26 2.8.5 Upgrading your Tiger Geocoder Install . 27 2.9 Create a spatially-enabled database from a template . 28 2.10 Upgrading . 28 PostGIS 2.4.2 Manual iii 2.10.1 Soft upgrade . 28 2.10.1.1 Soft Upgrade Pre 9.1+ or without extensions . 28 2.10.1.2 Soft Upgrade 9.1+ using extensions . 29 2.10.2 Hard upgrade . 29 2.11 Common Problems during installation . 30 2.12 Loader/Dumper . 31 3 PostGIS Frequently Asked Questions 32 4 Using PostGIS: Data Management and Queries 36 4.1 GIS Objects . 36 4.1.1 OpenGIS WKB and WKT . 36 4.1.2 PostGIS EWKB, EWKT and Canonical Forms . 37 4.1.3 SQL-MM Part 3 . 38 4.2 PostGIS Geography Type . 38 4.2.1 Geography Basics . 39 4.2.2 When to use Geography Data type over Geometry data type . 41 4.2.3 Geography Advanced FAQ . 41 4.3 Using OpenGIS Standards . 42 4.3.1 The SPATIAL_REF_SYS Table and Spatial Reference Systems . 42 4.3.2 The GEOMETRY_COLUMNS VIEW . 43 4.3.3 Creating a Spatial Table . 44 4.3.4 Manually Registering Geometry Columns in geometry_columns . 45 4.3.5 Ensuring OpenGIS compliancy of geometries . 48 4.3.6 Dimensionally Extended 9 Intersection Model (DE-9IM) . 52 4.3.6.1 Theory . 53 4.4 Loading GIS (Vector) Data . 56 4.4.1 Loading Data Using SQL . 56 4.4.2 shp2pgsql: Using the ESRI Shapefile Loader . 56 4.5 Retrieving GIS Data . 58 4.5.1 Using SQL to Retrieve Data . 58 4.5.2 Using the Dumper . 59 4.6 Building Indexes . 59 4.6.1 GiST Indexes . 60 4.6.2 BRIN Indexes . 60 4.6.3 Using Indexes . 61 4.7 Complex Queries . 62 4.7.1 Taking Advantage of Indexes . 62 4.7.2 Examples of Spatial SQL . 63 PostGIS 2.4.2 Manual iv 5 Raster Data Management, Queries, and Applications 66 5.1 Loading and Creating Rasters . 66 5.1.1 Using raster2pgsql to load rasters . 66 5.1.2 Creating rasters using PostGIS raster functions . 70 5.2 Raster Catalogs . 70 5.2.1 Raster Columns Catalog . 71 5.2.2 Raster Overviews . 72 5.3 Building Custom Applications with PostGIS Raster . 72 5.3.1 PHP Example Outputting using ST_AsPNG in concert with other raster functions . 73 5.3.2 ASP.NET C# Example Outputting using ST_AsPNG in concert with other raster functions . 73 5.3.3 Java console app that outputs raster query as Image file . 75 5.3.4 Use PLPython to dump out images via SQL . 76 5.3.5 Outputting Rasters with PSQL . 77 6 Using PostGIS Geometry: Building Applications 78 6.1 Using MapServer . 78 6.1.1 Basic Usage . 78 6.1.2 Frequently Asked Questions . ..