Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning: QgsCoordinateReferenceSystem constructor is deprecated #273

Open
am2222 opened this issue Jan 20, 2020 · 7 comments
Open

Comments

@am2222
Copy link

am2222 commented Jan 20, 2020

Hi,
While I am trying to load my data I face this error.

2020-01-20T15:58:33     WARNING    warning:C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\tile_helper.py:159: DeprecationWarning: QgsCoordinateReferenceSystem constructor is deprecated
              crs_dest = QgsCoordinateReferenceSystem(target_crs)
             
             traceback: File "C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 594, in _show_connections_dialog
              self.connections_dialog.display(current_connection)
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\ui\dialogs.py", line 336, in display
              self.on_zoom_change.emit()
              File "C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 360, in _on_zoom_change
              self._update_nr_of_tiles(zoom)
              File "C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 363, in _update_nr_of_tiles
              bounds = self._get_visible_extent_as_tile_bounds(zoom=zoom)
              File "C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 667, in _get_visible_extent_as_tile_bounds
              tile_bounds = get_tile_bounds(zoom, extent=bounds, scheme=scheme, source_crs=str(source_crs))
              File "C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\tile_helper.py", line 212, in get_tile_bounds
              xy_min = latlon_to_tile(zoom=zoom, lat=lat_min, lng=lng_min, source_crs=source_crs, scheme=scheme)
              File "C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\tile_helper.py", line 142, in latlon_to_tile
              lng, lat = convert_coordinate(source_crs=source_crs, target_crs="epsg:3857", lat=lat, lng=lng)
              File "C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\tile_helper.py", line 159, in convert_coordinate
              crs_dest = QgsCoordinateReferenceSystem(target_crs)

Can this be because of my server is returning 204 response for some of the tiles???? I am making my pbf data on my own server and I can open individual pbf files using qgis so it means my pbf files are correct. I think this error can happen when for some tiles my server returns 204 html error code.

@am2222 am2222 changed the title [WinError 2] The system cannot find the file specified DeprecationWarning: QgsCoordinateReferenceSystem constructor is deprecated Jan 20, 2020
@sfkeller
Copy link

May it be possible that the tiles you generated aren't EPSG:3857?

For the Vector Tiles spec. the default CRS is Web Mercator (EPSG:3857). That's also the case for this plugin. I'm unsure how well tested the plugin is for other CRS, although there's this statement:
https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/blob/dev-qgis3/plugin/util/tile_helper.py#L141

@am2222
Copy link
Author

am2222 commented Jan 21, 2020

@sfkeller
Thanks for your response, I think I am not using EPSG:3857 data to convert to pbf data. I am using this method to make a pbf

		var govt = geojsonvt(gojsondata, {
			maxZoom: self.z+1,
			indexMaxZoom: self.z-1
		  });

		var pbf = govt.getTile(self.z, self.x, self.y);
		layers = [{
			name: "DGGS",
			geojson: self.data,
			pbf: pbf
		}];

		var pbfOptions = {};

		for(var i in layers) {
			var layer = layers[i];
			if(layer.pbf){
				//construct the GeoJSONWrapper here, so that we can tell him the version !
				pbfOptions[layer.name] = new GeoJSONWrapper(layer.pbf.features);
				pbfOptions[layer.name].name = layer.name;
				pbfOptions[layer.name].version = 2;
			}
		}

		if(pbfOptions.length === 0) {
			return process.nextTick(function () {
				errcallback("pbfOptions.length=0");
			});
		}
		  // we use fromVectorTileJs instead of fromGeojsonVt because we constructed the GeoJSONWrapper ourselves
		var buff = vtpbf.fromVectorTileJs({layers: pbfOptions});
		 
		if(buff) {
			buff = new Buffer(buff.buffer);
		  }

my gojsondata data are in EPSG:4326 which surprisingly the generated vector tiles are working well with leaflet vector grid package. Is there any way to define source projection? for example defining in tilejson metadata? Or I have to reproject my data before converting them to pbf?

@tomchadwin
Copy link
Contributor

You don't need to worry too much about a deprecation warning. It is an indication that this code will not work at some point in the future, but it is not reporting an error at the moment. The issue will have to be fixed, but fixing it now will not change the behaviour of the plugin with the current version of QGIS.

@am2222
Copy link
Author

am2222 commented Jan 21, 2020

@tomchadwin Hi,
I rerun everything and I ended up with this error

2020-01-21T12:11:13     WARNING    Error during network request: Connection refused, http://localhost:3000/mvt/MINTEMP_MEAN/14/vector/9/88/134.pbf?&command=dirty
2020-01-21T12:11:13     WARNING    Error during network request: Connection refused, http://localhost:3000/mvt/MINTEMP_MEAN/14/vector/9/90/125.pbf?&command=dirty
2020-01-21T12:11:13     WARNING    Error during network request: Connection refused, http://localhost:3000/mvt/MINTEMP_MEAN/14/vector/9/85/125.pbf?&command=dirty
2020-01-21T12:11:13     WARNING    Creating 0 layers...
2020-01-21T12:11:13     WARNING    Refreshing layers...
2020-01-21T12:11:13     WARNING    Adding 0 new layers to layer group...
2020-01-21T12:11:13     WARNING    Layer creation complete
2020-01-21T12:11:13     WARNING    Import complete
2020-01-21T12:11:13     WARNING    Loading of zoom level 9 complete! No extent loaded.
2020-01-21T12:11:38     WARNING    Shutting down reader...
2020-01-21T12:11:38     WARNING    Unloading native lib...
2020-01-21T12:11:38     WARNING    Reader shutdown
2020-01-21T12:11:46     WARNING    URL check for 'http://127.0.0.1:3000/metadata/MINTEMP_MEAN': status '200'
2020-01-21T12:11:47     WARNING    URL check for 'http://127.0.0.1:3000/metadata/MINTEMP_MEAN': status '200'
2020-01-21T12:11:48     WARNING    Loading native lib...
2020-01-21T12:11:48     WARNING    Native decoding supported!!! (Windows, 64bit)
2020-01-21T12:11:50     WARNING    Bounds of source: {'zoom': 9, 'x_min': 0, 'x_max': 255, 'y_min': 0, 'y_max': 256, 'width': 256, 'height': 257, 'scheme': 'xyz'}
2020-01-21T12:11:50     WARNING    Loading zoom level '9', bounds: {'zoom': 9, 'x_min': 84, 'x_max': 96, 'y_min': 122, 'y_max': 138, 'width': 13, 'height': 17, 'scheme': 'xyz'}
2020-01-21T12:11:50     WARNING    Tile limit enabled: False (None)
2020-01-21T12:11:50     WARNING    0 tiles in cache. Max. 221 will be loaded additionally.
2020-01-21T12:11:50     WARNING    Getting 221 tiles from source...
2020-01-21T12:12:39     WARNING    Processing tiles in parallel...
2020-01-21T12:12:39     WARNING    An exception occured: [WinError 2] The system cannot find the file specified, Traceback (most recent call last):
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vt_reader.py", line 289, in _load_tiles
              tiles = self._decode_tiles(tile_data_tuples)
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vt_reader.py", line 438, in _decode_tiles
              pool = self._get_pool()
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vt_reader.py", line 407, in _get_pool
              pool = multiprocessing.Pool(nr_processors)
              File "e:\Program Files\QGIS 3.10\apps\Python37\lib\multiprocessing\context.py", line 119, in Pool
              context=self.get_context())
              File "e:\Program Files\QGIS 3.10\apps\Python37\lib\multiprocessing\pool.py", line 176, in __init__
              self._repopulate_pool()
              File "e:\Program Files\QGIS 3.10\apps\Python37\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
              w.start()
              File "e:\Program Files\QGIS 3.10\apps\Python37\lib\multiprocessing\process.py", line 112, in start
              self._popen = self._Popen(self)
              File "e:\Program Files\QGIS 3.10\apps\Python37\lib\multiprocessing\context.py", line 322, in _Popen
              return Popen(process_obj)
              File "e:\Program Files\QGIS 3.10\apps\Python37\lib\multiprocessing\popen_spawn_win32.py", line 48, in __init__
              None, None, False, 0, None, None, None)
             FileNotFoundError: [WinError 2] The system cannot find the file specified
             
2020-01-21T12:12:39     WARNING    Loading cancelled
2020-01-21T12:12:40     WARNING    Reloading due to scale change from '611936' (zoom 9) to '1049345' (zoom 8)
2020-01-21T12:12:40     WARNING    Loading aborted as there are no layers of the current connection already loaded.


It says FileNotFoundError: [WinError 2] The system cannot find the file specified which is wired

@am2222
Copy link
Author

am2222 commented Jan 23, 2020

I got this error after setting CRS parameter to EPSG:3857

2020-01-22T20:26:34     WARNING    Decoding failed: Traceback (most recent call last):
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\mp_helper.py", line 148, in decode_tile_native
              hex_bytes,
             OSError: exception: access violation reading 0x000000351F400000
             
2020-01-22T20:26:34     WARNING    An exception occured: Truncated message., Traceback (most recent call last):
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\mp_helper.py", line 148, in decode_tile_native
              hex_bytes,
             OSError: exception: access violation reading 0x000000351F400000
             
             During handling of the above exception, another exception occurred:
             
             Traceback (most recent call last):
              File "C:\Users\hoja4090\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\vector_tiles_reader\ext-libs\google\protobuf\internal\python_message.py", line 1062, in MergeFromString
              if self._InternalParse(serialized, 0, length) != length:
              File "C:\Users\hoja4090\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\vector_tiles_reader\ext-libs\google\protobuf\internal\python_message.py", line 1088, in InternalParse
              new_pos = local_SkipField(buffer, new_pos, end, tag_bytes)
              File "C:\Users\hoja4090\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\vector_tiles_reader\ext-libs\google\protobuf\internal\decoder.py", line 850, in SkipField
              return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end)
              File "C:\Users\hoja4090\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\vector_tiles_reader\ext-libs\google\protobuf\internal\decoder.py", line 770, in _SkipVarint
              while ord(buffer[pos:pos+1]) & 0x80:
             TypeError: ord() expected a character, but string of length 0 found
             
             During handling of the above exception, another exception occurred:
             
             Traceback (most recent call last):
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vt_reader.py", line 289, in _load_tiles
              tiles = self._decode_tiles(tile_data_tuples)
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vt_reader.py", line 429, in _decode_tiles
              tile, decoded_data = decoder_func(t)
              File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\mp_helper.py", line 162, in decode_tile_native
              tb_data.write_text(json.dumps(decode(data)))
              File "C:\Users\hoja4090\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\vector_tiles_reader\ext-libs\mapbox_vector_tile\__init__.py", line 7, in decode
              message = vector_tile.getMessage(tile, y_coord_down)
              File "C:\Users\hoja4090\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\vector_tiles_reader\ext-libs\mapbox_vector_tile\decoder.py", line 28, in getMessage
              self.tile.ParseFromString(pbf_data)
              File "C:\Users\hoja4090\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\vector_tiles_reader\ext-libs\google\protobuf\message.py", line 185, in ParseFromString
              self.MergeFromString(serialized)
              File "C:\Users\hoja4090\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\vector_tiles_reader\ext-libs\google\protobuf\internal\python_message.py", line 1068, in MergeFromString
              raise message_mod.DecodeError('Truncated message.')
             google.protobuf.message.DecodeError: Truncated message.

I feel that the problem is with the pbf files, but I am not sure since I am using the same pbf files with leafler vector grid and it works. Do you have suggestion how can I fix this problem?

@mnboos
Copy link
Collaborator

mnboos commented Jan 23, 2020

This might be related to #272

If you want to do som debugging, go to the directory were the plugin is located and rename the folder containing the native decoding binaries (some .dll and .so files). Then restart QGIS and load the source again. It will then use the Python decoding mechanism, which will give us maybe a bit more info.

@am2222
Copy link
Author

am2222 commented Jan 23, 2020

@mnboos Hi, thanks for the response,
I changed the directory name but It starts to throw the filenotfounde error

An error has occurred while executing Python code: 

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\hoja4090\\AppData\\Roaming\\QGIS\\QGIS3\\profiles\\default\\python\\plugins\\vector_tiles_reader\\ext-libs\\pbf2geojson\\pbf2geojson_windows_x86_64.dll' 
Traceback (most recent call last):
  File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 394, in _on_connect
    reader = self._create_reader(connection=connection)
  File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 837, in _create_reader
    reader = VtReader(self.iface, connection=connection)
  File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vt_reader.py", line 101, in __init__
    load_lib()
  File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\mp_helper.py", line 68, in load_lib
    path = _get_lib_path()
  File "C:/Users/hoja4090/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\mp_helper.py", line 55, in _get_lib_path
    if os.path.isfile(temp_lib_path) and os.path.getmtime(temp_lib_path) != os.path.getmtime(lib_path):
  File "e:\Program Files\QGIS 3.10\apps\Python37\lib\genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\hoja4090\\AppData\\Roaming\\QGIS\\QGIS3\\profiles\\default\\python\\plugins\\vector_tiles_reader\\ext-libs\\pbf2geojson\\pbf2geojson_windows_x86_64.dll'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants