#!/usr/bin/env python3
import os

from utils import GeoServerRESTRunner

if __name__ == '__main__':

    runner = GeoServerRESTRunner()
    with runner.session() as s:

        response = runner.assert_get(
            s,
            '/workspaces/kartoza/datastores/gis/featuretypes/district_boundary'
        )

        if response.ok:
            print('Resource exists.')
            print()
            exit(0)

        data = {
            'featureType': {
                'name': 'district_boundary',
                'nativeName': 'district_boundary',
                'title': 'district_boundary',
                'srs': 'EPSG:4326',
                'metadata': {
                    'entry': [{
                        '@key': 'JDBC_VIRTUAL_TABLE',
                        'virtualTable': {
                            'name': 'district_boundary',
示例#2
0
        '/workspaces/kartoza/layers/{layer_name}.json'.format(
            layer_name=layer_name),
        json={
            'layer': {
                'defaultStyle': {
                    'name': style_name
                }
            }
        }
    )
    return response


if __name__ == '__main__':

    runner = GeoServerRESTRunner()
    with runner.session() as s:

        layer_and_style = [
            {
                'layer_name': 'district_boundary',
                'style_name': 'red_outline',
            },
            {
                'layer_name': 'sub_district_boundary',
                'style_name': 'red_outline',
            },
            {
                'layer_name': 'village_boundary',
                'style_name': 'red_outline',
            },
示例#3
0
        '/workspaces/kartoza/styles/{style_name}'.format(
            style_name=style_name),
        data=data,
        headers={
            'Content-type': 'application/vnd.ogc.sld+xml'
        }
    )

    runner.print_response(response)

    return response


if __name__ == '__main__':

    runner = GeoServerRESTRunner()
    with runner.session() as s:

        styles = [
            'red_outline',
            'building_vulnerability',
            'exposed_roads',
            'flood_depth_class',
            'osm_buildings',
            'osm_roads',
            'osm_waterways_scale',
            'district_map',
            'sub_district_map',
            'village_map',
            'osm_admin_web',
            'BlueprintBuildings',
示例#4
0
#!/usr/bin/env python3
import os

from utils import GeoServerRESTRunner

if __name__ == '__main__':

    runner = GeoServerRESTRunner()
    with runner.session() as s:

        response = runner.assert_get(s, '/workspaces/kartoza/datastores/gis')

        if response.ok:
            print('Resource exists.')
            print()
            exit(0)

        data = {
            'dataStore': {
                'name': 'gis',
                'type': 'PostGIS',
                'connectionParameters': {
                    'database': os.environ.get('GEOSERVER_STORE_POSTGRES_DB'),
                    'schema': 'public',
                    'host': os.environ.get('GEOSERVER_STORE_POSTGRES_HOST'),
                    'user': os.environ.get('GEOSERVER_STORE_POSTGRES_USER'),
                    'passwd': os.environ.get('GEOSERVER_STORE_POSTGRES_PASS'),
                    'port': os.environ.get('GEOSERVER_STORE_POSTGRES_PORT'),
                    'dbtype': 'postgis'
                }
            }
示例#5
0
#!/usr/bin/env python3
import os

from utils import GeoServerRESTRunner

if __name__ == '__main__':

    runner = GeoServerRESTRunner()
    with runner.session() as s:

        response = runner.assert_get(
            s, '/workspaces/kartoza/layergroups/flood_map')

        if response.ok:
            print('Resource exists.')
            print()
            exit(0)

        data = {
            'layerGroup': {
                'name': 'flood_map',
                'mode': 'SINGLE',
                'title': 'flood map',
                'publishables': {
                    'published': [{
                        '@type': 'layer',
                        'name': 'flood_map_district',
                    }, {
                        '@type': 'layer',
                        'name': 'flood_map_sub_district',
                    }, {