Mapping graphs on a open street map

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Mapping graphs on a open street map

abergel
Hi!

Several times we were asked how to map chart and graph on top of a geographical map. Here is a short example. Hope it is useful to someone.

http://ws.stfx.eu/11NOBLH3SIYO
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
v := RTView new.
map := RTOSM new.
e := map element.


v add: e.

paris := 48.8567 @ 2.3508.
newyork := 40.7127 @ -74.0059.
london := 51.507222@ -0.1275.
v @ RTDraggableView.
data := { { paris . { 10 . 5 . 10 . 3 . 10 .6 . 8 } }.
{london . { 5 . 3 .3 . -5 } } .
{newyork . { 5 . -2 . 10 . 15 . -10 }}  }.
data do: [ :tupple |
| grapher dataSet |
grapher := RTGrapher new.
grapher extent: 150 @ 100.
dataSet := RTStackedDataSet new 
points: tupple second.
dataSet barShape width: 10; color: Color red.
grapher add: dataSet.

grapher axisY.
grapher axisX noLabel; noTick.
grapher build.

allGraphElements := grapher view elements.
v addAll: allGraphElements.
allGraphElements translateTo: (map latLonToRoassal: tupple first)
].
v canvas camera translateTo: (map latLonToRoassal: paris).
v canvas camera noInitializationWhenOpen.
v canvas camera scale: 0.1.
v
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Cheers,
Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev