示例#1
0
 def __init__ (self, name, mapfile = None, projection = None, fonts = None, **kwargs):
     MetaLayer.__init__(self, name, **kwargs) 
     self.mapfile = mapfile
     self.mapnik  = None
     self.projection = projection
     if fonts:
         self.fonts = fonts.split(",")
     else:
         self.fonts = []
示例#2
0
 def __init__ (self, name, mapfile = None, projection = None, fonts = None, **kwargs):
     MetaLayer.__init__(self, name, **kwargs) 
     self.mapfile = mapfile
     self.mapnik  = None
     self.projection = projection
     if fonts:
         self.fonts = fonts.split(",")
     else:
         self.fonts = []
示例#3
0
    def __init__(self, name, source_srs, dest_srs, scales, **kwargs):
        MetaLayer.__init__(self, name, **kwargs)

        # Type-cast scales (if coming from tilecache config file)
        if isinstance(scales, basestring):
            scales = [float(s) for s in scales.split(',')]

        self.set_resolutions(scales)
        self.source_srs = source_srs
        self.dest_srs = dest_srs
        self.set_bbox(self.bbox)
示例#4
0
    def __init__(self, name, source_srs, dest_srs, scales, **kwargs):
        MetaLayer.__init__(self, name, **kwargs)

        # Type-cast scales (if coming from tilecache config file)
        if isinstance(scales, basestring):
            scales = [float(s) for s in scales.split(',')]

        self.set_resolutions(scales)
        self.source_srs = source_srs
        self.dest_srs = dest_srs
        self.set_bbox(self.bbox)
示例#5
0
 def __init__ (self, name, url = None, off_layers = "", 
               projection = None, **kwargs):
     """
     Accepts projection in one of two forms: 
      * Raw string
      * String beginning with @, in which case string is treated as filename
     """ 
     MetaLayer.__init__(self, name, **kwargs) 
     self.url = url
     self.off_layers = off_layers
     self.projection = None
     if projection is not None:
         if projection.startswith("@"):
             self.projection = open(projection[1:]).read()
         else:
             self.projection = projection
示例#6
0
文件: Image.py 项目: ALDean/tilecache
 def __init__ (self, name, file = None, filebounds = "-180,-90,180,90",
                           transparency = False, scaling = "nearest", **kwargs):
     import PIL.Image as PILImage
     
     MetaLayer.__init__(self, name, **kwargs) 
     
     self.file = file
     self.filebounds  = map(float,filebounds.split(","))
     self.image = PILImage.open(self.file)
     self.image_size = self.image.size
     self.image_res = [(self.filebounds[2] - self.filebounds[0]) / self.image_size[0], 
                 (self.filebounds[3] - self.filebounds[1]) / self.image_size[1]
                ]
     self.scaling = scaling.lower()
     if isinstance(transparency, str):
         transparency = transparency.lower() in ("true", "yes", "1")
     self.transparency = transparency
    def __init__(self, name, file=None, **kwargs):

        MetaLayer.__init__(self, name, **kwargs)

        self.ds = gdal.Open(file, gdal.GA_ReadOnly)
        #self.geo_transform = self.ds.GetGeoTransform()
        # if self.geo_transform[2] != 0 or self.geo_transform[4] != 0:
        #     raise Exception("Image is not 'north-up', can not use.")
        self.geo_transform = (0.0, 1.0, 0.0, self.ds.RasterYSize, 0.0, -1.0)
        self.image_size = [self.ds.RasterXSize, self.ds.RasterYSize]
        xform = self.geo_transform
        self.data_extent = [
            xform[0] + self.ds.RasterYSize * xform[2],
            xform[3] + self.ds.RasterYSize * xform[5],
            xform[0] + self.ds.RasterXSize * xform[1],
            xform[3] + self.ds.RasterXSize * xform[4],
        ]
示例#8
0
 def __init__ (self, name, file = None, **kwargs):
     
     MetaLayer.__init__(self, name, **kwargs) 
     
     self.ds = gdal.Open(file)
     self.geo_transform = self.ds.GetGeoTransform()
     if self.geo_transform[2] != 0 or self.geo_transform[4] != 0:
         raise Exception("Image is not 'north-up', can not use.")
     if self.geo_transform == (0.0, 1.0, 0.0, 0.0, 0.0, 1.0):
         self.geo_transform = (0.0, 1.0, 0.0, self.ds.RasterYSize, 0.0, -1.0)
     size = [self.ds.RasterXSize, self.ds.RasterYSize]
     xform = self.geo_transform
     self.data_extent = [
        xform[0] + self.ds.RasterYSize * xform[2],
        xform[3] + self.ds.RasterYSize * xform[5],  
        xform[0] + self.ds.RasterXSize * xform[1],
        xform[3] + self.ds.RasterXSize * xform[4]
     ]   
示例#9
0
 def __init__(self,
              name,
              url=None,
              off_layers="",
              projection=None,
              **kwargs):
     """
     Accepts projection in one of two forms: 
      * Raw string
      * String beginning with @, in which case string is treated as filename
     """
     MetaLayer.__init__(self, name, **kwargs)
     self.url = url
     self.off_layers = off_layers
     self.projection = None
     if projection is not None:
         if projection.startswith("@"):
             self.projection = open(projection[1:]).read()
         else:
             self.projection = projection
示例#10
0
    def __init__(self,
                 name,
                 file=None,
                 filebounds="-180,-90,180,90",
                 transparency=False,
                 scaling="nearest",
                 **kwargs):
        import PIL.Image as PILImage

        MetaLayer.__init__(self, name, **kwargs)

        self.file = file
        self.filebounds = map(float, filebounds.split(","))
        self.image = PILImage.open(self.file)
        self.image_size = self.image.size
        self.image_res = [
            (self.filebounds[2] - self.filebounds[0]) / self.image_size[0],
            (self.filebounds[3] - self.filebounds[1]) / self.image_size[1]
        ]
        self.scaling = scaling.lower()
        if isinstance(transparency, str):
            transparency = transparency.lower() in ("true", "yes", "1")
        self.transparency = transparency
示例#11
0
文件: WMS.py 项目: vovoma/geocloud2
 def __init__ (self, name, url = None, user = None, password = None, expire=0, **kwargs):
     MetaLayer.__init__(self, name, **kwargs)
     self.url = url
     self.user = user
     self.password = password
     self.expire = expire
示例#12
0
 def __init__ (self, name, url = None, styles = "", user = None, password = None, **kwargs):
     MetaLayer.__init__(self, name, **kwargs) 
     self.url = url
     self.styles = styles
     self.user = user
     self.password = password
示例#13
0
文件: WMS.py 项目: trentford/iem
 def __init__(self, name, url=None, user=None, password=None, **kwargs):
     """Constructor"""
     MetaLayer.__init__(self, name, **kwargs)
     self.url = url
     self.user = user
     self.password = password
示例#14
0
 def __init__ (self, name, display='UTM', spacing=128, tick=8, **kwargs):
     MetaLayer.__init__(self, name, **kwargs)
     self.display = display.lower()
     self.spacing = int(spacing)
     self.tick = int(tick)
示例#15
0
文件: tilecache.py 项目: fevzidas/oam
 def __init__(self, name, **kwargs):
     MetaLayer.__init__(self, name, **kwargs)
     self.client = oam.Client(username, password)
示例#16
0
 def __init__ (self, name, mapfile = None, styles = "", **kwargs):
     MetaLayer.__init__(self, name, **kwargs) 
     self.mapfile = mapfile
     self.styles = styles
示例#17
0
 def __init__(self, name, mapfile=None, styles="", expire=0, **kwargs):
     MetaLayer.__init__(self, name, **kwargs)
     self.mapfile = mapfile
     self.styles = styles
     self.expire = expire
示例#18
0
文件: tilecache.py 项目: aaronr/oam
 def __init__ (self, name, **kwargs):
     MetaLayer.__init__(self, name, **kwargs) 
     self.client = oam.Client(username, password)