Diskussion:ArcGIS REST API Connector QGIS Plugin
Feasibility analysis and solution approach Carmelo Schumacher
Because of the limited functionality python plugins have, only a very basic set of features can be implemented. The best solution is to write an own data provider - but this would require the plugin to be written in C++.
FeatureServer->FeatureLayer: (http://resources.arcgis.com/en/help/arcgis-rest-api/#/Query_Feature_Service/02r3000000w5000000/) Use OGR as the dataprovider for a QgsVectorLayer with datasource URL to FeatureServer with query: /query?where=objectid+%3D+objectid&outfields=*&f=json
MapServer->FeatureLayer: (http://resources.arcgis.com/en/help/arcgis-rest-api/#/Query_Map_Service_Dynamic_Layer/02r3000000z6000000/) Because MapServer-Queries are restricted by a limit on the number of features included in the feature set response (max 1000), /query?where=objectid+%3D+objectid&outfields=*&f=json will return only 1000 features max. To overcome this restriction, multiple service calls are needed to populate the whole feature-list.
Possible Solution:
- 1 Check if layer has more than 1000 features (using query parameter returnCountOnly=true).
- 2a If not, same procedure as featureServer->FeatureLayer -> stop
- 2b If yes use OGR Virtual Format (http://www.gdal.org/drv_vrt.html) to join all the service calls needed, to retreive all features (use union layer). Populate the xml first and add to OGR provider. The different queries can be generated by getting all the id's of all the features first (returnIdsOnly=true) and include the id's in the query (max 1000 / query).
MapServer->RasterLayer:
- OGR can handle raster queries (http://www.gdal.org/frmt_wms.html search for ArcGIS REST API (GDAL 2.0 and later)):
$ gdallocationinfo -wgs84 "<GDAL_WMS><Service name=\"AGS\"><ServerUrl>http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer</ServerUrl><BBoxOrder>xyXY</BBoxOrder><SRS>3857</SRS></Service><DataWindow><UpperLeftX>-20037508.34</UpperLeftX><UpperLeftY>20037508.34</UpperLeftY><LowerRightX>20037508.34</LowerRightX><LowerRightY>-20037508.34</LowerRightY><SizeX>512</SizeX><SizeY>512</SizeY></DataWindow></GDAL_WMS>" -75.704 39.75
Only bounding box need to be updated on every pan (and zoom?).