-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from kbatuigas/pg_tileserv
pg_tileserv edits and fix a couple of typos in pg_featureserv
- Loading branch information
Showing
9 changed files
with
42 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
We put together this exercise to give you a taste of how easily and quickly you can add pg_featureserv to your existing PostGIS implementation and easily expose your spatial data via an API. We also showed you an example of adding a user-defined function and accessing it through the pg_featureserv generated API. | ||
|
||
From here you can now add these features as layers to your web maps. Common implementations use [OpenLayers](https://openlayers.org/) or [Leaflet](https://leafletjs.com/). You can also add functions that do more complex geospatial analysis in the database and then expose them as web features. We encourage you to check out our [PostGIS exercises](https://learn.crunchydata.com/postgis) for further information on the different types of analysis and functions you can create. | ||
|
||
Don't forget to also check out the [official pg_featureserv documentation](https://access.crunchydata.com/documentation/pg_featureserv/latest/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
This exercise will show you the steps to take to add pg_tileserv to your PostGIS implementation. | ||
This exercise shows you the steps to add pg_tileserv to your PostGIS implementation. | ||
|
||
First, take a look at the tab to the right called "pg_tileserv". You'll see that it's still waiting for an available conneciton on port 7800, the port that pg_tileserv serves data on. That's because we haven't added pg_tileserv to our PostGIS implementation yet. Let's do that now (click back to ```Terminal```) | ||
First, take a look at the tab in the terminal to the right called "pg_tileserv". You'll see that it's still waiting for an available conneciton on port 7800, the port that pg_tileserv serves data on. That's because we haven't added pg_tileserv to our PostGIS implementation yet. Let's do that now. | ||
|
||
## Add pg_tileserv | ||
|
||
To add pg_tileserv to your PostGIS database, you need to either download the [source code](https://github.com/CrunchyData/pg_tileserv), the binaries, or one of our supported containers. We'll use the container version of pg_tileserv for this scenario. | ||
|
||
To add the container to your postgis implentation, you'll need the connection info and username and password (from the first screen). | ||
The code block below allows you to click on it to have the code execute in the terminal. Be sure to click on the ```Terminal``` tab before click on the box to make sure the code executes in the correct tab. You also have the option of copying and pasting the code, or typing it yourself in the ```Terminal``` tab. | ||
|
||
```docker run -p 7800:7800 --env=DATABASE_URL=postgres://groot:[email protected]/nyc timmam/pg_tileserv:Katacoda```{{execute}} | ||
|
||
You'll see that the connection info we provided in the intro (database name: `nyc`, username: `groot`, and password: `password`) is used in the statement above. | ||
|
||
You should see lines of output like this in the terminal: | ||
|
||
```sh | ||
|
@@ -23,6 +25,6 @@ time="2020-07-02T14:06:47Z" level=info msg="HEAD /" method=HEAD url=/ | |
time="2020-07-02T14:06:50Z" level=info msg="GET /" method=GET url=/ | ||
``` | ||
|
||
Now, if you look at the pg_tileserv tab again, you'll see the default UI and all of the nyc data being delivered as vector tiles (under ```Table Layers```). | ||
Now, if you look at the pg_tileserv tab again, you'll see the default UI as well as all of the NYC data being delivered as vector tiles (under ```Table Layers```). | ||
|
||
Next, we'll go over the default UI and then show you how you can add a simple user defined function and have it available via pg_tileserv. | ||
Next, we'll go over the default UI and then show you how to add a user-defined function and have it available via pg_tileserv. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
You've completed this exercise. Seemed short right? That's because it is. This exercise is meant to show you how easily and quickly you can add pg_tileserv to your exisitng PostGIS implementation to service enable your spatial data. | ||
This scenario was meant to show you how easily and quickly you can add pg_tileserv to your exisitng PostGIS implementation to service enable your spatial data. | ||
|
||
From here you can now add these vector tiles as layers to your web-map. Common implementations are OpenLayers or Leaflet. That get's into topics that are beyond the scope of this exercise. You can also add functions to your database to do more complex geospatial analysis in the database and have them exposed as vector tiles as we also showed in this scenario. We encourage you to check out our other PostGIS exercises for further information on the different type of analysis and functions you can create. | ||
From here you can now add these vector tiles as layers to your web map. Common implementations use [OpenLayers](https://openlayers.org/) or [Leaflet](https://leafletjs.com/) (a topic beyond the scope of this scenario). | ||
|
||
You also saw in this scenario that you can also add functions to your database to do more complex geospatial analysis in the database and have them exposed as vector tiles. We encourage you to check out our [PostGIS exercises](https://learn.crunchydata.com/postgis) for further information on the different types of analysis and functions you can create. | ||
|
||
Don't forget to also check out the [official pg_tileserv documentation](https://access.crunchydata.com/documentation/pg_tileserv/latest/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
# Introduction to Vector Tiles and pg_tileserv | ||
|
||
This scenario gives you an introduction to vector tiles and pg_tileserv. | ||
This scenario gives you a hands-on introduction to vector tiles and [pg_tileserv](https://access.crunchydata.com/documentation/pg_tileserv/latest/). | ||
|
||
Vector tiles are a bandwidth efficient method of transferring spatial data over the web for display in webmaps. For a brief history of webmaps and vector tiles, watch [Paul Ramsey's presentation at PostGIS Day 2019](https://youtu.be/t8eVmNwqh7M "PostGIS Day 2019 Vector Tiles"). | ||
Vector tiles are a bandwidth-efficient method of transferring spatial data over the web for display in web maps. For a brief history of web maps and vector tiles, watch [Paul Ramsey's presentation at PostGIS Day 2019](https://youtu.be/t8eVmNwqh7M "PostGIS Day 2019 Vector Tiles"). | ||
|
||
With the release of PostGIS 2.4, PostGIS introduced the ability to generate vector tiles directly from the database. This provided developers with the ability to have constantly up-to-date vector tiles in their webmap. However, it required the developers to write their own API to leverage this functionality. Pg_tileserv was created to make it easy to service enable your spatial data and integrate it into your web application. | ||
With the release of PostGIS 2.4, [PostGIS](https://postgis.net/) introduced the ability to generate vector tiles directly from the database. This provided developers with the ability to have constantly up-to-date vector tiles in their web maps. However, it also required developers to write their own API to leverage this functionality. Pg_tileserv was created to make it easy to service enable your spatial data and integrate it into your web application. | ||
|
||
To use pg_tileserv, you need to have a PostGIS database with spatial data loaded in it. The database has already been started and the spatial data has already been loaded. This scenario will use data from New York City (NYC). This exercise shows how to connect pg_tileserv to your database and shows the resulting vector tiles. We also show an example of using user defined function through pg_tileserv. If you would like to learn more about creating funcitons, please review some of our other exercies. Data from this scenario is used in our other exercises as well, but the environements don't persist between scenarios. | ||
To use pg_tileserv, you need to have a PostGIS database with spatial data loaded in it. The database has already been started and the spatial data has already been loaded. This scenario will use data from New York City (NYC). | ||
|
||
We have already logged you into the PostgreSQL command line but, if you get disconnected here are the details on the database we are connecting to: | ||
This exercise demonstrates how to connect pg_tileserv to your database and shows the resulting vector tiles. We also provide an example of how pg_tileserv works with user-defined functions. If you would like to learn more about creating funcitons, please review our [Basics on Writing Functions](https://learn.crunchydata.com/postgresql-devel/courses/beyond-basics/basicfunctions) scenario. Data from this scenario is used in our other exercises as well, but the environments don't persist between scenarios. | ||
|
||
Here are the details on the database we are connecting to: | ||
|
||
1. Username: groot | ||
2. Password: password (same password for the postgres user as well) | ||
3. A database named: nyc | ||
|
||
And with that, let's dig in. | ||
|