def test_datasets_locations_dataset(self): dataset = Dataset.objects.get(title_en="theaters_nyc") locations, bbox = thumbnails._datasets_locations(dataset) self.assertFalse(bbox, "Expected BBOX not to be calculated") self.assertEqual(locations, [[settings.OGC_SERVER["default"]["LOCATION"], [dataset.alternate], []]])
def test_datasets_locations_composition_map_default_bbox(self): expected_bbox = [ -18411664.521739896, 1414810.0631394347, -20040289.59992574, 16329038.485056708, 'EPSG:3857' ] expected_locations = [[ settings.GEOSERVER_LOCATION, [ 'geonode:theaters_nyc', 'geonode:Meteorite_Landings_from_NASA_Open_Data_Portal1', 'rt_geologia.dbg_risorse_minerarie' ], [] ]] map = Map.objects.get(title_en="composition_map") locations, bbox = thumbnails._datasets_locations(map, compute_bbox=True) self.assertEqual(bbox[-1].upper(), "EPSG:3857", "Expected calculated BBOX CRS to be EPSG:3857") self.assertEqual( bbox, expected_bbox, "Expected calculated BBOX to match pre-converted one.") self.assertEqual( locations, expected_locations, "Expected calculated locations to match pre-computed.")
def test_datasets_locations_dataset_bbox(self): dataset = Dataset.objects.get(title_en="theaters_nyc") locations, bbox = thumbnails._datasets_locations(dataset, compute_bbox=True, target_crs="EPSG:4326") self.assertEqual(bbox[0:4], dataset.bbox[0:4], "Expected calculated BBOX to match dataset's") self.assertEqual(bbox[-1].lower(), dataset.bbox[-1].lower(), "Expected calculated BBOX's CRS to match dataset's") self.assertEqual(locations, [[settings.OGC_SERVER["default"]["LOCATION"], [dataset.alternate], []]])
def test_datasets_locations_dataset_default_bbox(self): expected_bbox = [-8238681.428369759, -8220320.787127878, 4969844.155936863, 4984363.9488296695, "epsg:3857"] dataset = Dataset.objects.get(title_en="theaters_nyc") locations, bbox = thumbnails._datasets_locations(dataset, compute_bbox=True) self.assertEqual(bbox[-1].upper(), "EPSG:3857", "Expected calculated BBOX CRS to be EPSG:3857") self.assertEqual(bbox, expected_bbox, "Expected calculated BBOX to match pre-converted one.") self.assertEqual(locations, [[settings.OGC_SERVER["default"]["LOCATION"], [dataset.alternate], []]])
def test_datasets_locations_dataset_default_bbox(self): expected_bbox = [-8238681.374829309, -8220320.783295829, 4969844.093033709, 4984363.884452854, "EPSG:3857"] dataset = Dataset.objects.get(title_en="theaters_nyc") locations, bbox = thumbnails._datasets_locations(dataset, compute_bbox=True) self.assertEqual(bbox[-1].upper(), "EPSG:3857", "Expected calculated BBOX CRS to be EPSG:3857") self.assertEqual(bbox, expected_bbox, "Expected calculated BBOX to match pre-converted one.") self.assertEqual(locations, [[settings.OGC_SERVER["default"]["LOCATION"], [dataset.alternate], []]])
def test_datasets_locations_simple_map(self): dataset = Dataset.objects.get(title_en="theaters_nyc") map = Map.objects.get(title_en="theaters_nyc_map") MapLayer( map=map, name="Meteorite_Landings_from_NASA_Open_Data_Portal1", current_style="test_style", ows_url="https://maps.geo-solutions.it/geoserver/wms", ).save() locations, bbox = thumbnails._datasets_locations(map) self.assertFalse(bbox, "Expected BBOX not to be calculated") self.assertEqual(locations, [[settings.OGC_SERVER["default"]["LOCATION"], ["geonode:Meteorite_Landings_from_NASA_Open_Data_Portal1", dataset.alternate], ["test_style", "theaters_nyc"]]])
def test_datasets_locations_simple_map(self): dataset = Dataset.objects.get(title_en="theaters_nyc") map = Map.objects.get(title_en="theaters_nyc_map") MapLayer( map=map, name="Meteorite_Landings_from_NASA_Open_Data_Portal1", stack_order=1, visibility=True, ows_url="https://maps.geo-solutions.it/geoserver/wms", dataset_params="""{\"id\": 1, \"title\": \"Open Street Map\", \"style\": \"test_style\", \"type\": \"osm\", \"singleTile\": false, \"dimensions\": [], \"hideLoading\": false, \"handleClickOnLayer\": false, \"useForElevation\": false, \"hidden\": false, \"extraParams\": {\"msId\": \"mapnik__0\"}, \"wrapDateLine\": true, \"displayOutsideMaxExtent\": true}""" ).save() locations, bbox = thumbnails._datasets_locations(map) self.assertFalse(bbox, "Expected BBOX not to be calculated") self.assertEqual(locations, [[settings.OGC_SERVER["default"]["LOCATION"], ["geonode:Meteorite_Landings_from_NASA_Open_Data_Portal1", dataset.alternate], ["test_style", "theaters_nyc"]]])
def test_datasets_locations_composition_map_default_bbox(self): expected_locations = [ [ settings.GEOSERVER_LOCATION, [ 'rt_geologia.dbg_risorse_minerarie', 'geonode:Meteorite_Landings_from_NASA_Open_Data_Portal1', 'geonode:theaters_nyc', ], [] ] ] map = Map.objects.get(title_en="composition_map") locations, bbox = thumbnails._datasets_locations(map, compute_bbox=True) self.assertEqual(bbox[-1].upper(), "EPSG:3857", "Expected calculated BBOX CRS to be EPSG:3857") self.assertEqual(locations, expected_locations, "Expected calculated locations to match pre-computed.")