Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

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

$
0
0

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!


Viewing all articles
Browse latest Browse all 2896

Trending Articles