Example #1
0
 def default_templates(self):
     base = gws.dirname(__file__) + '/templates'
     return [
         gws.Config(
             type='py',
             path=f'{base}/getCapabilities.py',
             subject='ows.GetCapabilities',
             mimeTypes=['xml'],
             access='all:allow',
         ),
         gws.Config(
             type='py',
             path=f'{base}/getRecords.py',
             subject='ows.getRecords',
             mimeTypes=['xml'],
             access='all:allow',
         ),
         gws.Config(
             type='py',
             path=f'{base}/getRecordById.py',
             subject='ows.GetRecordById',
             mimeTypes=['xml'],
             access='all:allow',
         ),
         gws.Config(
             type='py',
             path=f'{base}/record.py',
             subject='ows.Record',
             mimeTypes=['xml'],
             access='all:allow',
         ),
     ]
Example #2
0
 def default_templates(self):
     return [
         gws.Config(
             type='py',
             path=gws.dirname(__file__) + '/templates/getCapabilities.py',
             subject='ows.GetCapabilities',
             mimeTypes=['xml'],
             access='all:allow',
         ),
         gws.Config(
             type='py',
             path=gws.dirname(__file__) + '/templates/describeCoverage.py',
             subject='ows.DescribeCoverage',
             mimeTypes=['xml'],
             access='all:allow',
         ),
     ]
Example #3
0
 def default_templates(self):
     return [
         gws.Config(
             type='py',
             path=gws.dirname(__file__) + '/templates/getCapabilities.py',
             subject='ows.GetCapabilities',
             mimeTypes=['xml'],
             access='all:allow',
         ),
         # NB use the wfs template
         gws.Config(
             type='py',
             path=gws.dirname(__file__) + '/../wfs/templates/getFeature.py',
             subject='ows.GetFeatureInfo',
             mimeTypes=['xml', 'gml', 'gml3'],
             access='all:allow',
         ),
     ]
Example #4
0
import gws
import gws.base.api
import gws.base.client
import gws.base.map
import gws.base.printer
import gws.base.search
import gws.base.template
import gws.base.web
import gws.lib.metadata
import gws.types as t

_DEFAULT_TEMPLATES = [
    gws.Config(
        type='html',
        path=gws.dirname(__file__) + '/templates/project_description.cx.html',
        subject='project.description',
        access=[{
            'role': 'all',
            'type': 'allow'
        }],
    ),
]


class Config(gws.WithAccess):
    """Project configuration"""

    api: t.Optional[gws.base.api.Config]  #: project-specific actions
    assets: t.Optional[
        gws.base.web.DocumentRootConfig]  #: project-specific assets options
    client: t.Optional[
Example #5
0
        crs = crs.lower()
        if crs in _aliases:
            crs = _aliases[crs]

    if isinstance(crs, int):
        return gws.CrsFormat.EPSG, int(crs)

    if isinstance(crs, bytes):
        crs = crs.decode('ascii').lower()

    if crs.isdigit():
        return gws.CrsFormat.EPSG, int(crs)

    for fmt, r in _parse_formats.items():
        m = re.match(r, crs)
        if m:
            return fmt, int(m.group(1))

    return None, 0


##

_dbpath = gws.dirname(__file__) + '/crs.sqlite'


def _load(srid):
    with gws.lib.sqlite.connect(_dbpath) as conn:
        return conn.execute('SELECT * FROM crs WHERE srid=?',
                            (srid, )).fetchone()
Example #6
0
 def handle_describerecord(self, rd: core.Request):
     xml = gws.read_file(
         gws.dirname(__file__) + '/templates/describeRecord.xml')
     return gws.ContentResponse(content=xml, mime=gws.lib.mime.XML)