Skip to content

Commit

Permalink
feature: minor improvements to udata json
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Jun 4, 2024
1 parent 3fef6ac commit dfa662e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions dicogis/export/to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def as_udata(self, metadataset: MetaDataset) -> dict:
"tags": [
metadataset.format_gdal_long_name,
metadataset.format_gdal_short_name,
metadataset.crs_name,
],
}

Expand Down
18 changes: 12 additions & 6 deletions dicogis/models/metadataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def as_markdown_description(self) -> str:
or self.crs_type
):
description += (
f"- Spatial Reference System: {self.crs_name} {self.crs_type}"
f"- Spatial Reference System: {self.crs_name} {self.crs_type}\n"
)
if self.crs_registry_code:
description += f"{self.crs_registry}:{self.crs_registry_code}\n"
Expand Down Expand Up @@ -150,12 +150,18 @@ def slug(self) -> str:
Returns:
slugified metadataset name and other attributes
"""
to_slug = f"{self.name}"
to_slug = ""

if isinstance(self, MetaDatabaseTable):
to_slug += f" {self.schema_name}.{self.database_connection.database_name} "
if self.database_connection.database_name:
to_slug += f" {self.database_connection.database_name} "
elif self.database_connection.service_name:
to_slug += f" {self.database_connection.service_name} "
to_slug += f" {self.schema_name} "
elif isinstance(self, (MetaVectorDataset, MetaRasterDataset)):
to_slug += f"{self.parent_folder_name}"
to_slug += f" {self.parent_folder_name} "

to_slug += f" {self.name}"

return sluggy(to_slug)

Expand Down Expand Up @@ -191,7 +197,7 @@ def as_markdown_feature_attributes(self) -> str:
if self.feature_attributes is None:
return ""

out_markdown = "| name | type | length | precision |\n"
out_markdown = "\n| name | type | length | precision |\n"
out_markdown += "| :---- | :-: | :----: | :-------: |\n"
for feature_attribute in self.feature_attributes:
out_markdown += (
Expand Down Expand Up @@ -278,7 +284,7 @@ def as_markdown_image_metadata(self) -> str:
Returns:
string containing markdown table
"""
out_markdown = "| Key | value |\n"
out_markdown = "\n| Key | value |\n"
out_markdown += "| :---- | :-: |\n"
out_markdown += f"| Bands count | {self.bands_count}\n"
out_markdown += f"| Columns count | {self.columns_count}\n"
Expand Down

0 comments on commit dfa662e

Please sign in to comment.