Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting your own PostGIS database #29

Open
grobins opened this issue Nov 27, 2017 · 3 comments
Open

Connecting your own PostGIS database #29

grobins opened this issue Nov 27, 2017 · 3 comments

Comments

@grobins
Copy link

grobins commented Nov 27, 2017

Hi, I'm a little unclear how to read from a Postgis database. Is that a DB that's running on my localhost? I've tried setting environment variables for DB_HOST, DB_USER etc, and specifying a query in my project.tiler.json file, but it can't find these variables.

I'm trying to create tiles for 1.5million linestrings.. and having issues because my source data is in WKT in a CSV, and the only way I know to create the shapefile is with QGIS, which crashes...

@JamesLMilner
Copy link
Contributor

Which database are you wanting to use? Tiler comes with a database inside the Docker container itself.

If you're running PostGIS on your host machine, and you want to connect to that, that should be possible. You probably need to set DB_HOST to the IP address of the host machine. See this question on StackOverflow: https://stackoverflow.com/questions/31249112/allow-docker-container-to-connect-to-a-local-host-postgres-database

Regarding creating Shapefiles, you could use ogr2ogr which is a command line tool, and a less likely to crash than QGIS.

@grobins
Copy link
Author

grobins commented Nov 27, 2017

Thanks James, I'll check that out. I guess I can just connect to the Tiler DB and put my data in there for the job... with ogr2ogr, will that be able to create a shapefile from all the rows in my source CSV?

@JamesLMilner
Copy link
Contributor

I don't know the internals of GDAL supporting formats, but from the docs it sounds promising: http://www.gdal.org/drv_csv.html

Specifically: "When reading a field named "WKT" is assumed to contain WKT geometry, but also is treated as a regular field."

@JamesLMilner JamesLMilner changed the title using Postgis Connecting your own PostGIS database Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants