From bafcd058b5331842a53633cc53c0e5af19de75e1 Mon Sep 17 00:00:00 2001 From: rot1024 Date: Fri, 15 Mar 2024 16:33:43 +0900 Subject: [PATCH] feat(server): support _dm_geometric_attributes in datacatalogv3 --- server/datacatalog/datacatalogv3/consts.go | 5 +++-- .../datacatalog/datacatalogv3/conv_asset.go | 11 ++++++++-- .../datacatalogv3/conv_asset_test.go | 20 +++++++++++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/server/datacatalog/datacatalogv3/consts.go b/server/datacatalog/datacatalogv3/consts.go index f1ffff958..f84e9904d 100644 --- a/server/datacatalog/datacatalogv3/consts.go +++ b/server/datacatalog/datacatalogv3/consts.go @@ -123,8 +123,9 @@ var plateauFeatureTypes = []FeatureType{ MVTLayerName: []string{"OtherConstruction"}, }, { - Code: "frn", - Name: "都市設備モデル", + Code: "frn", + Name: "都市設備モデル", + MVTLayerName: []string{"CityFurniture"}, }, { Code: "unf", diff --git a/server/datacatalog/datacatalogv3/conv_asset.go b/server/datacatalog/datacatalogv3/conv_asset.go index 287bc7b05..b328aca22 100644 --- a/server/datacatalog/datacatalogv3/conv_asset.go +++ b/server/datacatalog/datacatalogv3/conv_asset.go @@ -4,6 +4,7 @@ import ( "fmt" "regexp" "strconv" + "strings" "github.com/samber/lo" ) @@ -192,6 +193,7 @@ func ParseAssetNameEx(name string) (ex AssetNameEx) { } var reAasetNameExNormal = regexp.MustCompile(`^([a-z]+)_(mvt|3dtiles)(?:_(\d+)_([a-z0-9-]+))?(_lod\d+)?(_no_texture)?$`) +var reAasetNameExNormalDM = regexp.MustCompile(`^([a-z]+)_dm_geometric_attributes$`) func ParseAssetNameExNormal(name string) *AssetNameExNormal { if name == "" { @@ -200,12 +202,17 @@ func ParseAssetNameExNormal(name string) *AssetNameExNormal { m := reAasetNameExNormal.FindStringSubmatch(name) if len(m) == 0 { - return nil + m = reAasetNameExNormalDM.FindStringSubmatch(name) + if len(m) == 0 { + return nil + } + + m = []string{m[0], m[1], "mvt", "", "", "0", ""} } lod := 0 if m[5] != "" { - lod, _ = strconv.Atoi(m[5][4:]) + lod, _ = strconv.Atoi(strings.TrimPrefix(m[5], "_lod")) } return &AssetNameExNormal{ diff --git a/server/datacatalog/datacatalogv3/conv_asset_test.go b/server/datacatalog/datacatalogv3/conv_asset_test.go index 94ac765da..dc2e0aff5 100644 --- a/server/datacatalog/datacatalogv3/conv_asset_test.go +++ b/server/datacatalog/datacatalogv3/conv_asset_test.go @@ -296,6 +296,26 @@ func TestParseAssetName(t *testing.T) { }, }, }, + { + name: "frn dm_geometric_attributes", + args: "15202_nagaoka-shi_city_2023_citygml_1_op_frn_dm_geometric_attributes", + want: &AssetName{ + CityCode: "15202", + CityName: "nagaoka-shi", + Provider: "city", + Year: 2023, + Format: "citygml", + UpdateCount: 1, + Ex: AssetNameEx{ + Normal: &AssetNameExNormal{ + Type: "frn", + Format: "mvt", + LOD: 0, + }, + Ex: "frn_dm_geometric_attributes", + }, + }, + }, { name: "veg", args: "11111_bar-shi_city_2023_citygml_1_op_veg_PlantCover_3dtiles_lod3",