val webTiledLayer = WebTiledLayer.create(urlTemplate = "https://geoportal.ancpi.ro/maps/rest/services/Ortofoto/Mozaic_vt/MapServer/tile/tile/{level}/{row}/{col}?blankTile=false")
val vectorTileLayer = ArcGISVectorTiledLayer("https://geoportal.ancpi.ro/hosted_services/rest/services/Hosted/imobile_cladiri/VectorTileServer")
val vectorTileLayerBase = ArcGISVectorTiledLayer("https://geoportal.ancpi.ro/hosted_services/rest/services/Hosted/imobile_cladiri/VectorTileServer/tile/0/0/0.pbf")
arcGISMap = ArcGISMap(SpatialReference(3844)).apply {
operationalLayers.add(webTiledLayer)
operationalLayers.add(vectorTileLayerBase)
}
Hello
I would like to display some layers from ANCPI. I've already tried the following three:
Unfortunately, it doesn't work. Is it because of the spatial reference?
What else could I try?
here you can see the layers working: https://geoportal.ancpi.ro/imobile.html
Hi.
I took a look with the Swift SDK and it looks like your server is rejecting requests coming from the Native SDKs because of the User-Agent header. Not seen that before, but I reproduced this in Postman too.
The Native SDKs add a User-Agent string to all requests. In my Swift SDK test app, the string is this:
User-Agent: ArcGISMaps-Swift/200.7 (iOS 18.5; iPhone17,1,Simulator; devmode) com.esri.tutorial.Display-a-web-map/1.0
It'll be something similar for the Kotlin SDK.
To open the layer, the SDKs will make a couple of metadata requests:
If I make Postman GET requests to either of those URLs with no User-Agent header, I get valid JSON responses. But as soon as I add a User-Agent header like the one above, I get an HTML error response and the VectorTileLayer will fail to load with a "forbidden" error.
Can you check with your server admin and see if there's configuration on the server that could be rejecting these User-Agent Native SDK headers?
For reference, here's some sample output I get from the Swift SDK's ConsoleNetworkLogger:
Request sent:
URL: https://geoportal.ancpi.ro/hosted_services/rest/info?f=json
Method: GET
Request headers: User-Agent: ArcGISMaps-Swift/200.7 (iOS 18.5; iPhone17,1,Simulator; devmode) com.esri.tutorial.Display-a-web-map/1.0
Request completed:
URL: https://geoportal.ancpi.ro/hosted_services/rest/info?f=json
Method: GET
Data: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /hosted_services/rest/info
on this server.</p>
</body></html>
Response headers: Connection: Keep-Alive, Content-Length: 227, Content-Type: text/html; charset=iso-8859-1, Date: Fri, 29 Aug 2025 19:10:26 GMT, Keep-Alive: timeout=5, max=100, Server: Apache, X-Content-Type-Options: nosniff
To start to figure these things out, you can check the loadStatus on the VectorTileLayer or Map.
I then used the ConsoleNetworkLogger to see the requests being made that were getting a loadStatus error, dug into the them a bit, and figured the only difference between a browser and the SDK might be the User-Agent string.
I'm not familiar enough with Kotlin to recommend how to track requests like I can with the Swift ConsoleNetworkLogger, so I'll let someone on the Kotlin team pipe up if they have recommendations.
Hello, thank you very much for your efforts.
Were you able to override the user agent in the Swift SDK and get it working?
Best regards
The Swift and Kotlin SDKs don't support overriding the user agent being sent as part of a network request made by the SDK. The server would need to be configured to accept that user agent.
Hello @GuntherHeppner ,
Thank you for your feedback. Unfortunately, we have no control over the server.
The easiest way would be to adjust the user agent in the Okhttp3 client.
This would also fit the wish of How to set a proxy on the ArcGISHTTPClient - Esri Community
Hi @woodie.
I was able to confirm that ANCPI deliberately took this action to prevent desktop GIS applications (both Esri and open source) from accessing the data as some of the data is sold via https://epay.ancpi.ro/epay/Welcome.action
I'm unable to tell what the rules are, but they at least specifically block any user agent that contains "ArcGIS" (case sensitive). I'm told that QGIS is similarly blocked.
You would need to petition ANCPI to make a change to their servers to allow the Native Maps SDKs to access them.