0

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?

  • please show us what you have tried so far so that we can see where to help – Ian Turton Jul 8 '16 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 Nov 21 '16 at 22:13
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, privacy policy and cookie policy

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