Get a SRTM tile object. This function can return either an SRTM1 or
            SRTM3 object depending on what is available, however currently it
            only returns SRTM3 objects.
173487
def getTile(self, lat, lon):
        """"""
        global childFileListDownload
        global filelistDownloadActive
        mypid = os.getpid()
        if mypid in childFileListDownload and childFileListDownload[mypid].is_alive():
            if self.debug:
                print("still getting file list")
            return 0
        elif not os.path.isfile(self.filelist_file) and filelistDownloadActive == 0:
            self.createFileList()
            return 0
        elif not self.filelist:
            if self.debug:
                print("Filelist download complete, loading data ", self.filelist_file)
            data = open(self.filelist_file, 'rb')
            self.filelist = pickle.load(data)
            data.close()

        try:
            continent, filename = self.filelist[(int(lat), int(lon))]
        except KeyError:
            if len(self.filelist) > self.min_filelist_len:
                # we appear to have a full filelist - this must be ocean
                return SRTMOceanTile(int(lat), int(lon))
            return 0

        global childTileDownload
        mypid = os.getpid()
        if not os.path.exists(os.path.join(self.cachedir, filename)):
            if not mypid in childTileDownload or not childTileDownload[mypid].is_alive():
                try:
                    childTileDownload[mypid] = multiproc.Process(target=self.downloadTile, args=(str(continent), str(filename)))
                    childTileDownload[mypid].start()
                except Exception as ex:
                    if mypid in childTileDownload:
                        childTileDownload.pop(mypid)
                    return 0
                '''print("Getting Tile")'''
            return 0
        elif mypid in childTileDownload and childTileDownload[mypid].is_alive():
            '''print("Still Getting Tile")'''
            return 0
        # TODO: Currently we create a new tile object each time.
        # Caching is required for improved performance.
        try:
            return SRTMTile(os.path.join(self.cachedir, filename), int(lat), int(lon))
        except InvalidTileError:
            return 0
770842
function( level ) {

        if(this.emulateLegacyImagePyramid) {
            return $.TileSource.prototype.getTileWidth.call(this, level);
        }

        var scaleFactor = Math.pow(2, this.maxLevel - level);

        if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) {
            return this.tileSizePerScaleFactor[scaleFactor].width;
        }
        return this._tileWidth;
    }
1220872
def get_tile_id(self):
        
        tree = get_xml(self.get_url(AwsConstants.METADATA))

        tile_id_tag = 'TILE_ID_2A' if self.data_source is DataSource.SENTINEL2_L2A and self.baseline <= '02.06' else\
            'TILE_ID'
        tile_id = tree[0].find(tile_id_tag).text
        if self.safe_type is not EsaSafeType.OLD_TYPE:
            info = tile_id.split('_')
            tile_id = '_'.join([info[3], info[-2], info[-3], self.get_sensing_time()])
        return tile_id
212263
def _get_template_for_given_resolution(self, res, return_):
        """"""
        path = self._layer_files[self._res_indices[res][0]]
        if return_ == "path":
            return_value = path
        else:
            with rasterio.open(str(path)) as src:
                if return_ == "meta":
                    return_value = src.meta
                elif return_ == "windows":
                    return_value = tuple(src.block_windows())
                else:
                    raise ValueError("'return_' must be 'path', meta' or 'windows'.")
        return return_value
191995
function TMXTiledMap (opts) {
    TMXTiledMap.superclass.constructor.call(this, opts)

    this.anchorPoint = ccp(0, 0)

    var mapInfo

    var initialize = function () {
        this.mapSize        = mapInfo.mapSize
        this.tileSize       = mapInfo.tileSize
        this.mapOrientation = mapInfo.orientation
        this.objectGroups   = mapInfo.objectGroups
        this.properties     = mapInfo.properties
        this.tileProperties = mapInfo.tileProperties

        // Add layers to map
        var idx = 0
        mapInfo.layers.forEach(function (layerInfo) {
            if (layerInfo.visible) {
                var child = this.parseLayer({layerInfo: layerInfo, mapInfo: mapInfo})
                this.addChild({child: child, z: idx, tag: idx})

                var childSize   = child.contentSize
                var currentSize = this.contentSize
                currentSize.width  = Math.max(currentSize.width,  childSize.width)
                currentSize.height = Math.max(currentSize.height, childSize.height)
                this.contentSize = currentSize

                idx++
            }
        }.bind(this))
    }.bind(this)


    if (opts.file) {
        mapInfo = new TMXMapInfo({file: opts.file})
        initialize()
    } else if (opts.url) {
        var xhr = new XMLHttpRequest
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                var url = opts.url

                // Create absolute URL
                if (/^\/\//.test(url)) {
                    // URL prefixed with double slash
                    url = window.location.protocol + url
                } else if (/^\//.test(url)) {
                    // URL with single slash prefix
                    url = window.location.protocol + "//" + window.location.hostname + url
                } else {
                    url = window.location.href.replace(/\/[^\/]*$/, '/') + url
                }

                mapInfo = new TMXMapInfo({filename: url, xml: xhr.responseText})
                initialize()
            }
        }
        xhr.open('GET', opts.url, true)
        xhr.send(null)
    } else if (opts.xml) {
        mapInfo = new TMXMapInfo({xml: opts.xml})
        initialize()
    }
}
525189
def load_tile(self, tile):
		''''''

		# see if its in the tile cache
		key = tile.key()
		if key in self._tile_cache:
			img = self._tile_cache[key]
			if img == self._unavailable:
				img = self.load_tile_lowres(tile)
				if img is None:
					img = self._unavailable
				return img


		path = self.tile_to_path(tile)
		try:
			ret = cv.LoadImage(path)
			# if it is an old tile, then try to refresh
			if os.path.getmtime(path) + self.refresh_age < time.time():
				try:
					self._download_pending[key].refresh_time()
				except Exception:
					self._download_pending[key] = tile
					self.start_download_thread()
			# add it to the tile cache
			self._tile_cache[key] = ret
			while len(self._tile_cache) > self.cache_size:
				self._tile_cache.popitem(0)
			return ret
		except IOError as e:
			# windows gives errno 0 for some versions of python, treat that as ENOENT
			# and try a download
			if not e.errno in [errno.ENOENT,0]:
				raise
			pass
		if not self.download:
			img = self.load_tile_lowres(tile)
			if img is None:
				img = self._unavailable
			return img

		try:
			self._download_pending[key].refresh_time()
		except Exception:
			self._download_pending[key] = tile
		self.start_download_thread()

		img = self.load_tile_lowres(tile)
		if img is None:
			img = self._loading
		return img
759983
def get_tile_properties_by_layer(self, layer):
        
        try:
            assert (int(layer) >= 0)
            layer = int(layer)
        except (TypeError, AssertionError):
            msg = "Layer must be a positive integer.  Got {0} instead."
            logger.debug(msg.format(type(layer)))
            raise ValueError

        p = product(range(self.width), range(self.height))
        layergids = set(self.layers[layer].data[y][x] for x, y in p)

        for gid in layergids:
            try:
                yield gid, self.tile_properties[gid]
            except KeyError:
                continue
848949
def get_tile(tile_number):
    
    tile_number = int(tile_number)
    max_tiles = app.max_tiles
    if tile_number > max_tiles * max_tiles:
        raise TileOutOfBoundsError('Requested an out of bounds tile')

    tile_size = Point(
        app.img.size[0] // max_tiles, app.img.size[1] // max_tiles)
    tile_coords = Point(
        tile_number % max_tiles, tile_number // max_tiles)
    crop_box = (
        tile_coords.x * tile_size.x,
        tile_coords.y * tile_size.y,
        tile_coords.x * tile_size.x + tile_size.x,
        tile_coords.y * tile_size.y + tile_size.y,
    )
    return app.img.crop(crop_box)
161693
public static Point getPixelRelativeToTile(LatLong latLong, Tile tile) {
        return getPixelRelative(latLong, tile.mapSize, tile.getOrigin());
    }
676466
function getViewTileId(gid) {
         if (this.animations.has(gid)) {
           // apply animations
           gid = this.animations.get(gid).cur.tileid;
         } else {
           // get the local tileset id
           gid -= this.firstgid;
         }

         return gid;
       }
1146729
def get_object(no, generation = 0, use_xrefstm: true) #:nodoc:
            case no
            when Reference
                target = no
            when ::Integer
                target = Reference.new(no, generation)
            when Origami::Object
                return no
            else
                raise TypeError, "Invalid parameter type : #{no.class}"
            end

            #
            # Search through accessible indirect objects.
            #
            @revisions.reverse_each do |rev|
                return rev.body[target] if rev.body.include?(target)
            end

            #
            # Search through xref sections.
            #
            @revisions.reverse_each do |rev|
                next unless rev.xreftable?

                xref = rev.xreftable.find(target.refno)
                next if xref.nil? or xref.free?

                # Try loading the object if it is not present.
                object = load_object_at_offset(rev, xref.offset)
                return object unless object.nil?
            end

            return nil unless use_xrefstm

            # Search through xref streams.
            @revisions.reverse_each do |rev|
                next unless rev.xrefstm?

                xrefstm = rev.xrefstm

                xref = xrefstm.find(target.refno)
                next if xref.nil?

                #
                # We found a matching XRef.
                #
                if xref.is_a?(XRefToCompressedObject)
                    objstm = get_object(xref.objstmno, 0, use_xrefstm: use_xrefstm)

                    object = objstm.extract_by_index(xref.index)
                    if object.is_a?(Origami::Object) and object.no == target.refno
                        return object
                    else
                        return objstm.extract(target.refno)
                    end
                elsif xref.is_a?(XRef)
                    object = load_object_at_offset(rev, xref.offset)
                    return object unless object.nil?
                end
            end

            #
            # Lastly search directly into Object streams (might be very slow).
            #
            @revisions.reverse_each do |rev|
                stream = rev.objects.find{|obj| obj.is_a?(ObjectStream) and obj.include?(target.refno)}
                return stream.extract(target.refno) unless stream.nil?
            end

            nil
        end
1073626
function(tile, tileUrl, existingRevision, done) {
		if (!this.options.saveToCache) {
			return;
		}

		var canvas = document.createElement("canvas");
		canvas.width = tile.naturalWidth || tile.width;
		canvas.height = tile.naturalHeight || tile.height;

		var context = canvas.getContext("2d");
		context.drawImage(tile, 0, 0);

		var format = this.options.cacheFormat;

		canvas.toBlob(
			function(blob) {
				this._db
					.put({
						_id: tileUrl,
						_rev: existingRevision,
						timestamp: Date.now(),
					})
					.then(
						function(status) {
							return this._db.putAttachment(
								tileUrl,
								"tile",
								status.rev,
								blob,
								format
							);
						}.bind(this)
					)
					.then(function(resp) {
						if (done) {
							done();
						}
					})
					.catch(function() {
						// Saving the tile to the cache might have failed, 
						// but the tile itself has been loaded.
						if (done) {
							done();
						}
					});
			}.bind(this),
			format
		);
	}
1089551
def _get_footer(self, footer):
        
        if footer is None:
            html = self.footer()
        else:
            html = footer
        return html
2494
def get_tile_image(self, x, y, l):
        
        # disabled for now, re-enable when support for generic maps is restored
        # # since the tile has been queried, assume it wants to be checked
        # # for animations sometime in the future
        # if self._animation_queue:
        #     self._tracked_tiles.add((x, y, l))

        try:
            # animated, so return the correct frame
            return self._animated_tile[(x, y, l)]

        except KeyError:

            # not animated, so return surface from data, if any
            return self._get_tile_image(x, y, l)
263374
def downloader(self):
        ''''''
        while self.tiles_pending() > 0:
            time.sleep(self.tile_delay)

            keys = sorted(self._download_pending.keys())

            # work out which one to download next, choosing by request_time
            tile_info = self._download_pending[keys[0]]
            for key in keys:
                if self._download_pending[key].request_time > tile_info.request_time:
                    tile_info = self._download_pending[key]

            url = tile_info.url(self.service)
            path = self.tile_to_path(tile_info)
            key = tile_info.key()

            try:
                if self.debug:
                    print("Downloading %s [%u left]" % (url, len(keys)))
                req = url_request(url)
                if url.find('google') != -1:
                    req.add_header('Referer', 'https://maps.google.com/')
                resp = url_open(req)
                headers = resp.info()
            except url_error as e:
                #print('Error loading %s' % url)
                if not key in self._tile_cache:
                    self._tile_cache[key] = self._unavailable
                self._download_pending.pop(key)
                if self.debug:
                    print("Failed %s: %s" % (url, str(e)))
                continue
            if 'content-type' not in headers or headers['content-type'].find('image') == -1:
                if not key in self._tile_cache:
                    self._tile_cache[key] = self._unavailable
                self._download_pending.pop(key)
                if self.debug:
                    print("non-image response %s" % url)
                continue
            else:
                img = resp.read()

            # see if its a blank/unavailable tile
            md5 = hashlib.md5(img).hexdigest()
            if md5 in BLANK_TILES:
                if self.debug:
                    print("blank tile %s" % url)
                    if not key in self._tile_cache:
                        self._tile_cache[key] = self._unavailable
                self._download_pending.pop(key)
                continue

            mp_util.mkdir_p(os.path.dirname(path))
            h = open(path+'.tmp','wb')
            h.write(img)
            h.close()
            try:
                os.unlink(path)
            except Exception:
                pass
            os.rename(path+'.tmp', path)
            self._download_pending.pop(key)
        self._download_thread = None
969699
def get_url(self, filename):
        
        tile_url = self.tile_url
        force_http = filename in [AwsConstants.TILE_INFO, AwsConstants.PRODUCT_INFO, AwsConstants.METADATA]
        if tile_url is None or force_http:
            tile_url = self.get_tile_url(force_http=force_http)
        return '{}/{}'.format(tile_url, self.add_file_extension(filename))
599082
def get_template(self, uri):
        

        try:
            if self.filesystem_checks:
                return self._check(uri, self._collection[uri])
            else:
                return self._collection[uri]
        except KeyError:
            u = re.sub(r'^\/+', '', uri)
            for dir in self.directories:
                srcfile = posixpath.normpath(posixpath.join(dir, u))
                if os.path.isfile(srcfile):
                    return self._load(srcfile, uri)
            else:
                raise exceptions.TopLevelLookupException(
                                    "Cant locate template for uri %r" % uri)