Skip to main content
Solved

Read Layer name from AGOL


marta.podsiad
Supporter
Forum|alt.badge.img+9

Hi,

I would like to be able to read the name of the layers from AGOL that are shared with the same group. ArcGISOnlineConnector reads only the genaral name.

image

Best answer by nielsgerrits

marta.podsiad wrote:

I am really sorry but it does not work. There is sth wrong with HTTP Callerimage 

 

The error indicates that the service requires authentication. You need to configure the HTTPCaller to use a web connection. You can use the same web connection as you use on the ArcGISOnlineConnector.

 

2023-12-12_15h45_53

View original
Did this help you find an answer to your question?

9 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

Correct. The ArcGISOnlineConnector retrieves the item name from Portal. If you want to get the layer names from the service, you need the service url. This attribute (_webservice_url) can be retrieved from the ArcGISOnlineConnector. You can then use the url in a HTTPCaller to get the contents of the service. You can use the same webconnection as for the ArcGISOnlineConnector. You only need to add the query string parameter f = json to get json. You can then fragment and flatten the response with json["layers"][*] to get the layernames.


marta.podsiad
Supporter
Forum|alt.badge.img+9
  • Author
  • Supporter
  • November 22, 2023
nielsgerrits wrote:

Correct. The ArcGISOnlineConnector retrieves the item name from Portal. If you want to get the layer names from the service, you need the service url. This attribute (_webservice_url) can be retrieved from the ArcGISOnlineConnector. You can then use the url in a HTTPCaller to get the contents of the service. You can use the same webconnection as for the ArcGISOnlineConnector. You only need to add the query string parameter f = json to get json. You can then fragment and flatten the response with json["layers"][*] to get the layernames.

Hi, I think I managed to do some of the steps you mentioned.

imageHowerver, _json_response field is missing the information about the layer name. I should have "A5WTCS2_RAM_C_Centreline_Ln_01"

 

{"id": "a8c773f8c75d4353a54b97e8490697ae", "owner": "x.x@x", "created": 1697543079384, "isOrgItem": true, "modified": 1699886711664, "guid": null, "name": "1620016278_Mainline_Centreline", "title": "A5WTCS2_RAM_C_Centreline_Ln", "type": "Feature Service", "typeKeywords": ["ArcGIS Server", "Data", "Feature Access", "Feature Service", "Metadata", "providerSDS", "Service", "Hosted Service"], "description": "<div style='text-align:left;'><p><span style='font-size:12pt;'><b>CAD Model:\\u00a0</b></span><span style='font-size:16px;'>X-718736-PH2B-0800-Chainage v1.0</span></p><p><span style='font-size:16px;'><b>Converted:\\u00a0</b>17/10/2023</span></p></div>", "tags": [""], "snippet": "", "thumbnail": "thumbnail/thumbnail.png", "documentation": null, "extent": [[-7.490085703273247, 54.569679640849934], [-7.274980822826842, 54.79065897132162]], "categories": [], "spatialReference": "29900", "accessInformation": "", "licenseInfo": "", "culture": "en-gb", "properties": null, "advancedSettings": null, "url": "https://......../services/Hosted/1620016278_Mainline_Centreline/FeatureServer", "proxyFilter": null, "access": "shared", "size": 73693, "subInfo": 0, "appCategories": [], "industries": [], "languages": [], "largeThumbnail": null, "banner": null, "screenshots": [], "listed": false, "numComments": 0, "numRatings": 0, "avgRating": 0, "numViews": 450, "groupCategories": [], "scoreCompleteness": 40, "groupDesignations": null}

 

image


nielsgerrits
VIP
Forum|alt.badge.img+54
marta.podsiad wrote:

Hi, I think I managed to do some of the steps you mentioned.

imageHowerver, _json_response field is missing the information about the layer name. I should have "A5WTCS2_RAM_C_Centreline_Ln_01"

 

{"id": "a8c773f8c75d4353a54b97e8490697ae", "owner": "x.x@x", "created": 1697543079384, "isOrgItem": true, "modified": 1699886711664, "guid": null, "name": "1620016278_Mainline_Centreline", "title": "A5WTCS2_RAM_C_Centreline_Ln", "type": "Feature Service", "typeKeywords": ["ArcGIS Server", "Data", "Feature Access", "Feature Service", "Metadata", "providerSDS", "Service", "Hosted Service"], "description": "<div style='text-align:left;'><p><span style='font-size:12pt;'><b>CAD Model:\\u00a0</b></span><span style='font-size:16px;'>X-718736-PH2B-0800-Chainage v1.0</span></p><p><span style='font-size:16px;'><b>Converted:\\u00a0</b>17/10/2023</span></p></div>", "tags": [""], "snippet": "", "thumbnail": "thumbnail/thumbnail.png", "documentation": null, "extent": [[-7.490085703273247, 54.569679640849934], [-7.274980822826842, 54.79065897132162]], "categories": [], "spatialReference": "29900", "accessInformation": "", "licenseInfo": "", "culture": "en-gb", "properties": null, "advancedSettings": null, "url": "https://......../services/Hosted/1620016278_Mainline_Centreline/FeatureServer", "proxyFilter": null, "access": "shared", "size": 73693, "subInfo": 0, "appCategories": [], "industries": [], "languages": [], "largeThumbnail": null, "banner": null, "screenshots": [], "listed": false, "numComments": 0, "numRatings": 0, "avgRating": 0, "numViews": 450, "groupCategories": [], "scoreCompleteness": 40, "groupDesignations": null}

 

image

You need to have _webservice_url not _private_url.

 

You can enable this in the ArcGISOnlineConnector in the Attributes to Add section.


marta.podsiad
Supporter
Forum|alt.badge.img+9
  • Author
  • Supporter
  • November 23, 2023
marta.podsiad wrote:

Hi, I think I managed to do some of the steps you mentioned.

imageHowerver, _json_response field is missing the information about the layer name. I should have "A5WTCS2_RAM_C_Centreline_Ln_01"

 

{"id": "a8c773f8c75d4353a54b97e8490697ae", "owner": "x.x@x", "created": 1697543079384, "isOrgItem": true, "modified": 1699886711664, "guid": null, "name": "1620016278_Mainline_Centreline", "title": "A5WTCS2_RAM_C_Centreline_Ln", "type": "Feature Service", "typeKeywords": ["ArcGIS Server", "Data", "Feature Access", "Feature Service", "Metadata", "providerSDS", "Service", "Hosted Service"], "description": "<div style='text-align:left;'><p><span style='font-size:12pt;'><b>CAD Model:\\u00a0</b></span><span style='font-size:16px;'>X-718736-PH2B-0800-Chainage v1.0</span></p><p><span style='font-size:16px;'><b>Converted:\\u00a0</b>17/10/2023</span></p></div>", "tags": [""], "snippet": "", "thumbnail": "thumbnail/thumbnail.png", "documentation": null, "extent": [[-7.490085703273247, 54.569679640849934], [-7.274980822826842, 54.79065897132162]], "categories": [], "spatialReference": "29900", "accessInformation": "", "licenseInfo": "", "culture": "en-gb", "properties": null, "advancedSettings": null, "url": "https://......../services/Hosted/1620016278_Mainline_Centreline/FeatureServer", "proxyFilter": null, "access": "shared", "size": 73693, "subInfo": 0, "appCategories": [], "industries": [], "languages": [], "largeThumbnail": null, "banner": null, "screenshots": [], "listed": false, "numComments": 0, "numRatings": 0, "avgRating": 0, "numViews": 450, "groupCategories": [], "scoreCompleteness": 40, "groupDesignations": null}

 

image

the _json_response has been generated from _webservice_url and it does not include the information required

imageAm I missing sth?


nampreetatsafe
Safer
Forum|alt.badge.img+12

Hi @marta.podsiad​,

Have you tried using the ArcGIS Online Feature Service Reader instead of the ArcGISOnlineConnector? When you add the layer as a Reader Feature Type on the canvas, you can obtain the layer name by referencing the fme_feature_type attribute as shown in the following screenshot:

imageI hope this does the trick?


marta.podsiad
Supporter
Forum|alt.badge.img+9
  • Author
  • Supporter
  • November 29, 2023

Hi, the problem with your approach is that Esri ArcGIS Online (AGOL) Feature Service reads only one published layer. I need to read all layers shared with particular group


nampreetatsafe
Safer
Forum|alt.badge.img+12

Hi @marta.podsiad​, I think both @nielsgerrits​ and you were on the right track earlier. I managed to get all the layers with a few tweaks:

  • setting the HTTPCaller Request URL to return a JSON response: @Value(_webservice_url)?f=pjson
  • used a JSONFragmenter to query the Layers from the _reponse_body and extract the layer names into attributes:
    • JSON Attribute: _response_body
    • JSON Query: json["layers"][*]
    • Flatten Query Result into Attributes: Yes
    • Attributes to Expose: name

 

2023-12-06_17-02-48Let me know if this helps.


marta.podsiad
Supporter
Forum|alt.badge.img+9
  • Author
  • Supporter
  • December 12, 2023
nampreetatsafe wrote:

Hi @marta.podsiad​, I think both @nielsgerrits​ and you were on the right track earlier. I managed to get all the layers with a few tweaks:

  • setting the HTTPCaller Request URL to return a JSON response: @Value(_webservice_url)?f=pjson
  • used a JSONFragmenter to query the Layers from the _reponse_body and extract the layer names into attributes:
    • JSON Attribute: _response_body
    • JSON Query: json["layers"][*]
    • Flatten Query Result into Attributes: Yes
    • Attributes to Expose: name

 

2023-12-06_17-02-48Let me know if this helps.

I am really sorry but it does not work. There is sth wrong with HTTP Callerimage 

 


nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • December 12, 2023
marta.podsiad wrote:

I am really sorry but it does not work. There is sth wrong with HTTP Callerimage 

 

The error indicates that the service requires authentication. You need to configure the HTTPCaller to use a web connection. You can use the same web connection as you use on the ArcGISOnlineConnector.

 

2023-12-12_15h45_53


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings