コード例 #1
0
ファイル: geojson.py プロジェクト: NonnEmilia/rmap
 def on_source(self, instance, value):
     if value.startswith("http://") or value.startswith("https://"):
         Downloader.instance().download(value, self._load_geojson_url)
     else:
         with open(value, "rb") as fd:
             geojson = json.load(fd)
         self.geojson = geojson
コード例 #2
0
 def on_source(self, instance, value):
     if value.startswith("http://") or value.startswith("https://"):
         Downloader.instance().download(value, self._load_geojson_url)
     else:
         with open(value, "rb") as fd:
             geojson = json.load(fd)
         self.geojson = geojson
コード例 #3
0
ファイル: geojson.py プロジェクト: mrhdias/garden.mapview
 def on_source(self, instance, value):
     if value.startswith("http://") or value.startswith("https://"):
         Downloader.instance().download(value, self._load_geojson_url)
     else:
         # "rb" was replaced by "r" to avoid this error:
         # TypeError: the JSON object must be str, not 'bytes'
         with open(value, "r") as fd:
             geojson = json.load(fd)
         self.geojson = geojson
コード例 #4
0
    def fill_tile(self, tile):
        """Add this tile to load within the downloader
        """
        if tile.state == "done":
            return

        if self.bounds is not None and self.restrict_to_bounds:
            min_x, min_y, max_x, max_y = self.get_bounds_xy(
                self.bounds, tile.zoom)
            if (tile.tile_x < min_x or tile.tile_x > max_x
                    or tile.tile_y < min_y or tile.tile_y > max_y):
                tile.state = "done"
                return

        Downloader.instance(cache_dir=self.cache_dir).download_tile(tile)
コード例 #5
0
 def fill_tile(self, tile):
     if tile.state == "done":
         return
     Downloader.instance().submit(self._load_tile, tile)
コード例 #6
0
 def fill_tile(self, tile):
     if tile.state == "done":
         return
     Downloader.instance().submit(self._load_tile, tile)
コード例 #7
0
 def fill_tile(self, tile):
     """Add this tile to load within the downloader
     """
     if tile.state == "done":
         return
     Downloader.instance().download_tile(tile)
コード例 #8
0
ファイル: source.py プロジェクト: AndreMiras/garden.mapview
 def fill_tile(self, tile):
     """Add this tile to load within the downloader
     """
     if tile.state == "done":
         return
     Downloader.instance().download_tile(tile)