[GIS] Polymaps + D3+ Polyline with different width and color

javascriptlinepolyline-creationpolymaps

I am actually working on a project which involves polymaps and D3. I was wondering if you could help me on this.

I have 4 locations and I would like to draw a polyline from one location to other 3 location with different widht and color of the polyine. I was wondering if you guys could give me a starting point or maybe a sample code. I think this will be possible by D3.

I also do not understand the locationPoint method, passing in {lat: 0, lon: 0}. or coordinatePoint, passing in {row: 0.5, column: 0.5, zoom: 0},

Also I did try this link http://webcache.googleusercontent.com/search?q=cache:ZJcQP6qOvBwJ:https://github.com/simplegeo/polymaps/issues/91+&cd=1&hl=en&ct=clnk&gl=in
and
http://webcache.googleusercontent.com/search?q=cache:ZJcQP6qOvBwJ:https://github.com/simplegeo/polymaps/issues/91+&cd=1&hl=en&ct=clnk&gl=in but could not understand.

Thanks for your time.

Best Answer

I'm not certain I understand the entirety of your question. I do not think you need D3 for the task you describe.

You could define your polyline directly in GeoJSON, and provide it as a GeoJSON file using an URL. Take a look at the .url and .geoJson methods at http://polymaps.org/docs/geoJson.html#po.geoJson -

As for the styling, you should be able to style your polyline using css. In Polymaps, assign an id to the layer:

map.add(po.geoJson()
    .url("...")
    .id("roads"));

then, provide a style in the map css file:

#roads path {
  stroke: rgb(255,0,0);
  fill: none;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}
Related Question