Add web map in app studio

920
6
Jump to solution
02-05-2020 05:02 PM
CraigGadaloff
New Contributor II

Hi,

I have succeeded in adding a web map in App studio but when I replace the code with my company web map it doesn't work. 

I'm completely new to this. How do I change the code to get organisational web maps to load?

Thanks in advance 

App {
    id: app
    width: 414
    height: 736
    property real scaleFactor: AppFramework.displayScaleFactor
    property string portalUrl: "https://myorganisation.maps.arcgis.com";
    property string trailheadsItemID: "mycompanywebmapid"
    Portal {
        id: arcgisOnline
        url: portalUrl
        loginRequired: false
    }
0 Kudos
1 Solution

Accepted Solutions
6 Replies
ErwinSoekianto
Esri Regular Contributor

Craig, 

What sample or template in AppStudio are you using?

Erwin

0 Kudos
CraigGadaloff
New Contributor II

I've tried a few. I just created this map : Add layers to a map | ArcGIS for Developers 

If I substitute the feature layer and URL for my organisations then it doesn't show up. I'm just not sure how to get access to them. I registered and generated a client ID in settings>licencing>ArcGIS Client ID but do I have to do something else?

Are there any worked examples of this with screenshots?

0 Kudos
ErwinSoekianto
Esri Regular Contributor

I see, are you still using the item in ArcGIS Online or ArcGIS Enterprise? if you are using ArcGIS Online, keep the portalUrl the way it was, 

property string portalUrl: "https://arcgis.com";

Is the item private or shared publicly? You would only need ArcGIS Client ID, if the item is private. If you are using ArcGIS Online, you can easily get the ArcGIS Client ID by going to Setting of the app > Licensing > ArcGIS Client ID > Register > Apply. Make sure the app is uploaded first. 

0 Kudos
CraigGadaloff
New Contributor II

Hi Erwin. It is shared privately. So here I  added in my private URL (ArcGIS client ID is registered as above) in the exercise  Add layers to a map | ArcGIS for Developers but only the public maps show.

property string parksURL: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space/FeatureServer/0"

property string trailsURL: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails/FeatureServer/0"
property string parksURL: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space/FeatureServer/0"
ADDED IN (From URL link in AGOL) property string myfeaturelayernameURL: "https://services9.arcgis.com/my feature layer id/arcgis/rest/services/myfeaturelayername/FeatureServer"
 Map{
                    id:map
                    BasemapImagery {}
                    FeatureLayer {
                                ServiceFeatureTable {
                                    url: trailheadsURL
                                }
                            }
                    FeatureLayer {
                                ServiceFeatureTable {
                                    url: parksURL
                                }
                            }
                            FeatureLayer {
                                ServiceFeatureTable {
                                    url: trailsURL
                                }
                            }
                            FeatureLayer {
                                ServiceFeatureTable {
                                    url:myfeaturelayernameURL
                                }
                            }
0 Kudos
CraigGadaloff
New Contributor II

Sharing option is set as:

My organization NOT Not shared (private)

0 Kudos
ErwinSoekianto
Esri Regular Contributor
0 Kudos