qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.59k stars 3.01k forks source link

ArcGIS REST provider uri().uri() has a double 'crs' attbute #44485

Open rduivenvoorde opened 3 years ago

rduivenvoorde commented 3 years ago

What is the bug or the crash?

Answering a question on matrix group (https://matrix.to/#/!iIpqCcxrWNnIYCMjjO:matrix.org/$1627713567115747aYUNR:matrix.org?via=libera.chat&via=matrix.org&via=osgeo.org) I see a double crs item in the provider uri which seems obsolete?

"crs='EPSG:26917' crs='EPSG:26917' url='https://services2.arcgis.com/XZg2efAbaieYAXmu/ArcGIS/rest/services/Hospitals/FeatureServer/0'"

Steps to reproduce the issue

To reproduce: 1) use the following service to create a ArcGIS Rest service in QGIS gui: https://services2.arcgis.com/XZg2efAbaieYAXmu/ArcGIS/rest/services/ 2) load the service 'Hospitals' in (a epsg:4326 world) project QGIS 3) make sure Hospitals is active and start the python console and paste:

uri = iface.mapCanvas().currentLayer().dataProvider().uri().uri()
print(uri)

It will show you the line above, with a double "crs='EPSG:26917'" part.

All is working fine, the uri can be used to create/load a valid layer:

layer = QgsVectorLayer(uri, "layername", "arcgisfeatureserver")
QgsProject.instance().addMapLayer(ayer)

but maybe this is a sign for something going wrong?

Versions

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

QGIS version | 3.21.0-Master | QGIS code revision | 842485f7514 -- | -- | -- | -- Qt version | 5.15.2 Python version | 3.9.2 GDAL/OGR version | 3.2.2 PROJ version | 7.2.1 EPSG Registry database version | v10.008 (2020-12-16) GEOS version | 3.9.0-CAPI-1.16.2 SQLite version | 3.34.1 PostgreSQL client version | 13.3 (Debian 13.3-1) SpatiaLite version | 5.0.1 QWT version | 6.1.4 QScintilla2 version | 2.11.6 OS version | Debian GNU/Linux 11 (bullseye)   |   |   |   This copy of QGIS writes debugging output.   |   |   |   Active Python plugins | pdokservicespluginplugin_reloaderRIVM_PluginConfigManagerHelloWorldPluginSectorPlotsectorplotsimplesvgsagaproviderprocessinggrassprovider

Additional context

No response

lbartoletti commented 3 years ago

@rduivenvoorde I can't reproduce on master:

iface.activeLayer().dataProvider().uri()
#<QgsDataSourceUri:  crs='EPSG:26917' url='https://services2.arcgis.com/XZg2efAbaieYAXmu/ArcGIS/rest/services/Hospitals/FeatureServer/0'>
iface.activeLayer().dataProvider().uri().uri()
#" crs='EPSG:26917' url='https://services2.arcgis.com/XZg2efAbaieYAXmu/ArcGIS/rest/services/Hospitals/FeatureServer/0'"
lbartoletti commented 3 years ago

can you try with a fresh build?

rduivenvoorde commented 3 years ago

@lbartoletti just did, with fresh build:

uri = iface.mapCanvas().currentLayer().dataProvider().uri().uri()
print(uri)
 crs='EPSG:26917' crs='EPSG:26917' url='https://services2.arcgis.com/XZg2efAbaieYAXmu/ArcGIS/rest/services/Hospitals/FeatureServer/0'

Screenshot from 2021-09-22 09-31-02

QGIS version 3.21.0-Master QGIS code revision 64a01d984bd
Qt version 5.15.2
Python version 3.9.7
GDAL/OGR version 3.3.2
PROJ version 7.2.1
EPSG Registry database version v10.008 (2020-12-16)
GEOS version 3.9.1-CAPI-1.14.2
SQLite version 3.36.0
PostgreSQL client version 13.4 (Debian 13.4-3)
SpatiaLite version 5.0.1
QWT version 6.1.4
QScintilla2 version 2.11.6
OS version Debian GNU/Linux bookworm/sid
       

This copy of QGIS writes debugging output.   |   |   |   Active Python plugins | QuickWKTnominatim_locator_filterpdokservicespluginplugin_reloaderJRodosmeetwagenpdok_locatieserver_locator_filterRIVM_PluginConfigManagerDataPlotlylatlontoolsqgis-safecast-plugin-mastersafecastSectorPlotNuclear-Energy-Plant-Radiations-sagaproviderprocessinggrassprovider