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

QgsCsException occurs when plugin dialog first opened #254

Open
tomchadwin opened this issue Sep 25, 2019 · 3 comments
Open

QgsCsException occurs when plugin dialog first opened #254

tomchadwin opened this issue Sep 25, 2019 · 3 comments

Comments

@tomchadwin
Copy link
Contributor

tomchadwin commented Sep 25, 2019

Traceback (most recent call last):
  File "C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 356, in _on_zoom_change
    self._update_nr_of_tiles(zoom)
  File "C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 359, in _update_nr_of_tiles
    bounds = self._get_visible_extent_as_tile_bounds(zoom=zoom)
  File "C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 662, 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/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\tile_helper.py", line 213, in get_tile_bounds
    xy_max = latlon_to_tile(zoom=zoom, lat=lat_max, lng=lng_max, source_crs=source_crs, scheme=scheme)
  File "C:/Users/tchadwin/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/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\tile_helper.py", line 162, in convert_coordinate
    x, y = xform.transform(QgsPointXY(lng, lat))
_core.QgsCsException: forward transform of
(-1.582293, 1.782405)
PROJ:  +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 +to  +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs
Error: latitude or longitude exceeded limits

Canvas was EPSG:4326, and I was zoomed a long way out above Canada. Sorry not to have more precise details.

QGIS 3.8.3
VTR 3.1.0

@mnboos
Copy link
Collaborator

mnboos commented Sep 25, 2019

Thanks for the ticket Tom. What kind of source did you use?

@tomchadwin
Copy link
Contributor Author

A server.

@tomchadwin
Copy link
Contributor Author

Slightly different error, triggered by the same conditions - canvas is zoomed way out to world level:

ValueError: cannot convert float NaN to integer 
Traceback (most recent call last):
  File "C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 356, in _on_zoom_change
    self._update_nr_of_tiles(zoom)
  File "C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 359, in _update_nr_of_tiles
    bounds = self._get_visible_extent_as_tile_bounds(zoom=zoom)
  File "C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\vtr_plugin.py", line 662, 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/tchadwin/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/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\tile_helper.py", line 145, in latlon_to_tile
    col, row = gm.MetersToTile(mx=lng, my=lat, zoom=zoom)  # GlobalMercator returns in TMS scheme here
  File "C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\global_map_tiles.py", line 227, in MetersToTile
    return self.PixelsToTile(px, py)
  File "C:/Users/tchadwin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\vector_tiles_reader\plugin\util\global_map_tiles.py", line 213, in PixelsToTile
    tx = int(math.ceil(px / float(self.tileSize)) - 1)
ValueError: cannot convert float NaN to integer


Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] 
QGIS version: 3.8.3-Zanzibar Zanzibar, 685d8b15d2 

Occurs as soon as VTR button clicked and dialog appears. To clarify, no VTR layers are on the canvas, just a SHP.

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

2 participants