Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using custom tiles in Processing IDE #16

Closed
csteinlehner opened this Issue May 8, 2012 · 9 comments

Comments

Projects
None yet
3 participants
@csteinlehner
Copy link
Collaborator

commented May 8, 2012

If you use a custom map tiles set in the Processing IDE you need manually copy the SQLite jar to the code or library folder and then point with an absolute path to the TileMill mbtiles file. Maybe there is a easier solution for that?

@tillnagel

This comment has been minimized.

Copy link
Owner

commented May 9, 2012

You'll find the SQLite library here: http://www.zentus.com/sqlitejdbc/

@tillnagel

This comment has been minimized.

Copy link
Owner

commented May 9, 2012

You can also put the MBTiles file into the data-directory of your sketch, and use Processing's sketchPath() method.

import processing.opengl.*;
import codeanticode.glgraphics.*;
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.providers.*;
import de.fhpotsdam.unfolding.geo.*;
import de.fhpotsdam.unfolding.utils.*;

de.fhpotsdam.unfolding.Map map;

void setup() {
  size(800, 600, GLConstants.GLGRAPHICS);

  String mbtilesPath = "jdbc:sqlite:" + sketchPath("./data/muse-dark-2-8.mbtiles");
  map = new de.fhpotsdam.unfolding.Map(this, 0, 0, width, height, new MBTilesMapProvider(mbtilesPath));
  MapUtils.createDefaultEventDispatcher(this, map);
  map.setZoomRange(2, 8);
}

void draw() {
  background(0);
  map.draw();
}

@tillnagel tillnagel closed this Oct 25, 2012

@tillnagel

This comment has been minimized.

Copy link
Owner

commented Dec 3, 2012

(Copied from Yiannis, via blog comment)

Hi Till, thank you for this awesome tool. I'm trying to load a mbtiles file using the following example #16
i've placed my mbtiles file into a "data" folder into sketchbook.When i run processing, i have no errors but all i get is a black display, i have set my map zoom range according to the limits of my exported mbtiles file (6MB), but still nothing...any ideas?

@tillnagel

This comment has been minimized.

Copy link
Owner

commented Dec 3, 2012

Have you downloaded and installed the needed external SQLite JDBC driver, and tried running the example MBTilesApp?

@yiannis83

This comment has been minimized.

Copy link

commented Dec 3, 2012

Thank you for your reply, yes i've installed sqlite library and i'm running perfectly the following example where the map shows up, the problem appears when i change to my mbtiles file (resaved it several times)!

import de.bezier.data.sql.*;

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

import processing.opengl.;
import codeanticode.glgraphics.
;

de.fhpotsdam.unfolding.Map map;

void setup() {
size(800, 600, GLConstants.GLGRAPHICS);

String mbtilesPath = "jdbc:sqlite:" + sketchPath("./data/muse-dark-2-4.mbtiles");
map = new de.fhpotsdam.unfolding.Map(this, 0, 0, width, height, new MBTilesMapProvider(mbtilesPath));
MapUtils.createDefaultEventDispatcher(this, map);
map.setZoomRange(2, 20);
}

void draw() {
background(0);
map.draw();
}

@tillnagel

This comment has been minimized.

Copy link
Owner

commented Dec 3, 2012

Ok, good. And I agree, that means everything is installed correctly.

You said there are no errors in Processing's message area. Meaning, it seems being able to find and read the file. So, the only possible issue is your exported map still somehow is not fitting the visible area.

Just to exclude everything: Did you try zooming in after you started your sketch? Setting the zoom range does not automatically zoom the map into that range. It only restricts user interactions. So, if you exported your map for zoom levels from 2 up, it might not appear in the very beginning.

@tillnagel

This comment has been minimized.

Copy link
Owner

commented Dec 3, 2012

Yiannis problem has been solved. It was the wrong library (with a similar name). Unfolding needs SQLite, as described and linked in the MBTilesApp example.

For others stumbling over the same isse, the current latest release is http://www.xerial.org/maven/repository/artifact/org/xerial/sqlite-jdbc/3.7.2/sqlite-jdbc-3.7.2.jar
Be aware there might be a newer version, which you'll find at http://code.google.com/p/sqlite-jdbc/

@yiannis83

This comment has been minimized.

Copy link

commented Dec 3, 2012

As you said i had installed the wrong SQlite, i installed the correct one from here http://code.google.com/p/sqlite-jdbc/
and now everything works fine.Thanks a ton!

@tillnagel

This comment has been minimized.

Copy link
Owner

commented May 20, 2013

Just fyi: SQLite moved to https://bitbucket.org/xerial/sqlite-jdbc/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.