Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OsmDroid and MapQuest: How can I use JPEG tiles?

I am new to OSM and OSMdroid.

I was following this pretty good tutorial to show offline maps. So basically what I have done is:

  • Created a tile package in zip format with Mobile Atlas Creator
  • Used MapQuest source, JPEG format
  • Put the zip into the right folder: /mnt/sdcard/osmdroid/

The problem was the tiles were not rendered. I got a blank page.

I found this solution, to solve my problem.

But now, it is bothering me that I have to use PNG files, that takes significantly more space. It is not really efficient for my app because the user will have to download a much larger package.

MY QUESTION IS: How can I use JPEG tiles with OSMDroid and MapQuest?

Thanks in advance.

like image 292
raver99 Avatar asked Oct 04 '22 23:10

raver99


1 Answers

This works to get JPGs instead of PNGs:

MapView myOpenMapView;
myOpenMapView = (MapView) findViewById(R.id.openmapview);
myOpenMapView.setTileSource(new XYTileSource("MapquestOSM", ResourceProxy.string.mapquest_osm, 0, 18, 256, ".jpg", new String[] {
                "http://otile1.mqcdn.com/tiles/1.0.0/map/", "http://otile2.mqcdn.com/tiles/1.0.0/map/", "http://otile3.mqcdn.com/tiles/1.0.0/map/",
                "http://otile4.mqcdn.com/tiles/1.0.0/map/" }));

Notice ".jpg" in line 3.

like image 155
Sorcerer Avatar answered Oct 10 '22 04:10

Sorcerer