Unfolding: Changing style on adjacent maps

edited November 2013 in Library Questions

Hi I am new to processing and was hoping for a bit of help. I am making an interactive map with the Unfolding maps library. There are two adjacent maps that are right now in default tile map style. I want to change them to "new StamenMapProvider.Toner()"

Usually the command to change the style goes after the "this", I have put it everywhere in the line, but I can't successfully change the style. I keep getting the error message that the line is undefined. I am using Processing 1.5 on a Mac 10.8.5. Thanks in advance for your help.

My Code:

import de.fhpotsdam.unfolding.providers.StamenMapProvider;

UnfoldingMap map1;
UnfoldingMap map2;
SimplePointMarker legendreMarker;

void setup() {
    size(800, 500, GLConstants.GLGRAPHICS);
    Location legendreLocation= new Location(45.537317, -73.651852);
    map1 = new UnfoldingMap(this, "map1", 0, 0, 395, 500);


    map1.zoomAndPanTo(legendreLocation, 13);
    float maxPanningDistance = 5;
    map1.setPanningRestriction(legendreLocation, maxPanningDistance);

    map2 = new UnfoldingMap(this, "map2", 405, 0, 395, 500);
    MapUtils.createDefaultEventDispatcher(this, map1, map2);
}

void draw() {
    map1.draw();
    map2.draw();
}    

Answers

  • Answer ✓

    The constructor to use both specific dimensions and a custom map provider is a bit more complicated, sorry for that. But there is an example in the Unfolding distribution which does exactly what you want: MultiProviderMultiMapApp.

    So, in you case (assuming your second map should be the Stamen one):

    map2 = new UnfoldingMap(this, "map2", 405, 0, 395, 500, true, false, new StamenMapProvider.Toner());
    
  • Thank you very much for your help! By the way this library has brought me hours of fun! Thanks!

  • Can anyone confirm if unfolding works in the latest version of processing?

Sign In or Register to comment.