Loading tiles from http
Closed this issue · 3 comments
I would like to load the tiles from web and not from the filesystem. Would it be possible to do that? Would it be enough to change the implementation of https://github.com/moagrius/MapView/blob/master/src/com/qozix/mapview/tiles/MapTile.java#L107 ?
Yes, that method (decode) is where the bitmap is retrieved. This happens in a background thread in an AyncTask (https://github.com/moagrius/MapView/blob/master/src/com/qozix/mapview/tiles/TileManager.java#L261), which is published to the UI thread when complete, so in theory you should be able to run the http request in the decode method without any other updates. I'd be very interested to hear how it turns out, and see a sample in action, if it works and you wouldn't mind posting back.
This commit in my fork mohlendo@9842191 shows how to load tiles from server. In that version you can provide a protocol in the file pattern like
mapView.addZoomLevel(1024, 1024, "http://localhost:8080/tiles/256/0/%col%-%row%.png", 256, 256);
and the MapView loads them over http. If you provide no protocol, it loads the files as assets. Now it would be possible to add more protocol implementations like ftp etc...
Should I create a pull request in order to integrate that?
If have created a pull request now. So we can close this here and discuss the pull request.