Select to view content in your preferred language

Creating a map tile package (tpkx) containing elevation data

511
1
05-12-2023 01:50 AM
Lybrica
New Contributor

Our android app (100.15.1) is using 

SpatialReferences.getWgs84()

 I'm trying to create a tpkx file in ArcGIS pro, but I can't figure out what "Service" to specify for the tiling scheme?

I was succesful in creating DTED2 files from local TIF file raster. Loaded the dt2 files and used

getElevationAsync(point)

to retrive the elevation at specified coordinates.

But the Basic licence doesn't support RasterElevationSource, so as soon as setting the licence, the raster fails to load.

0 Kudos
1 Reply
MichaelBranscomb
Esri Frequent Contributor

It should be the URL of a service that has a tiling scheme with LERC compression.

I just ran through this workflow and took a slightly different approach that might also work for you.

1. Use GenerateTileCacheTilingScheme and use the built-in tiling schemes provided with ArcGIS Pro but the key is to specify LERC for compression (note I used the GUI then copied as a Python script to share here):

arcpy.management.GenerateTileCacheTilingScheme(
    in_dataset="ColoradoNewMexicoUtahArizona.tif",
    out_tiling_scheme=r"C:\Users\mike\Documents\ArcGIS\LERC.xml",
    tiling_scheme_generation_method="PREDEFINED",
    number_of_scales=23,
    predefined_tiling_scheme=r"C:\Program Files\ArcGIS\Pro\Resources\TilingSchemes\WGS84_Geographic_Coordinate_System_V2.xml",scales="295828763.7958547;147914381.89792734;73957190.94896367;36978595.474481836;18489297.737240918;9244648.868620459;4622324.4343102295;2311162.2171551147;1155581.1085775574;577790.5542887787;288895.27714438934;144447.63857219467;72223.81928609734;36111.90964304867;18055.954821524334;9027.977410762167;4513.9887053810835;2256.9943526905417;1128.4971763452709;564.2485881726354;282.1242940863177;141.06214704315886;70.53107352157943",
    scales_type="SCALE",
    tile_origin="-400 400",
    dpi=96,
    tile_size="256 x 256",
    tile_format="LERC",
    tile_compression_quality=0,
    storage_format="COMPACT",
    lerc_error=0.1
)

 

2. Use CreateMapTilePackage and provide the tiling scheme created above:

arcpy.management.CreateMapTilePackage(
    in_map="Map",
    service_type="EXISTING", output_file=r"C:\Users\mike\Documents\ArcGIS\ColoradoNewMexicoUtahArizonaLERC.tpkx",
    format_type="PNG",
    level_of_detail=11,
    service_file=r"C:\Users\mike\Documents\ArcGIS\LERC.xml",
    summary="1 degree digital elevation model for Colorado, New Mexico, Utah and Arizona, USA (Data Basin Dataset)",
    tags="Data Basin Dataset, dem, elevation, four corners, southwest, USA, United States, Colorado, New Mexico, Utah, Arizona, pinyon",
    extent='-115.928396882076 30.4495284592416 -101.072556060999 42.5504476524816 GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]',
    compression_quality=75,
    package_type="tpkx",
    min_level_of_detail=0,
    area_of_interest=r"in_memory\feature_set1",
    create_multiple_packages=None,
    output_folder=None
)

 

0 Kudos