5

I have a password protected ArcGIS-FeatureServer Service, the service provides 25 layers.

Using "Add Layer --> Add ArcGIS-FeatureServer-Layer" works like it should.

Is there any way to add these kind of layers with PyQGIS? I could not find a documentation or example anywhere.

How to Add a normal WFS layer with PyQGIS is well documented.

For ArcGIS MapServer it is super-easy:

iface.addRasterLayer("url='my_featuere_layer_url' layer='0'", "mylayer", "arcgismapserver")

But the provider "arcgismapserver" is not documented anywhere, just found an example after some search, so I expect that there is a similar solution for ArcGIS-FeatureServer.

3 Answers 3

5

After all, the answer is quite simple (but nowhere documented):

uri = "crs='EPSG:25832' filter='' url='http://someurl.com/featureserver' table="" sql="
my_layer = QgsVectorLayer(uri, "layername", "arcgisfeatureserver")

The lack of documentation leads to a lot of other questions (bounding-box, username, password, ...)

0

Check out the ArcGISConnector-QGIS-Plugin connector.py file. Looks like it requests the features service as json using the requests module.

1
  • 1
    Thx, already checked that out, but hoping for an easier solution and it seems to be a very complicated solution. For ArcGIS MapServer it is super-easy, therefore I assume a similar solution for ArcGIS FeatureServer, it is just not documented.
    – AndreasK
    Commented Oct 30, 2017 at 8:32
0

I still can't find any decent documentation (issue 40406).

Scanning qgsafsprovider.cpp gives some clues.

Note 'filter' doesn't seem to be working (issue 27635)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.