CartoDB / mobile-sdk

CARTO Mobile SDK core project
https://carto.com/docs/carto-engine/mobile-sdk/
BSD 3-Clause "New" or "Revised" License
179 stars 65 forks source link

HTTPTileDataSource wikimapia #535

Open StalkerExplorer opened 1 year ago

StalkerExplorer commented 1 year ago

Hello, how to use wikimapia with HTTPTileDataSource? Is that possible?

But it doesn't work: int minZoom=0; int maxZoom=20; String mapUrl="http://i{s}.wikimapia.org/?x={x}&y={y}&zoom={z}&r=0&type=map&lng=0"; String servers="(x%4)+(y%4)*4"; StringVector mStringVector=new StringVector(); mStringVector.add(servers); HTTPTileDataSource mHTTPTileDataSource=new HTTPTileDataSource(minZoom, maxZoom, mapUrl);

Could you help me with that sample code, thank you so much.

mtehver commented 1 year ago

Hello. If I understand correctly, the server hostname part depends on tile coordinates? In that case you need to create a custom subclass of HTTPTileDataSource and you need to override its buildTileURL method, which takes 2 arguments: baseURL (which you can basically ignore) and mapTile, which you need to use to form correct map URL.