Unfolding Maps: Can't initialize a map and set the size/position

edited May 2016 in Library Questions

Hi All,

I'm relatively new at this so please be kind, I'm sorry if this is a super dumb question.

I am trying to make a basic map using the unfolding maps library (which I intend to incorporate into another sketch once I can get it working). I have been able to get the map running at full window size, but I need to scale it down. From everything I have read this should be relatively simple- just some position and size parameters added to the initializer. However, when I do this (no matter what parameters I use) the map goes to position: 0,0 and size: 500 x 500px (approx). (see image)

Here is the code I've got:

import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.core.*;
import de.fhpotsdam.unfolding.data.*;
import de.fhpotsdam.unfolding.events.*;
import de.fhpotsdam.unfolding.geo.*;
import de.fhpotsdam.unfolding.interactions.*;
import de.fhpotsdam.unfolding.mapdisplay.*;
import de.fhpotsdam.unfolding.mapdisplay.shaders.*;
import de.fhpotsdam.unfolding.marker.*;
import de.fhpotsdam.unfolding.providers.*;
import de.fhpotsdam.unfolding.texture.*;
import de.fhpotsdam.unfolding.tiles.*;
import de.fhpotsdam.unfolding.ui.*;
import de.fhpotsdam.unfolding.utils.*;
import de.fhpotsdam.utils.*;
import de.fhpotsdam.unfolding.providers.Google;

AbstractMapProvider p1 = new Google.GoogleSimplifiedProvider();
UnfoldingMap map;

void settings() {
  size(800, 800, P2D); 

  map = new UnfoldingMap(this, 100, 100, 100, 100, p1 ); //this line positions the map at 0,0 and around 500,500 size-see above image
  //map = new UnfoldingMap(this, p1 ); //this works properly but the map is full screen
}

void setup() {

  //map = new UnfoldingMap(this, p1 ); if I try to put this line here I get this error: java.lang.NoSuchFieldError:quailty (unless I removed P2D from size)
  Location melbourneLocation = new Location(-37.815924f, 144.966815f);
  float maxPanningDistance = 0.5; // in km
  map.zoomAndPanTo(15, melbourneLocation);
  map.setPanningRestriction(melbourneLocation, maxPanningDistance);
  map.setZoomRange(14, 18);
  MapUtils.createDefaultEventDispatcher(this, map);
}

void draw() { 

  map.draw();
}

Any help would be amazing!

Tagged:

Answers

  • Answer ✓

    You did everything right, but are using a version of Unfolding not working with Processing 3. (But hey, you are the first to manage to kind of make it work by using settings to initiate. Wow. :)

    To use it properly you have to use the Unfolding beta (I'll send you via private message) and then initiate Unfolding normally in setup - and setting position and dimension should work then.

  • Thats awesome, it's all working perfectly now! Thanks so much! :)

  • May you share link to me too?

  • @tnagel Would it be possible to use your version of unfolding maps for Processing 3? I tried running the code in P2 but it did not work.

    Thanks you,

    Kf

  • @kfrajer @chuji000 Didn't see your posts. Send us an e-mail and we'll give you a beta.

  • @tnagel : can you send me that unfolding beta version too , even i am working on processing 3 but now that window always open up like above screenshot.

  • @tnagel : solved my issue now

  • @tnagel : can you send me that beta version too, I'm currently using version 0.9.6 (by default in contribution manager of processing3.0). However I have issue with displaying markers = they jsut don't show up... could it be related to an outdated library ? Thks for helping !!!

Sign In or Register to comment.