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
Is it possible to draw and animate polylines with polymaps? #91
Comments
You'd have to interpolate the feature's geometry coordinates (perhaps with d3.js?) and force a redraw of the var map = po.map();
var layer = po.geoJson();
var coords = [...]; // your coordinates here
var feature = {type: "Feature", geometry: {type: "LineString", coordinates: coords}, ...};
layer.features([feature]);
map.add(layer);
// force a redraw
map.dispatch({type: "move"}); |
Thanks for your reply. Can you explain what you mean by interpolate the feature's geometry coordinates? Is the polyline 'the feature'? From a quick look at d3 it looks like I could use that to select the individual svg paths. I don't want to move the map layer, just the line. I mocked up a quick example when I started looking at the problem - http://jsfiddle.net/codecowboy/XkShV/. This is the effect I would like: |
You can call layer.reload to redraw the layer. |
So yeah, I guess the answer to your original question is no: Polymaps can't animate polylines out of the box. The idea I was getting at in my previous comment was that you would keep references to the GeoJSON feature ( |
ok, thanks for your replies guys ;-) |
This might be a stupid question, but how does layer.redraw() work in practice? layer = map.add(po.geoJson().url("hki.json")) ...does not seem to work. |
Just in case anyone happens to come across this looking for an answer to jensfinnas's question, it's layer.reload not layer.reload() |
I would like to create a map which displays a route passing through several points. I would then like to clone this route (a series of polylines) and animate it by filling the polyline with another colour. The fill would extend as far as a user has travelled along the route.
Would something like this be possible using polymaps?
The text was updated successfully, but these errors were encountered: