ArcGIS REST API Connector QGIS Plugin
QGIS-Plugin ArcGIS REST API Connector (beta) which reads from ArcGIS Online and ArcGIS Server and the "Esri Open Data Initiative Portal Software".
- A project by Geometa Lab HSR
- Project Lead: Stefan Keller
- Authors/Developers: Tobias Schmitz, Rafael Krucker and Dennis Ligtenberg
Inhaltsverzeichnis
About
QGIS-Plugin ArcGIS REST API Connector which reads from ArcGIS Online and ArcGIS Server and the "Esri Open Data Initiative Portal Software".
Currently reading "Feature Services" (similar to WFS but proprietary) and "Map Services" (kind of WMTS) are supported.
This plugin focusses on reading so-called "Maps" accessible without restrictions over the Internet by interpreting JSON (JavaScript Object Notation) and image output formats.
Functions (similar to WFS) "Add ArcGIS REST Layer...":
- connect/new/edit/delete connection
- load/save connections
- filter layer list
- select layer (then download)
Implementation details of Feature Service:
- maxRecordCount - currently maxRecordCount is ignored.
- Query - currently there's no query functionality.
- outSR - currently geometry is returned as default well-known ID "GCS_WGS_1984".
Map services expose a set of tiled images, read-only, working with the default data frame of the published map document on the server.
Available ArcGIS Services
- http://sampleserver1.arcgisonline.com/arcgis/rest/services
- http://sampleserver6.arcgisonline.com/arcgis/rest/services
- http://services.arcgisonline.com/arcgis/rest/services
Installation and Source Code
Install from inside QGIS as Python plugin.
- Published in QGIS plugin directory: http://plugins.qgis.org/plugins/connector/
- Source Code on github
Version History:
- 0.1.0 - First experimental version for broader testing purposes released 11.4.2014 based on QGIS Version 2.4.
- 0.1.1 - Current experimental version on plugins.qgis.org tested on QGIS Version 2.6.
Support
Project notes, issues, bugs and feature requests: See github (for older notes see tab "Diskussion").
Possible Enhancements
According to Esri's specification of "ArcGIS REST API"], there are many services: ... With ready-to-use basemaps, reference layers, and so on, you can quickly add context or a backdrop to your local or worldwide data. Some ArcGIS Online maps are thematic, which may provide all the information you need to present in your application.
Future improvements may be made to Feature Service, Map Service and additionally to a new Image Service, which provides access to raster data similar to Map Services. Both Map and Image services return raster images mosaicked on the fly or WMTS whereas the main difference is that Map Services are read-only while Image Service include an API for editing and uploading (which is out-of-scope of this plugin).
General improvements may include
- Authentification (with OAuth 2.0)
- Image Service.
- HttpProxy (issue #3)
Future improvements of Feature Service may include:
- Paging (maxRecordCount) See issue #6
- Local Feature Cache (see [1])
- Query and Query Related Records
- Dealing with compressed http content?
- Reading/showing "Services Directory"
Future improvements of Map Service may include:
- Feature (aka OGC WMS GetFeatureInfo?)
- Image (Marker)?
- Legend (aka WMS GetLegend)
- Map Tile
- WMTS
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?).