def post_init(self): super(ViewerApplication, self).post_init() self._check_network_configuration() glwidget = self._main_window.glwidget # Fixme: Basic... from PyGeoPortail.GraphicEngine.PainterManager import PainterManager self.painter_manager = PainterManager(glwidget) from PyGeoPortail.TileMap.GeoPortail import (GeoPortailPyramid, GeoPortailWTMS, GeoPortailWTMSLicence, GeoPortailMapProvider, GeoPortailOthorPhotoProvider) from PyGeoPortail.TileMap.LruCache import LruCache from PyGeoPortail.TileMap.Projection import GeoAngle, GeoCoordinate from PyGeoPortail.TileMap.TileCache import CachedPyramid from PyGeoPortail.Config import Config geoportail_licence = GeoPortailWTMSLicence.load_from_json(Config.License.geoportail) self._geoportail_wtms = GeoPortailWTMS(geoportail_licence) self._geoportail_map_provider = GeoPortailMapProvider(self._geoportail_wtms) self._lru_cache = LruCache(constraint=1024**3) self._cached_pyramid = CachedPyramid(self._geoportail_map_provider, self._lru_cache) pyramid = self._cached_pyramid._pyramid # Fixme: from PyGeoPortail.GraphicEngine.MosaicPainter import MosaicPainter self._mosaic_painter = MosaicPainter(self.painter_manager, self._cached_pyramid) from PyGeoPortail.GraphicEngine.PathPainter import PathPainter self._path_painter = PathPainter(self.painter_manager) glwidget.init_tools() # Fixme: for shader glwidget._zoom_manager.pyramid = pyramid # Fixme: glwidget._ready = True # Fixme: level = 16 longitude = GeoAngle(6, 7, 0) latitude = GeoAngle(44, 41, 0) location = GeoCoordinate(longitude, latitude) pyramid_level = pyramid[level] x, y = pyramid_level.coordinate_to_projection(location) glwidget.zoom_at_with_scale(x, y, zoom_factor=1/pyramid_level.resolution)
#################################################################################################### from PyGeoPortail.Config import Config from PyGeoPortail.TileMap.GeoPortail import (GeoPortailPyramid, GeoPortailWTMS, GeoPortailWTMSLicence, GeoPortailMapProvider, GeoPortailOthorPhotoProvider) from PyGeoPortail.TileMap.LruCache import LruCache from PyGeoPortail.TileMap.Projection import GeoAngle, GeoCoordinate from PyGeoPortail.TileMap.TileCache import CachedPyramid #################################################################################################### geoportail_licence = GeoPortailWTMSLicence.load_from_json(Config.License.geoportail) geoportail_wtms = GeoPortailWTMS(geoportail_licence, timeout=120) geoportail_pyramid = GeoPortailPyramid() level = 16 longitude = GeoAngle(6, 7, 0) latitude = GeoAngle(44, 41, 0) location = GeoCoordinate(longitude, latitude) row, column = geoportail_pyramid[level].coordinate_to_mosaic(location) print(level, row, column) x, y = geoportail_pyramid[level].coordinate_to_projection(location) from PyGeoPortail.Math.Interval import Interval2D interval = Interval2D((x, x + 500), (y, y + 500)) mosaic_interval = geoportail_pyramid[level].projection_interval_to_mosaic(interval)