We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I combined all 17 lines of code and, while the map appears, the mouse does not generate the lat/lon coordinates as shown in the tutorial. The code is as follows:
import de.fhpotsdam.unfolding.*; import de.fhpotsdam.unfolding.geo.*; import de.fhpotsdam.unfolding.utils.*;
UnfoldingMap map; //Initialize a new map object and add the default event function for basic interaction (double-click to zoom and drag to pan the map).
void setup() { size(800, 600); map = new UnfoldingMap(this); MapUtils.createDefaultEventDispatcher(this, map); }
void draw() { map.draw(); Location location = map.getLocation(mouseX, mouseY); fill(0); text(location.getLat() + ", " + location.getLon(), mouseX, mouseY); }
Answers
Please edit your post, select your code and hit ctrl+o to format your code. Make sure there is an empty line above and below your code.
Link to the OP code here: http://unfoldingmaps.org/tutorials/basic-how-to-use-unfolding
Tagging @tnagel: Any ideas why text doesn't in this code as in the website? Thxs.
@fredakaub You can use println or this next approach:
surface.setTitle(location.getLat() + ", " + location.getLon());
Kf
I would assume @fredakaub is using Unfolding beta for P3 which does not support the default renderer. If that is the case please use P2D or P3D in setup.
Thanks @kfrajer for answering so many questions about Unfolding, making me aware of discussions, and being an overall amazing forum guru! :)
I selected my code above and typed Ctrl+o . I was taken to my download folder. I opened Processing, loaded my sketch and typed Ctrl+o. This time I was asked to download a sketch. I entered a name and it loaded it. No formatting. I tried "P2D" as the third parameter in Size and the sketch died with the following message: "java.lang.NoSuchFieldError: quality" I typed in the suggested line above starting with "surface.setTitle( . . ." and the latitude and longitude appeared in the title. I tried println and it produced the latitude and longitude where println messages go but not on the screen. Can you direct me to someplace that will tell me how to format a sketch for requesting help?
You need to edit your post. In your post, on the top right side, there is a gear icon. Click on the icon and it will give you the option to edit. Then, select your code and hit ctrl+o.
What OS are you using? Changing the renderer did the trick for me.
Kf
@tnagel I am glad I can help
@Fred_Stout Is it working now for you?
Kf
Thank you for your responses. I had to move to another project but I will get back to Unfolding Maps. Thanks again - my apologies for the late response.