Ejemplo n.º 1
0
from mapproxy.image import bbox_position_in_image, SubImageSource, BlankImageSource
from mapproxy.image.merge import concat_legends, LayerMerger
from mapproxy.image.opts import ImageOptions
from mapproxy.image.message import attribution_image, message_image
from mapproxy.layer import BlankImage, MapQuery, InfoQuery, LegendQuery, MapError, LimitedLayer
from mapproxy.layer import MapBBOXError, merge_layer_extents, merge_layer_res_ranges
from mapproxy.util import async
from mapproxy.util.py import cached_property, reraise
from mapproxy.util.coverage import load_limited_to
from mapproxy.util.ext.odict import odict
from mapproxy.template import template_loader, bunch, recursive_bunch
from mapproxy.service import template_helper
from mapproxy.layer import DefaultMapExtent, MapExtent

get_template = template_loader(__name__,
                               'templates',
                               namespace=template_helper.__dict__)


class PERMIT_ALL_LAYERS(object):
    pass


class WMSServer(Server):
    service = 'wms'
    fi_transformers = None

    def __init__(
        self,
        root_layer,
        md,
Ejemplo n.º 2
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Service requests (parsing, handling, etc).
"""
import re

from mapproxy.exception import RequestError
from mapproxy.request.base import RequestParams, BaseRequest, split_mime_type
from mapproxy.request.tile import TileRequest
from mapproxy.exception import XMLExceptionHandler
from mapproxy.template import template_loader
import mapproxy.service
get_template = template_loader(mapproxy.service.__name__, 'templates')


class WMTS100ExceptionHandler(XMLExceptionHandler):
    template_func = get_template
    template_file = 'wmts100exception.xml'
    content_type = 'text/xml'

    status_codes = {
        None: 500,
        'TileOutOfRange': 400,
        'MissingParameterValue': 400,
        'InvalidParameterValue': 400,
        'OperationNotSupported': 501
    }
Ejemplo n.º 3
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Service exception handling (WMS exceptions, XML, in_image, etc.).
"""
from mapproxy.exception import ExceptionHandler, XMLExceptionHandler
from mapproxy.response import Response
from mapproxy.image.message import message_image
from mapproxy.image.opts import ImageOptions
import mapproxy.service
from mapproxy.template import template_loader

get_template = template_loader(mapproxy.service.__file__, "templates")


class WMSXMLExceptionHandler(XMLExceptionHandler):
    template_func = get_template


class WMS100ExceptionHandler(WMSXMLExceptionHandler):
    """
    Exception handler for OGC WMS 1.0.0 ServiceExceptionReports
    """

    template_file = "wms100exception.xml"
    content_type = "text/xml"

Ejemplo n.º 4
0
from mapproxy.service.base import Server
from mapproxy.response import Response
from mapproxy.source import SourceError
from mapproxy.exception import RequestError
from mapproxy.image.merge import concat_legends, LayerMerger
from mapproxy.image.opts import ImageOptions
from mapproxy.image.message import attribution_image, message_image
from mapproxy.layer import BlankImage, MapQuery, InfoQuery, LegendQuery, MapError, LimitedLayer
from mapproxy.layer import MapBBOXError, merge_layer_extents, merge_layer_res_ranges
from mapproxy.util import async, cached_property
from mapproxy.util.coverage import load_limited_to
from mapproxy.util.ext.odict import odict
from mapproxy.template import template_loader, bunch
from mapproxy.service import template_helper

get_template = template_loader(__name__, "templates", namespace=template_helper.__dict__)


class PERMIT_ALL_LAYERS(object):
    pass


class WMSServer(Server):
    service = "wms"
    fi_transformers = None

    def __init__(
        self,
        root_layer,
        md,
        srs,
Ejemplo n.º 5
0
from mapproxy.compat import PY2
from mapproxy.exception import RequestError
from mapproxy.service.base import Server
from mapproxy.response import Response
from mapproxy.srs import SRS, get_epsg_num
from mapproxy.layer import SRSConditional, CacheMapLayer, ResolutionConditional
from mapproxy.source.wms import WMSSource

if PY2:
    import urllib2
else:
    from urllib import request as urllib2

from mapproxy.template import template_loader, bunch
env = {'bunch': bunch}
get_template = template_loader(__name__, 'templates', namespace=env)


def static_filename(name):
    if base_config().template_dir:
        return os.path.join(base_config().template_dir, name)
    else:
        return pkg_resources.resource_filename(__name__, os.path.join('templates', name))

class DemoServer(Server):
    names = ('demo',)
    def __init__(self, layers, md, request_parser=None, tile_layers=None,
                 srs=None, image_formats=None, services=None, restful_template=None):
        Server.__init__(self)
        self.layers = layers
        self.tile_layers = tile_layers or {}
Ejemplo n.º 6
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Service requests (parsing, handling, etc).
"""
import re

from mapproxy.exception import RequestError
from mapproxy.request.base import RequestParams, BaseRequest, split_mime_type
from mapproxy.request.tile import TileRequest
from mapproxy.exception import XMLExceptionHandler
from mapproxy.template import template_loader
import mapproxy.service

get_template = template_loader(mapproxy.service.__name__, 'templates')


class WMTS100ExceptionHandler(XMLExceptionHandler):
    template_func = get_template
    template_file = 'wmts100exception.xml'
    content_type = 'text/xml'

    status_codes = {
        None: 500,
        'TileOutOfRange': 400,
        'MissingParameterValue': 400,
        'InvalidParameterValue': 400,
        'OperationNotSupported': 501
    }
Ejemplo n.º 7
0
import pkg_resources
import mimetypes
from urllib2 import urlopen
from collections import defaultdict

from mapproxy.exception import RequestError
from mapproxy.service.base import Server
from mapproxy.response import Response
from mapproxy.srs import SRS, get_epsg_num
from mapproxy.layer import SRSConditional, CacheMapLayer, ResolutionConditional
from mapproxy.source.wms import WMSSource

from mapproxy.template import template_loader, bunch
env = {'bunch': bunch}
get_template = template_loader(__name__, 'templates', namespace=env)


class DemoServer(Server):
    names = ('demo',)
    def __init__(self, layers, md, request_parser=None, tile_layers=None,
                 srs=None, image_formats=None, services=None):
        Server.__init__(self)
        self.layers = layers
        self.tile_layers = tile_layers or {}
        self.md = md
        self.image_formats = image_formats
        filter_image_format = []
        for format in self.image_formats:
            if 'image/jpeg' == format or 'image/png' == format:
                filter_image_format.append(format)
Ejemplo n.º 8
0
from mapproxy.request.base import split_mime_type
from mapproxy.layer import map_extent_from_grid
from mapproxy.source import SourceError
from mapproxy.srs import SRS
from mapproxy.grid import default_bboxs
from mapproxy.image import BlankImageSource
from mapproxy.image.opts import ImageOptions
from mapproxy.image.mask import mask_image_source_from_coverage
from mapproxy.util.ext.odict import odict
from mapproxy.util.coverage import load_limited_to

import logging
log = logging.getLogger(__name__)

from mapproxy.template import template_loader, bunch
get_template = template_loader(__name__, 'templates')


class TileServer(Server):
    """
    A Tile Server. Supports strict TMS and non-TMS requests. The difference is the
    support for profiles. The our internal tile cache starts with one tile at the
    first level (like KML, etc.), but the global-geodetic and global-mercator
    start with two and four tiles. The ``tile_request`` should set ``use_profiles``
    accordingly (eg. False if first level is one tile)
    """
    names = ('tiles', 'tms')
    request_parser = staticmethod(tile_request)
    request_methods = ('map', 'tms_capabilities, tms_root_resource')
    template_file = 'tms_capabilities.xml'
    layer_template_file = 'tms_tilemap_capabilities.xml'
Ejemplo n.º 9
0
from mapproxy.service.base import Server
from mapproxy.response import Response
from mapproxy.source import SourceError
from mapproxy.exception import RequestError
from mapproxy.image.merge import concat_legends, LayerMerger
from mapproxy.image.opts import ImageOptions
from mapproxy.image.message import attribution_image, message_image
from mapproxy.layer import BlankImage, MapQuery, InfoQuery, LegendQuery, MapError, LimitedLayer
from mapproxy.layer import MapBBOXError, merge_layer_extents, merge_layer_res_ranges
from mapproxy.util import async, cached_property
from mapproxy.util.geom import load_limited_to
from mapproxy.util.ext.odict import odict
from mapproxy.template import template_loader, bunch
from mapproxy.service import template_helper

get_template = template_loader(__file__, 'templates', namespace=template_helper.__dict__)


class PERMIT_ALL_LAYERS(object):
    pass

class WMSServer(Server):
    service = 'wms'
    fi_transformers = None
    
    def __init__(self, root_layer, md, srs, image_formats,
        request_parser=None, tile_layers=None, attribution=None, 
        info_types=None, strict=False, on_error='raise',
        concurrent_layer_renderer=1, max_output_pixels=None,
        bbox_srs=None, max_tile_age=None):
        Server.__init__(self)
Ejemplo n.º 10
0
from mapproxy.request.tile import tile_request
from mapproxy.request.base import split_mime_type
from mapproxy.layer import map_extent_from_grid
from mapproxy.source import SourceError
from mapproxy.srs import SRS
from mapproxy.grid import default_bboxs
from mapproxy.image import BlankImageSource
from mapproxy.image.opts import ImageOptions
from mapproxy.util.ext.odict import odict

import logging
log = logging.getLogger(__name__)


from mapproxy.template import template_loader, bunch
get_template = template_loader(__name__, 'templates')

class TileServer(Server):
    """
    A Tile Server. Supports strict TMS and non-TMS requests. The difference is the
    support for profiles. The our internal tile cache starts with one tile at the
    first level (like KML, etc.), but the global-geodetic and global-mercator
    start with two and four tiles. The ``tile_request`` should set ``use_profiles``
    accordingly (eg. False if first level is one tile)
    """
    names = ('tiles', 'tms')
    request_parser = staticmethod(tile_request)
    request_methods = ('map', 'tms_capabilities')
    template_file = 'tms_capabilities.xml'
    layer_template_file = 'tms_tilemap_capabilities.xml'
Ejemplo n.º 11
0
"""
WMS service handler
"""

from functools import partial

from mapproxy.request.wmts import wmts_request, make_wmts_rest_request_parser, URLTemplateConverter
from mapproxy.service.base import Server
from mapproxy.response import Response
from mapproxy.exception import RequestError
from mapproxy.util.coverage import load_limited_to

from mapproxy.template import template_loader, bunch

env = {"bunch": bunch}
get_template = template_loader(__name__, "templates", namespace=env)

import logging

log = logging.getLogger(__name__)


class WMTSServer(Server):
    service = "wmts"

    def __init__(self, layers, md, request_parser=None, max_tile_age=None):
        Server.__init__(self)
        self.request_parser = request_parser or wmts_request
        self.md = md
        self.max_tile_age = max_tile_age
        self.layers, self.matrix_sets = self._matrix_sets(layers)
Ejemplo n.º 12
0
from mapproxy.request.tile import tile_request
from mapproxy.request.base import split_mime_type
from mapproxy.layer import map_extent_from_grid
from mapproxy.source import SourceError
from mapproxy.srs import SRS
from mapproxy.grid import default_bboxs
from mapproxy.image import BlankImageSource
from mapproxy.image.opts import ImageOptions
from mapproxy.util.ext.odict import odict

import logging
log = logging.getLogger(__name__)


from mapproxy.template import template_loader, bunch
get_template = template_loader(__file__, 'templates')

class TileServer(Server):
    """
    A Tile Server. Supports strict TMS and non-TMS requests. The difference is the
    support for profiles. The our internal tile cache starts with one tile at the
    first level (like KML, etc.), but the global-geodetic and global-mercator
    start with two and four tiles. The ``tile_request`` should set ``use_profiles``
    accordingly (eg. False if first level is one tile)
    """
    names = ('tiles', 'tms')
    request_parser = staticmethod(tile_request)
    request_methods = ('map', 'tms_capabilities')
    template_file = 'tms_capabilities.xml'
    layer_template_file = 'tms_tilemap_capabilities.xml'