#What is PostGIS and why should I care? ###PostGRES An open-source relational database management system (RDBMS). ###PostGIS An extension for PostGRES databases that adds the ability to store spatial data, and special functions to query spatial data.
###Advantages Using a PostGIS-enabled PostGRES database to store spatial data allows you to:
- Store massive amounts of data
- Work on files concurrently without corrupting them
- Query and Analyze data with PostGIS-flavored SQL
- Allows for code reuse and easy modification
- Database operations don't create tons of interstitial files like a traditional GIS
- Compatible with a ridiculous array of other software because it's an open source standard
###In order to query spatial data with PostGIS, you need:
- A running PostGRES database
- A running PostGIS extension for PostGRES
- A program to run queries on the database
###Easy method to use PostGIS = use CartoDB
- Sign up for a free account at CartoDB
###Flexible method to use PostGIS = install OpenGeoSuite
- Download OpenGeoSuite from BoundlessGeo
- Run the PostGIS app installed by OpenGeoSuite
- Open pgAdmin. Right click the 'PostGIS' database, press 'connect'. Expand it. Explore it. In particular check out schemas > public > tables (this is where spatial files end up getting stored)
- Create a new database by right-clicking the exisiting PostGIS database and selecting New Database
- Give it a name, make the 'Owner' postgres
- Open your new database (the username and password should be defaults still at this point)
- Click the SQL option, type
sql CREATE Extension postgis;
. Execute the query - Confirm it's running using PostGIS by running the following query:
sql SELECT postgis_full_version();
- Congrats! You now have a running PostGIS database! Follow the rest of my tutorial at the Azavea Atlas to load data into the database
##Next Steps 10. Follow along with the PostGIS analysis tutorial on the Azavea Atlas using OpenTreeMap data to see some simple data summary queries 11. Follow along with the CartoDB PostGIS tutorial that replicates QGIS' basic geoprocessing functions with QGIS to begin migrating your GIS skills over to PostGIS 12. Follow along through the BoundlessGeo PostGIS workshop to get really in-depth with PostGIS 13. Recycle PostGIS code from one project to another by only changing the variable and field names and feel like a genius