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

Cannot get tile example to work with postgis #1

Open
hallahan opened this issue Feb 7, 2014 · 6 comments
Open

Cannot get tile example to work with postgis #1

hallahan opened this issue Feb 7, 2014 · 6 comments

Comments

@hallahan
Copy link

hallahan commented Feb 7, 2014

I have gotten node-mapnik to work, and the example that generates the map.png with the world shapefile is fine.

When trying to use the tile example, however, it is not connecting to a postgres database that i have tested to work. When doing a request for a tile I get the following response:

screenshot 2014-02-07 14 18 58

When installing mapnik, I did specify --with-postgis

I'm wondering if I still am having issues due to the fact that I installed mapnik via the pkg at one point.

The postgis database is on amazon and is a production server that is reliable.

@springmeyer
Copy link
Member

Add mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'postgis.input')); or just mapnik.register_default_input_plugins() at the top of the js code. The reason is that you are running latest node-mapnik and the examples have not been updated to account for this breaking change: mapnik/node-mapnik@ef06b6f

@springmeyer
Copy link
Member

btw, you might be interested in https://github.com/springmeyer/coalition. It is the first iteration of what later turned into the cartodb tile api.

@hallahan
Copy link
Author

hallahan commented Feb 8, 2014

Hmm, I get:

/Users/nick/node-mapnik-sample-code/tile/database/app.js:19
mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'post
       ^
TypeError: Object #<Object> has no method 'register_datasource'

and mapnik.register_default_input_plugins() just gives me the same problem.

@springmeyer
Copy link
Member

Oh, so I guess I thought wrong. If you don't have the function mapnik.register_datasource then your node-mapnik is not bleeding edge. So then you must actually be missing the Mapnik postgis plugin. It is called postgis.input and should be located in this directory:

ls -l `mapnik-config --input-plugins`

If you are still on OS X then brew install mapnik should build the postgis.input by default if postgresql is installed. Otherwise you need to do brew install mapnik --with-postgresql as is visible if you do brew info mapnik.

@hallahan
Copy link
Author

I actually reinstalled everything from a fresh OS X image, and I'm getting the same problem. When I list input plugins, I have:

Nicholass-MacBook-Pro:node-mapnik-sample-code nick$ ls -l `mapnik-config --input-plugins`
total 3384
-r--r--r--  1 nick  staff  287544 Feb  9 20:42 csv.input
-r--r--r--  1 nick  staff  182004 Feb  9 20:42 gdal.input
-r--r--r--  1 nick  staff  157548 Feb  9 20:42 geojson.input
-r--r--r--  1 nick  staff  204244 Feb  9 20:42 ogr.input
-r--r--r--  1 nick  staff  268432 Feb  9 20:42 raster.input
-r--r--r--  1 nick  staff  332568 Feb  9 20:42 shape.input
-r--r--r--  1 nick  staff  283968 Feb  9 20:42 sqlite.input

I did flag the --with-postgresql I did this before actually installing Postgres. I was thinking that this would actually install Postgres for me, but it appears that it did not. I then installed via postgresapp.com.

@hallahan
Copy link
Author

Looking at brew info mapnik, I have an x by the postgresql. What can I do after the fact to install postgres support after it's been installed? Perhaps I should brew uninstall mapnik and then reinstall?

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