1

I am building a android map application and i want to use as basemap some wmts url services of our country.

How can i implement this and get layers from WMTS url services as TileOverlay to google map android api? Example:

Wmts source: http://geoportal.asig.gov.al:85/utm34n/wmts/1.0.0/WMTSCapabilities.xml

the tileoverlay url inside xml configuration:

http://geoportal.asig.gov.al/Services/host/host.ashx?url=http://localhost:85/utm34n/ortofoto/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.jpg

but Google Map Android Api needed this configuration of url:

http://my.image.server/images/x/y/z.png

x- x coordinate ( start from 0 to maxwidth) y- y coordinate ( start from 0 to maxheight) z- Zoom

refer to documentation: https://developers.google.com/maps/documentation/android-api/tileoverlay

How can I format the url from the wmts service ResourceURL( from WMTSCapabilities.xml), to integrate inside google map android api?

2
  • please show us what you have tried so far so that we can see where to help
    – Ian Turton
    Commented Jul 8, 2016 at 13:59
  • How far have you managed to progress with this? I have similar capabilities xml defining wmts but don't know how to approach this..
    – wtk
    Commented Nov 21, 2016 at 22:13

2 Answers 2

1

Maybe you already found solution but anyway. Like in the documentation is: /* Define the URL pattern for the tile images */ String s = String.format("http://my.image.server/images/%d/%d/%d.png", zoom, x, y);

Change the path to this and then: tilematrix=zoom, tilecol=x and tilerow=y

String s = String.format("http://geoportal.asig.gov.al/Services/host/host.ashx?url=http://localhost:85/utm34n/ortofoto/UTM34N/%d/%d/%d.jpg",zoom,x,y)

0

Using esri map you can call wmts services

WmtsService wmtsService = new WmtsService(getString(R.string.wmts_url));
wmtsService.addDoneLoadingListener(() -> {
  if (wmtsService.getLoadStatus() == LoadStatus.LOADED) {
    // get service info
    WmtsServiceInfo wmtsServiceInfo = wmtsService.getServiceInfo();
    // get the first layer id
    List<WmtsLayerInfo> layerInfoList = wmtsServiceInfo.getLayerInfos();
    // create WMTS layer from layer info
    WmtsLayer wmtsLayer = new WmtsLayer(layerInfoList.get(0));
    // set the basemap of the map with WMTS layer
    map.setBasemap(new Basemap(wmtsLayer));
  } else {
    String error = "Error loading WMTS Service: " + wmtsService.getLoadError();
    Log.e(TAG, error);
    Toast.makeText(this, error, Toast.LENGTH_LONG).show();
  }
});wmtsService.loadAsync();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.