How to get the url of a layer within an mmpk

631
2
Jump to solution
04-10-2019 10:15 PM
by Anonymous User
Not applicable

If I load up a webmap into a MapView, and then go ahead and get a reference to a particular layer in it, I can then log out the service url of the associated feature table.

e.g.

console.log(layer.featureTable.url)

I then go ahead and use the OfflineMapTask to take that web map offline into a mobile map package. Then I load up that same mmpk into a MapView. I get a reference to the same layer and try to log out the url but get "undefined".

If I open up the "mobile_map.mmap" file from the mmpk in a text editor, I can see that all the service urls do exist in there, so the information is brought offline, I just don't know how to surface that information.

Does anyone know how to access the original service url of a layer from the mmpk, given this workflow?

cheers,

-Paul

0 Kudos
1 Solution

Accepted Solutions
LukeSmallwood
Esri Contributor

Hi Paul,

I think the way to do this is by accessing the serviceUrl property of the geodatabase which provides the data for the offline feature layer.

One approach to get to that would be something like:

- get the operationalLayers from the map

- find the layer you are interested in

- cast the layer to a feature layer and get it's featureTable

- cast the feature table to a geodatabase feature table

- access the geodatabase property of the table

I hope that's helpful,

Luke

View solution in original post

0 Kudos
2 Replies
LukeSmallwood
Esri Contributor

Hi Paul,

I think the way to do this is by accessing the serviceUrl property of the geodatabase which provides the data for the offline feature layer.

One approach to get to that would be something like:

- get the operationalLayers from the map

- find the layer you are interested in

- cast the layer to a feature layer and get it's featureTable

- cast the feature table to a geodatabase feature table

- access the geodatabase property of the table

I hope that's helpful,

Luke

0 Kudos
by Anonymous User
Not applicable

Thanks Luke - yes that seems to work, thank you!

0 Kudos