Loading...
Logo
Processing Forum
Hello,
After working with processing for a bit and hacking my way through many examples I have a problem I can not figure out that should be easy to solve, (I hope...) In my project I need to place a map on the screen but not the whole screen. I am using ModestMaps for my map application. I have created a sample sketch as an example, as the project sketch is far to large. My goal is to get the map where the rectangle is and have the rest of the screen for other uses. See Sketch:

Also, how would you place multiple maps on the screen?

Copy code
  1. import processing.opengl.*;
  2. import com.modestmaps.*;
  3. import com.modestmaps.core.*;
  4. import com.modestmaps.geo.*;
  5. import com.modestmaps.providers.*;

  6. InteractiveMap map;

  7. void setup() {
  8.   size(1600, 900, OPENGL);
  9.   String template = "http://{S}.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.png";
  10.   map = new InteractiveMap(this, new Microsoft.HybridProvider());
  11.   map.setCenterZoom(new Location(33.127812, -117.147779),12);
  12.  }
  13.   
  14. void draw() {
  15.   background(0);
  16.   map.draw();
  17.   // Added for example only.
  18.   // Instead of map being full screen, I would like it here.
  19.   rect(1000,20,500,300);  
  20. }
  21.   
  

Replies(4)

Moved there because the answer probably depends on the capabilities of the library you use.
One solution is to make the library to draw on a PGraphics: you can then draw this PGraphics at an place that suits you. But the library must offer this feature, otherwise it can be harder to do.
Thank you Phil.ho for the response. I got the program to work by masking over the map and moving the x,y of the center of the map, however it seems a waist of resource to have to draw on the whole screen. I contacted the author of the library and he wasn't sure if the application could be windowed as he hadn't worked with the app in a while.

I am going to try Unfolding, however I am having issues with the .de library as Processing cant seem to find the actual library even though it is loaded in the libraries folder. (I think?) Never the less thank you for the response.

Ron
And after Unfolding is working (see other topic), this should be feasible in Unfolding. Do you want to create a rectangular map, or some other shape? In the former simply create an UnfoldingMap with x, y, and height and width. In the latter case I can provide you an mask example.
tillnm,
Thanks for the response... I haven't had a chance to work with UnFolding as I am finishing up my Arduino sensor board and fitting it with the GPS and Gyro today. I should have time tomorrow to play with unfolding. After reading the other topic I think I see my mistake. So I'll let you know how it goes. And yes, examples as always helpful as I am somewhat new to coding. The cool thing is I am picking it up pretty fast. Thanks for the help...

Thanks,
Ron