14 postgis
Adding data from a PostGIS database to the map
Setting up the conda env:
1 2 3 4 5 | |
Sample dataset: - nyc_data.zip (Watch this video to load data into PostGIS)
1 | |
Connecting to the database
1 | |
You can directly pass in the user name and password to access the database. Alternative, you can define environment variables. The default environment variables for user and password are SQL_USER and SQL_PASSWORD, respectively.
The try...except... statements are only used for building the documentation website (https://leafmap.org) because the PostGIS database is not available on GitHub. If you are running the notebook with Jupyter installed locally and PostGIS set up properly, you don't need these try...except... statements.
1 2 3 4 5 6 | |
Create a GeoDataFrame from a sql query.
1 | |
1 2 3 4 5 | |
Display the GeoDataFrame on the interactive map.
1 2 3 4 5 6 7 8 | |
