def __init__(self, _name, _location, _prefix, _ext,
                 _left_long, _top_lat,
                 _img_width, _img_height, _xscale, _yscale,
                 _numdigits, _usedash, _latfirst):
        """arguments:
        name       -- user-visible name of the collection
        location   -- directory on disk where the maps reside
        prefix     -- initial part of each maplet filename
        ext        -- filename extension including the dot, e.g. .jpg
        left_long  -- longitude of the left edge
        top_lat    -- latitude of the top edge
        img_width  -- width of each maplet in pixels
        img_height -- height of each maplet in pixels
        xscale     -- pixels per degree longitude
        yscale     -- pixels per degree latitude
        numdigits  -- number of digits in x and y file specifiers
        usedash    -- Boolean, use a dash between x and y in filenames?
        latfirst   -- Boolean, is latitude the first of the two numbers?

        """
        TiledMapCollection.__init__(self, _name, _location,
                                    _img_width, _img_height, )
        self.prefix = _prefix
        self.numdigits = _numdigits
        self.usedash = _usedash
        self.ext = _ext
        self.latfirst = _latfirst
        self.img_width = _img_width
        self.img_height = _img_height
        self.left_longitude = _left_long    # Left of 00-00 image
        self.top_latitude = _top_lat        # Top of 00-00 image
        self.xscale = float(_xscale)        # Pixels per degree
        self.yscale = float(_yscale)        # Pixels per degree
示例#2
0
    def __init__(self, _name, _location, _series, _tile_w, _tile_h,
                 _ser7prefix="012t", _ser15prefix="024t", _img_ext=".gif"):
        """arguments:
        name        -- user-visible name of the collection
        location    -- directory on disk where the maps reside
        series      -- initial series to use, 7.5 or 15 minutes of arc.
        tile_w      -- width of each maplet in pixels
        tile_h      -- height of each maplet in pixels
        img_ext     -- filename extension including the dot, e.g. .jpg
        ser7prefix  -- prefix for tile files implementing the 7.5-min series
        ser15prefix -- prefix for tile files implementing the 15-min series
        """

        TiledMapCollection.__init__(self, _name, _location, _tile_w, _tile_h)
        self.set_series(_series)
        self.ser7prefix = _ser7prefix
        self.ser15prefix = _ser15prefix
        self.img_ext = _img_ext

        # _correction because Topo1 maps aren't in WGS 84.
        # Right now these numbers are EMPIRICAL and inaccurate.
        # Need to do them right!
        # http://www.ngs.noaa.gov/cgi-bin/nadcon.prl says the correction
        # in the Mojave area from NAD27 to NAD84 (nobody converts to
        # WGS84, alas) should be -0.05463', 2.99014' (-1.684m, 75.554m)
        self.lon_correction = 0  # 0.032778 / 1000
        self.lat_correction = 0  # -1.794084 / 1000
示例#3
0
    def __init__(self, _name, _location, _series, _tile_w, _tile_h,
                 _ser7prefix="012t", _ser15prefix="024t", _img_ext=".gif"):
        """arguments:
        name        -- user-visible name of the collection
        location    -- directory on disk where the maps reside
        series      -- initial series to use, 7.5 or 15 minutes of arc.
        tile_w      -- width of each maplet in pixels
        tile_h      -- height of each maplet in pixels
        img_ext     -- filename extension including the dot, e.g. .jpg
        ser7prefix  -- prefix for tile files implementing the 7.5-min series
        ser15prefix -- prefix for tile files implementing the 15-min series
        """

        TiledMapCollection.__init__(self, _name, _location, _tile_w, _tile_h)
        self.set_series(_series)
        self.ser7prefix = _ser7prefix
        self.ser15prefix = _ser15prefix
        self.img_ext = _img_ext

        # _correction because Topo1 maps aren't in WGS 84.
        # Right now these numbers are EMPIRICAL and inaccurate.
        # Need to do them right!
        # http://www.ngs.noaa.gov/cgi-bin/nadcon.prl says the correction
        # in the Mojave area from NAD27 to NAD84 (nobody converts to
        # WGS84, alas) should be -0.05463', 2.99014' (-1.684m, 75.554m)
        self.lon_correction = 0  # 0.032778 / 1000
        self.lat_correction = 0  # -1.794084 / 1000
示例#4
0
    def __init__(self, _name, _location, _ext,
                 _img_width, _img_height, _init_zoom,
                 _download_url=None, maxzoom=19,
                 reload_if_older=None, attribution=None):
        """arguments:
        name         -- user-visible name of the collection
        location     -- directory on disk where the maps reside
        ext          -- filename extension including the dot, e.g. .jpg
        img_width    -- width of each maplet
        img_height   -- height of each maplet
        init_zoom    -- default initial zoom level
        download_url -- try to download missing maplets from here
        reload_if_older: if set, reload tiles older than this (in days)
        """
        TiledMapCollection.__init__(self, _name, _location,
                                    _img_width, _img_height)
        self.ext = _ext
        self.img_width = _img_width
        self.img_height = _img_height
        self.zoomlevel = _init_zoom
        self.powzoom = 2.0 ** self.zoomlevel   # to avoid re-re-calculating
        self.download_url = _download_url
        self.maxzoom = maxzoom

        self.Debug = False

        # If reload_tiles is set, it should be set to a Unix datestamp,
        # e.g. from when the program was started.
        # Any file older than that will be re-downloaded.
        # By default, never reload tiles.
        if reload_if_older:
            self.reload_tiles = time.time() - reload_if_older * 60*60*24
        else:
            self.reload_tiles = False

        if attribution:
            self.attribution = attribution
        else:
            self.attribution = "Map tiles copyright Openstreetmap.org"

        self.location = os.path.expanduser(self.location)

        # Handle ~ format for location

        # If we're download-capable, we'd better have a directory
        # to download to, so make it if it's not there already:
        if self.download_url and not os.access(self.location, os.W_OK):
            # XXX wrap in a try, show user-visible error dialog!
            os.makedirs(self.location)

        # Call zoom so we set all scales appropriately:
        self.zoom(0)
示例#5
0
 def __init__(self, _name, _location, _prefix, _ext, _left_long, _top_lat,
              _img_width, _img_height, _xscale, _yscale, _numdigits,
              _usedash, _latfirst):
     """Create a generic map collection.
     Parameters
     ----------
     name       : str
         user-visible name of the collection
     location   : str
         directory on disk where the maps reside
     prefix     : str
         initial part of each maplet filename
     ext        : str
         filename extension including the dot, e.g. .jpg
     left_long  : float
         longitude of the left edge
     top_lat    : float
         latitude of the top edge
     img_width  : int
         width of each maplet in pixels
     img_height : int
         height of each maplet in pixels
     xscale     : float
         pixels per degree longitude
     yscale     : float
         pixels per degree latitude
     numdigits  : int
         number of digits in x and y file specifiers
     usedash    : bool
         use a dash between x and y in filenames?
     latfirst   : bool
         is latitude the first of the two numbers?
     """
     TiledMapCollection.__init__(
         self,
         _name,
         _location,
         _img_width,
         _img_height,
     )
     self.prefix = _prefix
     self.numdigits = _numdigits
     self.usedash = _usedash
     self.ext = _ext
     self.latfirst = _latfirst
     self.img_width = _img_width
     self.img_height = _img_height
     self.left_longitude = _left_long  # Left of 00-00 image
     self.top_latitude = _top_lat  # Top of 00-00 image
     self.xscale = float(_xscale)  # Pixels per degree
     self.yscale = float(_yscale)  # Pixels per degree