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

Pass current zoomlevel to query parameter of PostgreSQL vector provider #98

Open
shr3k opened this issue Feb 17, 2013 · 3 comments
Open

Comments

@shr3k
Copy link

shr3k commented Feb 17, 2013

Hi, it would be great to pass current zoomlevel to variable and allow PostgreSQL query adjustment.

Imagine we have a table with multiple pregeneralized geometry columns and we want to switch between them depending on currrent zoom level to spare some data and speed up client SVG rendering.

This is currently IMHO realizable with tilestache-seed.py - seed only selected levels and modify .cfg file to adjust desired geometry column.

It would be great to have .cfg like (very simplified idea, in fact there's need to have own function to select right geometry column):

"provider": {
"name": "vector",
"driver": "PostgreSQL",
"parameters": {"user": "postgis", "password": "mypassword", "dbname": "mydatabase", "query": "SELECT CAST(code AS character) AS code, name, geom_$ZOOMLEVEL FROM mytable"},
"properties": ["code","name"],
"clipped": false,
"id_property": "code"
}

Alternatively we could have some kind of zoom-geometry column mapping like:

"provider": {
"name": "vector",
"driver": "PostgreSQL",
"parameters": {"user": "postgis", "password": "mypassword", "dbname": "mydatabase", "table": "mytable"},
"zoom_to_geometry_mapping": {"13": "geom_simplify50m", "14": "geom_simplify25m", "15": "geom_simplify10m", "16": "geom_simplify10m", "17": "geom", "18": "geom"}
"properties": ["code","name"],
"clipped": false,
"id_property": "code"
}

@rburhum
Copy link
Contributor

rburhum commented Feb 27, 2013

Hi shr3k,

Just wondering why having different layer definitions for different levels and changing the layers in js would not cut it...

@migurski
Copy link
Contributor

Mapnik has a "scale denominator" value that you can put in psql queries, would something like that work?

@ckotil2
Copy link

ckotil2 commented Jan 16, 2014

Is it possible to pass anything back to Tilestache from the browser? My GeoJSON tiles are very large to the point it's slow to load them all at low zoom levels. I would like to be able to pass back say a layer_id that can then be used in the query to retrieve the GeoJSON data. It could be used to pass in zoom level as well.
Does this exist? Otherwise it's looking like I will need to have a few hundred layers defined in tilestache.cfg.

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

4 participants