def test_scale_50000(self):
        mapExtent = '629426.805556,236325.694444,643573.194444,245674.305556'
        geometry = '636500.0,241000.0'
        params = {'imageDisplay': '2851,1884,256.0',
                  'mapExtent': mapExtent,
                  'geometry': geometry,
                  'geometryType': 'esriGeometryPoint'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/json')
        self.assertGreaterEqual(len(resp.json['results']), 25)
        ist = resp.json['results']
        soll = ["18611231", "18641231", "18661231", "18711231", "18751231", "18761231",
                "18791231", "18821231", "18841231", "18961231", "18971231", "19011231",
                "19131231", "19311231", "19421231", "19571231", "19641231", "19701231",
                "19761231", "19821231", "19881231", "19941231", "20001231", "20061231", "20121231"]
        for idx, i in enumerate(ist):
            self.assertEqual(i, soll[idx], str(idx))

        params = {'imageDisplay': '2851,1884,256.0',
                  'mapExtent': shift_to_lv95(mapExtent),
                  'geometry': shift_to_lv95(geometry),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '2056'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/json')
        self.assertGreaterEqual(len(resp.json['results']), 25)
        ist = resp.json['results']
        for idx, i in enumerate(ist):
            self.assertEqual(i, soll[idx], str(idx))
Esempio n. 2
0
    def test_scale_50000(self):
        mapExtent = '629426.805556,236325.694444,643573.194444,245674.305556'
        geometry = '636500.0,241000.0'
        params = {'imageDisplay': '2851,1884,256.0',
                  'mapExtent': mapExtent,
                  'geometry': geometry,
                  'geometryType': 'esriGeometryPoint'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/geo+json')
        self.assertGreaterEqual(len(resp.json['results']), 25)
        ist = resp.json['results']
        soll = ["18611231", "18641231", "18661231", "18711231", "18751231", "18761231",
                "18791231", "18821231", "18841231", "18961231", "18971231", "19011231",
                "19131231", "19311231", "19421231", "19571231", "19641231", "19701231",
                "19761231", "19821231", "19881231", "19941231", "20001231", "20061231", "20121231"]
        for idx, i in enumerate(ist):
            self.assertEqual(i, soll[idx], str(idx))

        params = {'imageDisplay': '2851,1884,256.0',
                  'mapExtent': shift_to_lv95(mapExtent),
                  'geometry': shift_to_lv95(geometry),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '2056'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/geo+json')
        self.assertGreaterEqual(len(resp.json['results']), 25)
        ist = resp.json['results']
        for idx, i in enumerate(ist):
            self.assertEqual(i, soll[idx], str(idx))
    def test_scale_100000(self):
        mapExtent = '620998.611111,231681.388889,649291.388889,250378.611111'
        geometry = '636500.0,241000.0'
        params = {'imageDisplay': '2851,1884,256.0',
                  'mapExtent': mapExtent,
                  'geometry': geometry,
                  'geometryType': 'esriGeometryPoint'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/json')
        self.assertGreaterEqual(len(resp.json['results']), 25)
        ist = resp.json['results']
        soll = ["18611231", "18641231", "18661231", "18711231", "18751231", "18761231",
                "18791231", "18821231", "18851231", "18891231", "18931231", "18951231",
                "18981231", "19021231", "19051231", "19061231", "19081231", "19091231",
                "19121231", "19221231", "19231231", "19281231", "19331231", "19591231",
                "19651231", "19701231", "19761231", "19821231", "19881231", "19941231",
                "20001231", "20071231", "20171231"]
        for idx, i in enumerate(ist):
            self.assertEqual(i, soll[idx], str(idx))

        params = {'imageDisplay': '2851,1884,256.0',
                  'mapExtent': shift_to_lv95(mapExtent),
                  'geometry': shift_to_lv95(geometry),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '2056'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/json')
        self.assertGreaterEqual(len(resp.json['results']), 25)
        ist = resp.json['results']
        for idx, i in enumerate(ist):
            self.assertEqual(i, soll[idx], str(idx))
Esempio n. 4
0
    def test_scale_100000(self):
        mapExtent = '620998.611111,231681.388889,649291.388889,250378.611111'
        geometry = '636500.0,241000.0'
        params = {'imageDisplay': '2851,1884,256.0',
                  'mapExtent': mapExtent,
                  'geometry': geometry,
                  'geometryType': 'esriGeometryPoint'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/geo+json')
        self.assertGreaterEqual(len(resp.json['results']), 25)
        ist = resp.json['results']
        soll = ["18611231", "18641231", "18661231", "18711231", "18751231", "18761231",
                "18791231", "18821231", "18851231", "18891231", "18931231", "18951231",
                "18981231", "19021231", "19051231", "19061231", "19081231", "19091231",
                "19121231", "19221231", "19231231", "19281231", "19331231", "19591231",
                "19651231", "19701231", "19761231", "19821231", "19881231", "19941231",
                "20001231", "20071231", "20171231"]
        for idx, i in enumerate(ist):
            self.assertEqual(i, soll[idx], str(idx))

        params = {'imageDisplay': '2851,1884,256.0',
                  'mapExtent': shift_to_lv95(mapExtent),
                  'geometry': shift_to_lv95(geometry),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '2056'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/geo+json')
        self.assertGreaterEqual(len(resp.json['results']), 25)
        ist = resp.json['results']
        for idx, i in enumerate(ist):
            self.assertEqual(i, soll[idx], str(idx))
Esempio n. 5
0
 def test_search_locations_with_bbox_sort(self):
     params = {
         'type': 'locations',
         'searchText': 'buechli tegerfelden',
         'bbox': '564100,168443,664150,268643'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.json['results'][0]['attrs']['detail'], 'buechli 1 5306 tegerfelden 4320 tegerfelden ch ag')
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params['sr'] = '2056'
     params['bbox'] = shift_to_lv95(params['bbox'])
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.json['results'][0]['attrs']['detail'], 'buechli 1 5306 tegerfelden 4320 tegerfelden ch ag')
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 2056, spatialOrder=True)
     params = {
         'type': 'locations',
         'searchText': 'buechli tegerfelden',
         'bbox': '564100,168443,664150,268643',
         'sortbbox': 'true'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.json['results'][0]['attrs']['detail'], 'buechli 1 5306 tegerfelden 4320 tegerfelden ch ag')
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params = {
         'type': 'locations',
         'searchText': 'buechli tegerfelden',
         'bbox': '564100,168443,664150,268643',
         'sortbbox': 'false'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.json['results'][0]['attrs']['detail'], 'buechli  5306 tegerfelden 4320 tegerfelden ch ag')
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 21781)
Esempio n. 6
0
 def test_search_locations_with_bbox_sort(self):
     params = {
         'type': 'locations',
         'searchText': 'buechli tegerfelden',
         'bbox': '564100,168443,664150,268643'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.json['results'][0]['attrs']['detail'], 'buechli 1 5306 tegerfelden 4320 tegerfelden ch ag')
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params['sr'] = '2056'
     params['bbox'] = shift_to_lv95(params['bbox'])
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.json['results'][0]['attrs']['detail'], 'buechli 1 5306 tegerfelden 4320 tegerfelden ch ag')
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 2056, spatialOrder=True)
     params = {
         'type': 'locations',
         'searchText': 'buechli tegerfelden',
         'bbox': '564100,168443,664150,268643',
         'sortbbox': 'true'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.json['results'][0]['attrs']['detail'], 'buechli 1 5306 tegerfelden 4320 tegerfelden ch ag')
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params = {
         'type': 'locations',
         'searchText': 'buechli tegerfelden',
         'bbox': '564100,168443,664150,268643',
         'sortbbox': 'false'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.json['results'][0]['attrs']['detail'], 'buechli  5306 tegerfelden 4320 tegerfelden ch ag')
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 21781)
    def test_service(self):
        mapExtent = '611399.9999999999,158650,690299.9999999999,198150'
        geometry = '650000.0,170000.0'
        params = {'imageDisplay': '500,600,96',
                  'mapExtent': mapExtent,
                  'geometry': geometry,
                  'geometryType': 'esriGeometryPoint'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        results_lv03 = resp.json['results']
        self.assertEqual(resp.content_type, 'application/json')
        self.assertTrue(len(results_lv03) >= 22, len(results_lv03))

        params = {'imageDisplay': '500,600,96',
                  'mapExtent': shift_to_lv95(mapExtent),
                  'geometry': shift_to_lv95(geometry),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '2056'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/json')
        self.assertTrue(len(resp.json['results']) >= 22, len(resp.json['results']))

        params = {'imageDisplay': '500,600,96',
                  'mapExtent': reproject_to_srid(mapExtent, 21781, 3857),
                  'geometry': reproject_to_srid(geometry, 21781, 3857),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '3857'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/json')
        self.assertTrue(len(resp.json['results']) >= 22, len(resp.json['results']))

        mapExtent = '611398,158649,6903005,198152'
        params = {'imageDisplay': '500,600,50',
                  'mapExtent': reproject_to_srid(mapExtent, 21781, 4326),
                  'geometry': reproject_to_srid(geometry, 21781, 4326),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '4326'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/json')
Esempio n. 8
0
    def test_service(self):
        mapExtent = '611399.9999999999,158650,690299.9999999999,198150'
        geometry = '650000.0,170000.0'
        params = {'imageDisplay': '500,600,96',
                  'mapExtent': mapExtent,
                  'geometry': geometry,
                  'geometryType': 'esriGeometryPoint'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        results_lv03 = resp.json['results']
        self.assertEqual(resp.content_type, 'application/geo+json')
        self.assertTrue(len(results_lv03) >= 22, len(results_lv03))

        params = {'imageDisplay': '500,600,96',
                  'mapExtent': shift_to_lv95(mapExtent),
                  'geometry': shift_to_lv95(geometry),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '2056'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/geo+json')
        self.assertTrue(len(resp.json['results']) >= 22, len(resp.json['results']))

        params = {'imageDisplay': '500,600,96',
                  'mapExtent': reproject_to_srid(mapExtent, 21781, 3857),
                  'geometry': reproject_to_srid(geometry, 21781, 3857),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '3857'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/geo+json')
        self.assertTrue(len(resp.json['results']) >= 22, len(resp.json['results']))

        mapExtent = '611398,158649,6903005,198152'
        params = {'imageDisplay': '500,600,50',
                  'mapExtent': reproject_to_srid(mapExtent, 21781, 4326),
                  'geometry': reproject_to_srid(geometry, 21781, 4326),
                  'geometryType': 'esriGeometryPoint',
                  'sr': '4326'
                  }
        resp = self.testapp.get('/rest/services/all/MapServer/' + zlayer + '/releases', params=params, status=200)
        self.assertEqual(resp.content_type, 'application/geo+json')
 def test_identify_valid_on_grid(self):
     params = {'geometry': '555000,171125',
               'geometryFormat': 'geojson',
               'geometryType': 'esriGeometryPoint',
               'imageDisplay': '1920,793,96',
               'layers': 'all:ch.bfe.windenergie-geschwindigkeit_h50',
               'mapExtent': '346831.18,86207.571,826831.18,284457.57',
               'returnGeometry': 'true',
               'tolerance': '10'}
     resp = self.testapp.get('/rest/services/all/MapServer/identify', params=params, headers=accept_headers, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertIn('results', resp.json)
     self.assertEqual(len(resp.json['results']), 1)
     params['sr'] = '2056'
     params['geometry'] = shift_to_lv95(params['geometry'])
     params['mapExtent'] = shift_to_lv95(params['mapExtent'])
     resp_2 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
     self.assertEqual(resp_2.content_type, 'application/json')
     self.assertGeojsonFeature(resp_2.json['results'][0], 2056)
     self.assertEqual(resp.json['results'][0]['id'], resp_2.json['results'][0]['id'])
Esempio n. 10
0
    def test_identify_gen50_geom(self):
        params = {'geometryType': 'esriGeometryPoint',
                  'returnGeometry': 'false',
                  'layers': 'all:ch.swisstopo-vd.geometa-gemeinde',
                  'geometry': '561289,185240',
                  'mapExtent': '561156.75,185155,561421.25,185325',
                  'imageDisplay': '529,340,96',
                  'tolerance': '5'}
        resp_1 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertNotEqual(len(resp_1.json['results']), 0)
        self.assertEsrijsonFeature(resp_1.json['results'][0], 21781, hasGeometry=False)

        params['sr'] = '2056'
        params['geometry'] = shift_to_lv95(params['geometry'])
        params['mapExtent'] = shift_to_lv95(params['mapExtent'])
        resp_2 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertNotEqual(len(resp_2.json['results']), 0)
        self.assertEsrijsonFeature(resp_2.json['results'][0], 2056, hasGeometry=False)

        self.assertEqual(resp_1.json['results'][0]['id'], resp_2.json['results'][0]['id'])
Esempio n. 11
0
    def test_identify_with_geojson(self):
        params = {'geometry': '600000,200000,631000,210000',
                  'geometryType': 'esriGeometryEnvelope',
                  'imageDisplay': '500,600,96',
                  'mapExtent': '548945.5,147956,549402,148103.5',
                  'tolerance': '1',
                  'layers': 'all:ch.bafu.bundesinventare-bln',
                  'geometryFormat': 'geojson'}
        resp_1 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_1.content_type, 'application/json')
        self.assertGeojsonFeature(resp_1.json['results'][0], 21781)

        params['sr'] = '2056'
        params['geometry'] = shift_to_lv95(params['geometry'])
        params['mapExtent'] = shift_to_lv95(params['mapExtent'])
        resp_2 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_2.content_type, 'application/json')
        self.assertGeojsonFeature(resp_2.json['results'][0], 2056)

        self.assertEqual(resp_1.json['results'][0]['id'], resp_2.json['results'][0]['id'])
Esempio n. 12
0
    def test_identify_with_geojson_returned_geometry_various_sr(self):
        params = {'geometry': '600000,200000,601000,201000',
                  'geometryType': 'esriGeometryEnvelope',
                  'imageDisplay': '500,600,96',
                  'mapExtent': '548945.5,147956,549402,148103.5',
                  'tolerance': '1',
                  'layers': 'all:ch.bav.haltestellen-oev',
                  'geometryFormat': 'geojson',
                  'sr': '21781'}

        # LV03
        resp_1 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_1.content_type, 'application/json')
        self.assertGeojsonFeature(resp_1.json['results'][0], 21781)
        self.assertIn(resp_1.json['results'][0]['geometry']['type'], ['MultiPoint', 'GeometryCollection'])
        resp1_ids = [d['id'] for d in resp_1.json['results']]

        # LV95
        params['sr'] = '2056'
        params['geometry'] = shift_to_lv95(params['geometry'])
        params['mapExtent'] = shift_to_lv95(params['mapExtent'])
        resp_2 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_2.content_type, 'application/json')
        self.assertGeojsonFeature(resp_2.json['results'][0], 2056)
        self.assertEqual(len(resp_2.json['results']), len(resp_1.json['results']))
        self.assertEqual(resp_1.json['results'][0]['id'], resp_2.json['results'][0]['id'])
        resp2_ids = [d['id'] for d in resp_2.json['results']]
        self.assertEqual(resp1_ids, resp2_ids)

        # Web Mercator
        # TODO requess is OK, geometries are not reprojected
        params['sr'] = '3857'
        params['geometry'] = reproject_to_srid(params['geometry'], 2056, 3857)
        params['mapExtent'] = reproject_to_srid(params['mapExtent'], 2056, 3857)
        resp_3 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_3.content_type, 'application/json')
        self.assertGeojsonFeature(resp_3.json['results'][0], 3857)
        self.assertEqual(len(resp_3.json['results']), len(resp_2.json['results']))
        self.assertEqual(resp_3.json['results'][0]['id'], resp_2.json['results'][0]['id'])
        resp3_ids = [d['id'] for d in resp_3.json['results']]
        self.assertEqual(resp1_ids, resp3_ids)
Esempio n. 13
0
    def test_identify_one_timeinstant_several_layers(self):
        params = {'geometryType': 'esriGeometryPoint',
                  'geometry': '630853.8,170647.9',
                  'geometryFormat': 'geojson',
                  'imageDisplay': '1920,734,96',
                  'mapExtent': '134253,-21102,1382253,455997',
                  'tolerance': '5',
                  'layers': 'all:ch.swisstopo.zeitreihen,ch.swisstopo.swissboundaries3d-gemeinde-flaeche.fill,ch.bazl.luftfahrthindernis',
                  'timeInstant': '2000'}
        resp_1 = self.testapp.get('/rest/services/all/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_1.content_type, 'application/json')
        self.assertGeojsonFeature(resp_1.json['results'][0], 21781)

        params['sr'] = '2056'
        params['geometry'] = shift_to_lv95(params['geometry'])
        params['mapExtent'] = shift_to_lv95(params['mapExtent'])
        resp_2 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertNotEqual(len(resp_2.json['results']), 0)
        self.assertGeojsonFeature(resp_2.json['results'][0], 2056)

        self.assertEqual(resp_1.json['results'][0]['id'], resp_2.json['results'][0]['id'])
Esempio n. 14
0
    def test_identify_with_geojson_returned_geometry(self):
        params = {'geometry': '600000,200000,6020000,2020000',  # 600000,200000,631000,210000',
                  'geometryType': 'esriGeometryEnvelope',
                  'imageDisplay': '500,600,96',
                  'mapExtent': '548945.5,147956,549402,148103.5',
                  'tolerance': '1',
                  'layers': 'all:ch.swisstopo.lubis-luftbilder_farbe',
                  'geometryFormat': 'geojson'}
        resp_1 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_1.content_type, 'application/json')
        self.assertGeojsonFeature(resp_1.json['results'][0], 21781)
        self.assertIn(resp_1.json['results'][0]['geometry']['type'], ['Polygon', 'GeometryCollection'])

        params['sr'] = '2056'
        params['geometry'] = shift_to_lv95(params['geometry'])
        params['mapExtent'] = shift_to_lv95(params['mapExtent'])
        resp_2 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_2.content_type, 'application/json')
        self.assertGeojsonFeature(resp_2.json['results'][0], 2056)
        self.assertEqual(len(resp_2.json['results']), len(resp_1.json['results']))
        self.assertEqual(resp_1.json['results'][0]['id'], resp_2.json['results'][0]['id'])
Esempio n. 15
0
    def test_identify_timeinstant(self):
        params = {'geometryFormat': 'geojson',
                  'geometryType': 'esriGeometryPoint',
                  'geometry': '630853.809670509,170647.93120352627',
                  'imageDisplay': '1920,734,96',
                  'mapExtent': '134253,-21102,1382253,455997',
                  'tolerance': '5',
                  'layers': 'all:ch.swisstopo.zeitreihen',
                  'timeInstant': '1936'}
        resp_1 = self.testapp.get('/rest/services/all/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_1.content_type, 'application/json')
        self.assertEqual(len(resp_1.json['results']), 2)
        self.assertGeojsonFeature(resp_1.json['results'][0], 21781)

        params['sr'] = '2056'
        params['geometry'] = shift_to_lv95(params['geometry'])
        params['mapExtent'] = shift_to_lv95(params['mapExtent'])
        resp_2 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertNotEqual(len(resp_2.json['results']), 0)
        self.assertGeojsonFeature(resp_2.json['results'][0], 2056)

        self.assertEqual(resp_1.json['results'][0]['id'], resp_2.json['results'][0]['id'])
Esempio n. 16
0
    def test_identify_timeinstant_zeitreihen(self):
        params = {'geometryFormat': 'geojson',
                  'geometryType': 'esriGeometryPoint',
                  'geometry': '614277,188148',
                  'imageDisplay': '1920,573,96',
                  'mapExtent': '570727,172398,666727,201048',
                  'tolerance': '10',
                  'timeInstant': '2000',
                  'returnGeometry': 'true',
                  'layers': 'all:ch.swisstopo.zeitreihen'}
        resp_1 = self.testapp.get('/rest/services/all/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertEqual(resp_1.content_type, 'application/json')
        self.assertEqual(resp_1.json['results'][0]['properties']['produkt'], 'lk25')
        self.assertEqual(len(resp_1.json['results']), 1)
        self.assertGeojsonFeature(resp_1.json['results'][0], 21781)

        params['sr'] = '2056'
        params['geometry'] = shift_to_lv95(params['geometry'])
        params['mapExtent'] = shift_to_lv95(params['mapExtent'])
        resp_2 = self.testapp.get('/rest/services/ech/MapServer/identify', params=params, headers=accept_headers, status=200)
        self.assertNotEqual(len(resp_2.json['results']), 0)
        self.assertGeojsonFeature(resp_2.json['results'][0], 2056)

        self.assertEqual(resp_1.json['results'][0]['id'], resp_2.json['results'][0]['id'])
Esempio n. 17
0
 def test_search_locations_bbox_only(self):
     params = {
         'type': 'locations',
         'bbox': '664126,268543,664126,268543'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertGreater(len(resp.json['results']), 1)
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params['sr'] = '2056'
     params['bbox'] = shift_to_lv95(params['bbox'])
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertGreater(len(resp.json['results']), 1)
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 2056, spatialOrder=True)
Esempio n. 18
0
    def test_cut_no_group_geom_only_lv95(self):
        params = {'geometryType': 'esriGeometryEnvelope',
                  'geometry': shift_to_lv95('545000,145000,555000,170005'),
                  'layers': 'all:ch.swisstopo.images-swissimage.metadata',
                  'sr': '2056'}
        resp = self.testapp.get('/rest/services/ech/GeometryServer/cut', params=params, status=200)
        result = resp.json['ch.swisstopo.images-swissimage.metadata'][0]
        self.assertIn('ch.swisstopo.images-swissimage.metadata', resp.json)
        self.assertIn('area', result)
        self.assertGreater(result['area'], 0)
        self.assertIn('groupby', result)
        self.assertIn('groupbyvalue', result)

        params = {'geometryType': 'esriGeometryEnvelope',
                  'geometry': shift_to_lv95('545000,145000,555000,170005'),
                  'layers': 'all:ch.swisstopo.pixelkarte-farbe-pk50.noscale',
                  'sr': '2056'}
        resp = self.testapp.get('/rest/services/ech/GeometryServer/cut', params=params, status=200)
        result = resp.json['ch.swisstopo.pixelkarte-farbe-pk50.noscale'][0]
        self.assertIn('ch.swisstopo.pixelkarte-farbe-pk50.noscale', resp.json)
        self.assertIn('area', result)
        self.assertGreater(result['area'], 0)
        self.assertIn('groupby', result)
        self.assertIn('groupbyvalue', result)
Esempio n. 19
0
 def test_search_features_identify(self):
     params = {
         'type': 'featuresearch',
         'searchText': 'vd 446',
         'bbox': '551306.5625,167918.328125,551754.125,168514.625',
         'features': 'ch.astra.ivs-reg_loc'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertAttrs('featuresearch', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params['sr'] = '2056'
     params['bbox'] = shift_to_lv95(params['bbox'])
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertAttrs('featuresearch', resp.json['results'][0]['attrs'], 2056, spatialOrder=True)
Esempio n. 20
0
    def test_cut_no_group_geom_only_lv95(self):
        params = {'geometryType': 'esriGeometryEnvelope',
                  'geometry': shift_to_lv95('545000,145000,555000,170005'),
                  'layers': 'all:ch.swisstopo.images-swissimage.metadata',
                  'sr': '2056'}
        resp = self.testapp.get('/rest/services/ech/GeometryServer/cut', params=params, status=200)
        result = resp.json['ch.swisstopo.images-swissimage.metadata'][0]
        self.assertIn('ch.swisstopo.images-swissimage.metadata', resp.json)
        self.assertIn('area', result)
        self.assertGreater(result['area'], 0)
        self.assertIn('groupby', result)
        self.assertIn('groupbyvalue', result)

        params = {'geometryType': 'esriGeometryEnvelope',
                  'geometry': shift_to_lv95('545000,145000,555000,170005'),
                  'layers': 'all:ch.swisstopo.pixelkarte-farbe-pk50.noscale',
                  'sr': '2056'}
        resp = self.testapp.get('/rest/services/ech/GeometryServer/cut', params=params, status=200)
        result = resp.json['ch.swisstopo.pixelkarte-farbe-pk50.noscale'][0]
        self.assertIn('ch.swisstopo.pixelkarte-farbe-pk50.noscale', resp.json)
        self.assertIn('area', result)
        self.assertGreater(result['area'], 0)
        self.assertIn('groupby', result)
        self.assertIn('groupbyvalue', result)
Esempio n. 21
0
 def test_search_features_identify(self):
     params = {
         'type': 'featuresearch',
         'searchText': 'vd 446',
         'bbox': '551306.5625,167918.328125,551754.125,168514.625',
         'features': 'ch.astra.ivs-reg_loc'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertAttrs('featuresearch', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params['sr'] = '2056'
     params['bbox'] = shift_to_lv95(params['bbox'])
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertAttrs('featuresearch', resp.json['results'][0]['attrs'], 2056, spatialOrder=True)
Esempio n. 22
0
 def test_search_locations_bbox_only(self):
     params = {
         'type': 'locations',
         'bbox': '664126,268543,664126,268543'
     }
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertGreater(len(resp.json['results']), 1)
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params['sr'] = '2056'
     params['bbox'] = shift_to_lv95(params['bbox'])
     resp = self.testapp.get('/rest/services/inspire/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertGreater(len(resp.json['results']), 1)
     self.assertAttrs('locations', resp.json['results'][0]['attrs'], 2056, spatialOrder=True)
Esempio n. 23
0
 def test_features_timeinstant(self):
     params = {
         'type': 'featuresearch',
         'searchText': '19810590048970',
         'features': 'ch.swisstopo.lubis-luftbilder_farbe',
         'bbox': '542199,206799,642201,226801',
         'timeInstant': '1981'
     }
     resp = self.testapp.get('/rest/services/ech/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertEqual(resp.json['results'][0]['attrs']['origin'], 'feature')
     self.assertAttrs('featuresearch', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params['sr'] = '2056'
     params['bbox'] = shift_to_lv95(params['bbox'])
     resp = self.testapp.get('/rest/services/ech/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertEqual(resp.json['results'][0]['attrs']['origin'], 'feature')
     self.assertAttrs('featuresearch', resp.json['results'][0]['attrs'], 2056, spatialOrder=True)
Esempio n. 24
0
 def test_features_timeinstant(self):
     params = {
         'type': 'featuresearch',
         'searchText': '19810590048970',
         'features': 'ch.swisstopo.lubis-luftbilder_farbe',
         'bbox': '542199,206799,642201,226801',
         'timeInstant': '1981'
     }
     resp = self.testapp.get('/rest/services/ech/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertEqual(resp.json['results'][0]['attrs']['origin'], 'feature')
     self.assertAttrs('featuresearch', resp.json['results'][0]['attrs'], 21781, spatialOrder=True)
     params['sr'] = '2056'
     params['bbox'] = shift_to_lv95(params['bbox'])
     resp = self.testapp.get('/rest/services/ech/SearchServer', params=params, status=200)
     self.assertEqual(resp.content_type, 'application/json')
     self.assertEqual(resp.json['results'][0]['attrs']['origin'], 'feature')
     self.assertAttrs('featuresearch', resp.json['results'][0]['attrs'], 2056, spatialOrder=True)