You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting the config to tile for the TMS WebMercatorQuad, which differs from the default TMS WGS1984Quad, the x and y identifiers for each tile cannot be identified (only the z component can be identified) when we save the tiles.
Before we save the tiles, when we extract the EPSG code pulled from the default TMS WGS1984Quadhere, it looks like: urn:ogc:def:crs:EPSG::4326. When we extract the EPSG code from TMS WebMercatorQuad, it is in the same format: urn:ogc:def:crs:EPSG::3857. This means identifying the CRS of the TMS is not likely the issue.
The following output identifies 2 options for the source of the error:
the staged file is not correctly re-projected into the TMS
I added logging to check the CRS after re-projecting, and it is reported as urn:ogc:def:crs:EPSG::3857 which is what we want
the point identified as (-18034999.95487016, 10070194.973863265) looks like the units are meters, while the TMS bounds [-180.0, -85.0511287798066, 180.0, 85.0511287798066] are in degrees
the tile is re-projected correctly but we cannot identify the x and y
/home/jcohen/anaconda3/envs/arcade_layer/lib/python3.9/site-packages/morecantile/models.py:468: PointOutsideTMSBounds: Point (-18034999.95487016, 10070194.973863265) isoutsideTMSbounds [-180.0, -85.0511287798066, 180.0, 85.0511287798066].
warnings.warn(
Traceback (mostrecentcalllast):
File"/home/jcohen/IWP_validation_app/workflow.py", line177, in<module>stager.stage(iwp_paths[0])
File"/home/jcohen/viz-staging/pdgstaging/TileStager.py", line139, instageself.save_tiles(gdf)
File"/home/jcohen/viz-staging/pdgstaging/TileStager.py", line566, insave_tilesself.save_new_tile(data=data,
File"/home/jcohen/viz-staging/pdgstaging/TileStager.py", line628, insave_new_tilelogger.info(f"input tiles_str into tile_from_str is {tiles_str}.")
File"/home/jcohen/viz-staging/pdgstaging/TileStager.py", line628, in<listcomp>logger.info(f"input tiles_str into tile_from_str is {tiles_str}.")
File"/home/jcohen/viz-staging/pdgstaging/TilePathManager.py", line279, intile_from_strx, y, z= [int(i) foriinregex.findall(tile_str)]
ValueError: notenoughvaluestounpack (expected3, got1)
When we save any tile, regardless if it will be a new tile or appended to an existing tile, we extract the tile_pathhere using path_from_tile(tile, base_dir='staged').
Then, if the tile is a new tile, we use that tile_path as an input to save_new_tile() which uses it like so: data.to_file(tile_path, mode=mode), and mode is set to 'w'. The input argument tile_path looks like: staged/WebMercatorQuad/15/nan/nan.gpkg so the issue must occur before we execute save_new_tile().
Because of those nan values, when we move on to define tiles_str with tiles_str = data[self.props['tile']].copy(), tile_str looks like Tile(x=nan, y=nan, z=15).
seems like the re-projecting to the CRS of the TMS is working, because the logged CRS after re-projecting is urn:ogc:def:crs:EPSG::3857 (as noted in the first comment) andGrid.py includes a check that the CRS if the TMS is the same as the geodataframe's CRS: __check_crs_match(self, gdf), so the issue is more likely in the extraction of the x and y from the TMS
Within Grid.py, we execute indices_from_xy(self, x, y) which returns "The row indices and column indices, respectively, that each of the given point coordinates falls within."
When I run the workflow with the default TMS, WGS1984, logging for this step looks like:
Seems the None values result from this operation. I am not sure if the repeated 1 and -1 values are valid. In contrast, the default TMS shows a large diversity in values for these lists.
When setting the config to tile for the TMS
WebMercatorQuad
, which differs from the default TMSWGS1984Quad
, the x and y identifiers for each tile cannot be identified (only the z component can be identified) when we save the tiles.Before we save the tiles, when we extract the EPSG code pulled from the default TMS
WGS1984Quad
here, it looks like:urn:ogc:def:crs:EPSG::4326
. When we extract the EPSG code from TMSWebMercatorQuad
, it is in the same format:urn:ogc:def:crs:EPSG::3857
. This means identifying the CRS of the TMS is not likely the issue.When we save tiles, we use the method
tile_from_str()
which pulls the tile x, y, and z identifiers.The following output identifies 2 options for the source of the error:
urn:ogc:def:crs:EPSG::3857
which is what we want(-18034999.95487016, 10070194.973863265)
looks like the units are meters, while the TMS bounds[-180.0, -85.0511287798066, 180.0, 85.0511287798066]
are in degreesconfig
Other TMS's that we should be able to process can be found here.
The text was updated successfully, but these errors were encountered: