GithubHelp home page GithubHelp logo

stezii / tilestrata-postgismvt Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 12.0 230 KB

A TileStrata plugin for serving Mapbox Vector Tiles from a PostGIS database

License: Apache License 2.0

Makefile 9.62% JavaScript 90.38%

tilestrata-postgismvt's People

Contributors

helmi03 avatar stezii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tilestrata-postgismvt's Issues

geometry column cannot be null

tilestrata-postgismvt fails for me and I don't know whether it's my data, my postgis install or a bug in tilestrata-postgismvt. Here is the failing auto-generated query:

SELECT ST_AsMVT('l1', 256, 'geom', q) AS mvt FROM (
   SELECT ST_AsMVTGeom(ST_Transform(public.kalktest.geom, 3857), 
             TileBBox(4, 8, 4, 3857), 256, 0, false) geom , kalkinnhol
    FROM public.kalktest
    WHERE ST_Intersects(TileBBox(4, 8, 4, 3857), public.kalktest.geom)
) AS q

mvt_agg_transfn: geometry column cannot be null error: mvt_agg_transfn: geometry column cannot be null

My config:

  .use(postgismvt({
    lyr: {
      table: 'public.kalktest',
      geometry: 'geom',
//      type: 'circle',
      srid: 3857,
      minZoom: 0,
      maxZoom: 19,
      buffer: 0,
      fields: 'kalkinnhol',
      resolution: 256
    },

If I add
WHERE geom IS NOT NULL
to the default query at index.js:104 it returns tiles.

Data simplification

Hi. Thanks for this lib, it's really interesting and helpful

Btw, what about some data simplification ? Currently I have more than 300 000 features in my PostGIS table and when I trying to serve this data with tilestrata-postgismvt - it sends for about ~35 mb of data (all possible features) without any simplification based on zoom or whatever else. You can see it on the attached screenshoot

screenshot

I think it will be great to add some option (like simplify: true or more smart one) and refactor SQL query to simplify (reduce or union) the features based on zoom for example. What do you think?

Using with mapboxgl JS

Im using this with mapboxgl JS and I cannot view the geometries on the map because source-layer is required and tilestrata-postgismvt do not support layers inside the source.

map.addSource('countries', {
"type": "vector",
"tiles": ["localhost:5003/postgismvt_layer_name/{z}/{x}/{y}.mvt"]
});
 
map.addLayer({
"id": "countries",
"type": "fill",
"source": "countries",
"source-layer": "layers_inside_postgismvt_layer",
});

So Im wondering if has any way to add layers inside tilestrata-postgismvt to create nested layers.

200 with No Content for Mapbox

Hi. I'm trying to run own tile-server that works with dynamic tiles from PostGIS.

I have: PG 10, PostGIS 2.4, TileBBox from Mapbox and data exported with ogr2ogr.

My server code is:

var tilestrata = require('tilestrata');
var disk = require('tilestrata-disk');
var dependency = require('tilestrata-dependency');
var strata = tilestrata();
var postgismvt = require('tilestrata-postgismvt');
var headers = require('tilestrata-headers');

strata.layer('data').route('tile.mvt')
  .use(headers({'Access-Control-Allow-Origin': '*'})).use(postgismvt({
    lyr: {
      table: 'public.table_name',
      geometry: 'wkb_geometry',
      type: 'circle',
      srid: 4326,
      minZoom: 3,
      maxZoom: 19,
      buffer: 10,
      fields: 'type ogc_fid',
      resolution: 256,
    },
    pgConfig: {
      host: '0.0.0.0',
      user: 'postgres',
      password: 'postgres',
      database: 'database',
      port: '5432'
    }}));

// start accepting requests
strata.listen(8080);

But when I try to connect it to Mapbox GL JS - I see an errors:

mapbox.addSource('table_name', {
   'type': 'vector',
   'tiles': [
        "http://localhost:8080/table_name/{z}/{x}/{y}/tile.mvt"
   ]
});

XHR finished loading: GET "http://localhost:8080/data/11/602/769/tile.mvt".
exports.getArrayBuffer @ blob:http://localhost:3000/c4a4aaef-41f9-439c-9f35-18659ae78ad7:293
loadVectorTile @ blob:http://localhost:3000/c4a4aaef-41f9-439c-9f35-18659ae78ad7:121
VectorTileWorkerSource.loadTile @ blob:http://localhost:3000/c4a4aaef-41f9-439c-9f35-18659ae78ad7:121
Worker.loadTile @ blob:http://localhost:3000/c4a4aaef-41f9-439c-9f35-18659ae78ad7:123
Actor.receive @ blob:http://localhost:3000/c4a4aaef-41f9-439c-9f35-18659ae78ad7:291

Error: Error: http status 200 returned without content.

What am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.