Postgresapp: What's the best way to install/add MapBox Vector Tile support for PostGis 2.4?

Created on 13 Oct 2017  ·  13Comments  ·  Source: PostgresApp/PostgresApp

So to get the new functionality for mapbox vector tiles in postgis 2.4, it has to be compiled with protobuf:

In order to have Map Box Vector Tiles support enabled, you’ll need to compile with protobuf support and pkg-config to verify the correct minimum version of protobuf-c see protobuf for details.
http://postgis.net/

It's super wonderful that the postgres 10 distribution in postgres app already comes with postgis 2.4, but I need the vector tile support. Any suggestions for the best way to approach this with postgres app? Do I need to install postgis separately with homebrew and link it somehow?

Most helpful comment

PostgreSQL 11 is now released, and PostGIS 2.5.0 is now built with support for MapBox Vector Tiles!

All 13 comments

Any updates on this?

I'm keen to figure this out too. I tried installing protobuf-c using Homebrew, no luck.

Steps to reproduce

I'm using Postgres.app version 2.1.1 (40) with a database that has PostGIS enabled. I used the sample query from the ST_AsMVT documentation. Running this:

SELECT ST_AsMVT(q, 'test', 4096, 'geom') FROM (SELECT 1 AS c1, ST_AsMVTGeom(ST_GeomFromText('POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))'), ST_MakeBox2D(ST_Point(0, 0), ST_Point(4096, 4096)), 4096, 0, false) AS geom) AS q;

...returns this error:

ERROR: Missing libprotobuf-c SQL state: XX000

Postgis needed to be compiled with protobuf support available, so unless
you're building postgres app from source or something, pretty sure it's all
precompiled, so anything you do locally won't make any difference

On Sun, Jan 7, 2018, 12:16 AM Reilly Wood notifications@github.com wrote:

I'm keen to figure this out too. I tried installing protobuf-c using
Homebrew, no luck.

Steps to reproduce

I'm running Postgres.app version 2.1.1 (40) on a database with PostGIS
enabled. I used the sample query from the ST_AsMVT documentation
https://postgis.net/docs/manual-dev/ST_AsMVT.html. Running this:

SELECT ST_AsMVT(q, 'test', 4096, 'geom') FROM (SELECT 1 AS c1,
ST_AsMVTGeom(ST_GeomFromText('POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),
(20 30, 35 35, 30 20, 20 30))'), ST_MakeBox2D(ST_Point(0, 0),
ST_Point(4096, 4096)), 4096, 0, false) AS geom) AS q;

...returns this error:

ERROR: Missing libprotobuf-c SQL state: XX000


You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub
https://github.com/PostgresApp/PostgresApp/issues/412#issuecomment-355800456,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AYgWKRIb7y7-6iMpWV_OtgODCzq94Gp0ks5tIFM_gaJpZM4P5Dc8
.

No updates?

Sad to see no official responses to this issue. Just like this author, I found the most painless way to get this support on my mac was actually to run a docker container (so postgres/gis on linux)-

https://www.zimmi.cz/posts/2017/postgis-as-a-mapbox-vector-tiles-generator/

I agree with @chriszrc and @rgwood that it would be very useful to have libprotobuf-c compiled with Postgres.app. @jakob if you have any advice in the meantime about whether it's possible to do in user land (seems unlikely), or if it's on the roadmap, that would be great!

Hey folks! Sorry for not responding to this sooner!

Since this has been requested a couple of times now, and it sounds like a sensible addition, I've tried to build PostGIS with support for Mapbox Vector Tiles. It took me a while to figure out how to build libprotobuf-c, but I think I've done it.

I've just released a beta build of Postgres.app with PostgreSQL 11beta4 and PostGIS 2.5.0rc2 with support for Mapbox Vector Tiles.

Since I don't really know what Mapbox Vector Tiles are, I just tried executing one of the commands from the PostGIS docs, and it worked. So I'd appreciate if any of you could head over to the releases section and try the latest Beta. Create a server with PostgreSQL 11, and try if it works!

(Postgres.app 2.2beta2 includes the stable versions of PostgreSQL as well, so you can try out the 11 beta and keep running your servers with PostgreSQL 10 or earlier at the same time)

@jakob Thanks for your work on this! I just tried it out and it works. Thanks a bunch!

PostgreSQL 11 is now released, and PostGIS 2.5.0 is now built with support for MapBox Vector Tiles!

So cool!

Is there any chance this can also be back ported to the 9.6 version of PostgreSQL that's bundled, @jakob ? That appears to be pinned to 2.3.7 for now.

@JamesChevalier Then the automatic software update would break people's installations, and would require manual data migration. That's why we always ship one major version of PostgreSQL with one major version of PostGIS. (since you then need to migrate data anyway)

Oh, sorry, I misunderstood how extension versioning works... After some PostgresApp updates, I thought I've noticed that select * from pg_available_extensions shows installed_version as (for example) 2.3.4 but the default_version as 2.3.7. So, I thought you could make several PostGIS versions available.

🤔 Is there any way for me to install PostGIS 2.4 or 2.5 against a PostgreSQL 9.6 installation within PostgresApp? While I was waiting on your response, I tried copying the /Applications/Postgres.app/Contents/Versions/11/lib/postgresql/postgis-2.5.so file over to /Applications/Postgres.app/Contents/Versions/9.6/lib/postgresql/, removing the postgis-2.3.so file in there, and restarting PostgresApp, but that didn't change the default_version listed. 🤷‍♂️ 😬

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JacobEvelyn picture JacobEvelyn  ·  10Comments

chriszrc picture chriszrc  ·  4Comments

klouie93 picture klouie93  ·  11Comments

9mm picture 9mm  ·  12Comments

JoeFryer picture JoeFryer  ·  6Comments