diff --git a/django_project/cplus_api/tasks/sync_default_layers.py b/django_project/cplus_api/tasks/sync_default_layers.py index 6c7ccb8..14f10c3 100644 --- a/django_project/cplus_api/tasks/sync_default_layers.py +++ b/django_project/cplus_api/tasks/sync_default_layers.py @@ -83,12 +83,16 @@ def read_metadata( res_y = abs(transform[4]) crs = dataset.crs nodata = dataset.nodata + unit = dataset.crs.units_factor[0] + unit = "m" if unit == "metre" else unit metadata = { "is_raster": get_layer_type(self.file['Key']) == 0, "crs": str(crs), "resolution": [res_x, res_y], - "no_data": nodata + "unit": unit, + "nodata_value": nodata, + "is_geographic": dataset.crs.is_geographic } if not self.input_layer.name: self.input_layer.name = os.path.basename(self.file['Key']) diff --git a/django_project/cplus_api/tests/test_sync_default_layers.py b/django_project/cplus_api/tests/test_sync_default_layers.py index 349fbbc..14995df 100644 --- a/django_project/cplus_api/tests/test_sync_default_layers.py +++ b/django_project/cplus_api/tests/test_sync_default_layers.py @@ -45,9 +45,11 @@ def base_run(self): self.assertTrue(input_layers.exists()) metadata = { 'crs': 'EPSG:32735', - 'no_data': -9999.0, + 'nodata_value': -9999.0, 'is_raster': True, 'resolution': [19.676449999999022, 19.676448888890445], + 'is_geographic': False, + 'unit': 'm' } self.assertEqual(input_layer.name, 'test_pathway_2.tif') self.assertEqual(input_layer.description, 'test_pathway_2.tif')