Not able to export tiles for basemaps

3883
14
06-30-2019 11:52 PM
DevendraKhatri
New Contributor III

Requirement:

I need to provide basemaps in offline mode, I should be able to download basemap's tiles in mobile device and use it when no connectivity.

My scenarios:

1. I create the feature with ESRI's default basemap, I use the OfflineMapTask on mobile,  I am not able to download .vtpk file.

2. I create my custom base layer on developers portal, create feature with it, when I use the OfflineMapTask on mobile I am able to download .vtpk file

Observation in Arcgis online layer settings page:

1. Default basemap's setting page is different from that of custom basemap. Setting page for custom basemap shows me tile's datasource, for default basemap it gives me option to build tiles !!

Another observation with using rest api [../exportTiles?tilePackage=true&exportExtent=-13051380,4030276,-13037288,4041136&optimizeTilesForSize=true&compressionQuality=60&exportBy=levelId&levels=13-19&areaOfInterest=&f=json ]  

1. With default basemap it doesn't give me the jobid and it says    

{"error":{"code":400,"message":"Exporting tiles is not allowed.","details":[]}}

2. With custom basemap it  give me the jobid 

Question:

ESRI's default basemaps are not capable of downloading the tiles? or it requires any configuration !

0 Kudos
14 Replies
MarkBaird
Esri Regular Contributor

Hi

The default basemaps are currently for online use only, however offline enabled services are available on ArcGIS Online.  There are a few available here:

https://tiledbasemaps.arcgis.com/arcgis/rest/services/

These services have the exportTiles request enabled which  you can see on this service for example:

https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Street_Map/MapServer

You can see the capabilities if you scroll down to the bottom of the page:

You might also find the following doc useful reading:

https://enterprise.arcgis.com/en/portal/latest/use/take-maps-offline.htm#ESRI_SECTION2_384E9B7E99EC4...

Does this help?

0 Kudos
DevendraKhatri
New Contributor III

Hey Mark,

Need one more info here.

All the base maps that are mentioned in https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Street_Map/MapServer are with Spatial Reference 3857.

Do we have public basemaps with different spatial references and are export tiles capable !

Also, I read we can create our own basemaps, do we need specific licence for that !

Thanks

0 Kudos
MarkBaird
Esri Regular Contributor

Hi Devendra,

Maps are available in other spatial references, but maybe you can tell me what you are looking for?  Is there a regional area or particular basemap you are wanting to get data for?

You are correct you can create your own basemaps from raw data and you would be looking at using ArGIS Pro for this task to either create a local data or publish your data to a server based service.  Again it's worth telling us a little more about what you are trying to achieve.

Mark

DevendraKhatri
New Contributor III

I need some basemap urls with different spatial references so that I can make my app compatible with such configurations. I do not have access to ArcGIS pro so I will not be able to create any, but my clients might have.

But I want such URLs support in my app. If you can provide me different URLs that are public and offline capable it will be grateful.

thanks for the response.

0 Kudos
DevendraKhatri
New Contributor III

Thanks !

I missed the point mentioning I need free basemaps, as I read, looks like these tiled base maps aren't free, it needs an ArcGIS online named user credentials, which is, unfortunately, not going to work in my case, sorry that I forgot to mention about this. What I need is free basemaps that are offline capable, which I can show to users directly in form of tiles or any other possible way ! 

Are there any configuration to provide offline-capable free basemaps !

one more observation though,

this url is free and export tiles enable, but it is not available for all types of basemaps !
0 Kudos
Nicholas-Furness
Esri Regular Contributor

Hi Devendra.

Firstly, don't use the Sample Servers. Those are for supporting samples only. They will not support a production app.

Secondly, there are two types of basemaps. Raster Basemaps (with pre-baked pixel-based tiles) and Vector Basemaps (which are rendered on the fly in the client app). When you take them offline, Raster Basemaps will generate a .TPK file and Vector Basemaps will generate a .VTPK file.

Thirdly, we have separate "For Export" raster basemaps and vector basemaps (see here - look at the descriptions to see which are vector). In the case of Raster basemaps, we have separate "For Export" versions to ensure that the performance of our standard basemaps is not impacted by requests to package them up to TPK files. In the case of Vector basemaps, you can generate a .VTPK from the standard or "For Export" versions, and the difference is that the "For Export" versions have fewer fonts embedded so make for a smaller file (usually about 75Mb smaller), though you might not get as rich global labeling so be sure to evaluate the suitability for your needs.

Now, to your issue:

Our basemaps are free but we require authentication to take them offline for measuring usage.

One way to authenticate (which you mention) is with a named user. But another way, which will work in your scenario, is App ID authentication (note that at this time you cannot use App ID authentication to access any private data of yours hosted by us, but that's not relevant in this case). To use App ID you need to obtain a token by hitting the HTTPS token rest endpoint with a POST, passing in client_id, client_secret, a grant_type of "client_credentials", and optionally a duration. See this Swift example. And this documentation.

Using the token you get back from the above REST call, you can create a new Credential which you can use with the calls to take the basemaps offline.

To get the client_id and client_secret above, you must sign up for a free developers account over at ArcGIS for Developers then, in your dashboard, create a new Application. You can get Client ID and Client Secret from the new Application's summary page. Be aware that if someone gets hold of your Client ID and Client Secret, they effectively have access to your account to use up all your credits and manipulate your content so make sure you embed them securely in any app you distribute (if you suspect they've ever leaked, you can just create a new app, but that might involve deploying again).

Note, you can do all that for free as long as you don't make any revenue from your app. If you do make revenue from the app, you will have to sign up for a Builder Plan which allows for commercial app deployment.

Hope this helps.

Nick.

DevendraKhatri
New Contributor III

Thanks ! It helps...

Would one client_id  / client_secret pair suffice for any 'n' number of app installations !  

0 Kudos
Nicholas-Furness
Esri Regular Contributor

That’s correct, yes. It’s associated with the app regardless of the number of installs.

DevendraKhatri
New Contributor III

Is there any detailed documentation to understand the parameters that we use for exporting tiles in tpk / vtpk format.

https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/exportTiles?tilePackage=true&
exportExtent=-13051380,4030276,-13037288,4041136&optimizeTilesForSize=true&compressionQuality=60&exportBy=levelId&levels=13-19&areaOfInterest=&f=json

Mainly, I need to get understanding of coordinate system that is used in for exportTiles parameter, how do I get these x and y values, I tried with lat/long it did not give me results. 

Also,

the above given url exports tpk, are there vector basemaps available that are exportable ,so that I use vtpk.

0 Kudos