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

Small items on map should turn into points #69

Open
philipn opened this issue Jan 26, 2015 · 4 comments
Open

Small items on map should turn into points #69

philipn opened this issue Jan 26, 2015 · 4 comments
Labels

Comments

@philipn
Copy link
Member

philipn commented Jan 26, 2015

From @philipn on September 4, 2012 20:57

At a certain zoom level, small items on the map should turn into points.

Not sure how to do this - maybe an OpenLayers Strategy?

Copied from original issue: localwiki/localwiki#334

@philipn philipn added the geo label Jan 26, 2015
@philipn
Copy link
Member Author

philipn commented Jan 26, 2015

From @wildintellect on September 4, 2012 23:46

Generally this is called scale dependent rendering. It all depends on if you're trying to do it from one layer or can call the same data twice as 2 layers. In the 2 layer scenario you can turn on/off each layer depending on zoom level and each can have 100% independent styling. What's the data source format for the layer in question, geojson?

@philipn
Copy link
Member Author

philipn commented Jan 26, 2015

Two layers would be fine. The data is WKT or GeoJSON. It looks like the scale dependent layer display stuff (this? http://dev.openlayers.org/releases/OpenLayers-2.12/examples/label-scale.html) is based more on the scale of the map zoom rather than the size of the object. What we want is to allow for, say, a really long street to appear as a linestring but turn into a point of its bbox is smaller than a certain size. Any ideas?

@philipn
Copy link
Member Author

philipn commented Jan 26, 2015

From @wildintellect on September 10, 2012 16:53

So, what I mean - at a given scale, for objects smaller than x, render like rule y else render as rule z. I know how to do this with QGIS rendering rules and assume it's also possible with Mapnik. I'm not so sure about a pure openlayers implementation. It's going to take a little more research.

The partial work around is in Django the page returns different json at different zooms, one being regular style the other being things Django/Postgis says are smaller than the size you want so returned as points. The problem with this is on each scale change you have to decide if you want to query django again.

@wildintellect
Copy link

A pure openlayers solution (or even pure client based js) is probably not what you want. This is typically where most services make use of Tile Server (leverages Mapnik) or WMS, so that the render rules are applied before being passed to the page, and the results are cached. 1000+ vectors on a single page is a big performance blocker, which vector tiles aim to solve.

Now there is one way I can think of getting around this, when you do the initial Django Query or possibly on Save of features to the db. Calculate the length and width of the feature. Using a lookup table of zoom levels and max width/length, assign a zoom level to the object for when it should switch from point marker to real rendering. Now you have a fast compare for OpenLayers to work off (simple integer compare), or an easy way to filter on the django request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants