Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
feat(server): support _dm_geometric_attributes in datacatalogv3
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Mar 15, 2024
1 parent 91f2dcd commit bafcd05
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
5 changes: 3 additions & 2 deletions server/datacatalog/datacatalogv3/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ var plateauFeatureTypes = []FeatureType{
MVTLayerName: []string{"OtherConstruction"},
},
{
Code: "frn",
Name: "都市設備モデル",
Code: "frn",
Name: "都市設備モデル",
MVTLayerName: []string{"CityFurniture"},
},
{
Code: "unf",
Expand Down
11 changes: 9 additions & 2 deletions server/datacatalog/datacatalogv3/conv_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"regexp"
"strconv"
"strings"

"github.com/samber/lo"
)
Expand Down Expand Up @@ -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 == "" {
Expand All @@ -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{
Expand Down
20 changes: 20 additions & 0 deletions server/datacatalog/datacatalogv3/conv_asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit bafcd05

Please sign in to comment.