plateauv2

package
v0.0.0-...-e9a8072 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FeatureOptions = map[string]DataCatalogItemBuilderOption{
	"bldg": {
		Type:               "建築物モデル",
		TypeEn:             "bldg",
		LOD:                true,
		SortByLOD:          true,
		UseMaxLODAsDefault: true,
		ItemID:             true,
		GroupBy: func(an AssetName, assets []AssetName) string {
			return an.WardEn
		},
		SortGroupBy: func(a, b AssetName) bool {
			return a.WardCodeInt() < b.WardCodeInt()
		},
		OmitGroupNameFromID: true,
		SearchIndex:         true,
	},
	"tran": {
		Type:               "道路モデル",
		TypeEn:             "tran",
		LOD:                true,
		SortByLOD:          true,
		UseMaxLODAsDefault: true,
		Group: func(ctx ItemContext) Override {
			return Override{
				Layers: tranLayersForLOD[ctx.AssetName.LOD],
			}
		},
		Item: func(ctx ItemContext) ItemOverride {
			return ItemOverride{
				Layers: tranLayersForLOD[ctx.AssetName.LOD],
			}
		},
	},
	"frn": {
		Type:      "都市設備モデル",
		TypeEn:    "frn",
		LOD:       true,
		SortByLOD: true,
	},
	"veg": {
		Type:      "植生モデル",
		TypeEn:    "veg",
		LOD:       true,
		SortByLOD: true,
	},
	"luse": {
		Type:   "土地利用モデル",
		TypeEn: "luse",
		Layers: []string{"luse"},
	},
	"lsld": {
		Type:   "土砂災害警戒区域モデル",
		TypeEn: "lsld",
		Layers: []string{"lsld"},
	},
	"urf": {
		Type:     "都市計画決定情報モデル",
		TypeEn:   "urf",
		RootType: true,
		Group: func(ctx ItemContext) Override {
			var name, t2 string
			ft := normalizeUrfFeatureType(ctx.AssetName.UrfFeatureType)
			if urfName := datacatalogcommon.UrfFeatureTypeMap[ft]; urfName != "" {
				name = fmt.Sprintf("%sモデル", urfName)
				t2 = urfName
			} else {
				name = ft
				t2 = ft
			}
			return Override{
				Name:    name,
				Type2:   t2,
				Type2En: ft,
				Layers:  []string{ctx.GroupName},
			}
		},
		MultipleDesc: true,
		GroupBy: func(an AssetName, assets []AssetName) string {
			return normalizeUrfFeatureType(an.UrfFeatureType)
		},
		SortGroupBy: func(c, d AssetName) bool {
			i1 := slices.Index(datacatalogcommon.UrfFeatureTypes, normalizeUrfFeatureType(c.UrfFeatureType))
			if i1 < 0 {
				i1 = len(datacatalogcommon.UrfFeatureTypes)
			}
			i2 := slices.Index(datacatalogcommon.UrfFeatureTypes, normalizeUrfFeatureType(d.UrfFeatureType))
			if i2 < 0 {
				i2 = len(datacatalogcommon.UrfFeatureTypes)
			}
			return i1 < i2
		},
	},
	"fld": {
		Type:     "洪水浸水想定区域モデル",
		TypeEn:   "fld",
		RootType: true,
		Group: func(ctx ItemContext) Override {
			subname := ""
			if ctx.DicEntry != nil {
				subname = fmt.Sprintf("%s(%s管理区間)", ctx.DicEntry.Description, ctx.DicEntry.Admin)
			} else {
				subname = ctx.AssetName.FldAdminAndName()
			}
			return Override{
				SubName: subname,
			}
		},
		Item: func(ctx ItemContext) ItemOverride {
			name := ctx.AssetName.FldScale
			if ctx.DicEntry != nil {
				name = ctx.DicEntry.Scale
			}

			return ItemOverride{
				Name: name,
			}
		},
		MultipleDesc: true,
		GroupBy: func(an AssetName, assets []AssetName) string {
			l := "l1"
			a := lo.Filter(assets, func(a AssetName, _ int) bool {
				return a.FldName == an.FldName && a.FldAdmin == an.FldAdmin
			})
			sort.SliceStable(a, func(i, j int) bool {
				return a[i].FldScale < a[j].FldScale
			})
			if len(a) > 0 {
				l = a[0].FldScale
			}

			return fmt.Sprintf("%s_%s", an.FldAdminAndName(), l)
		},
		SortGroupBy: func(a, b AssetName) bool {
			return a.FldAdminAndName() < b.FldAdminAndName()
		},
		SortAssetBy: func(a, b AssetName) bool {
			return a.FldScale < b.FldScale
		},
	},
	"tnm": {
		Type:     "津波浸水想定区域モデル",
		TypeEn:   "tnm",
		RootType: true,
		Group: func(ctx ItemContext) Override {
			subname := ctx.AssetName.FldName
			if ctx.DicEntry != nil {
				subname = ctx.DicEntry.Description
			}
			return Override{
				SubName: subname,
			}
		},
		MultipleDesc: true,
		GroupBy: func(an AssetName, assets []AssetName) string {
			return an.FldName
		},
	},
	"htd": {
		Type:     "高潮浸水想定区域モデル",
		TypeEn:   "htd",
		RootType: true,
		Group: func(ctx ItemContext) Override {
			subname := ctx.AssetName.FldName
			if ctx.DicEntry != nil {
				subname = ctx.DicEntry.Description
			}
			return Override{
				SubName: subname,
			}
		},
		MultipleDesc: true,
		GroupBy: func(an AssetName, assets []AssetName) string {
			return an.FldName
		},
	},
	"ifld": {
		Type:     "内水浸水想定区域モデル",
		TypeEn:   "ifld",
		RootType: true,
		Group: func(ctx ItemContext) Override {
			subname := ctx.AssetName.FldName
			if ctx.DicEntry != nil {
				subname = ctx.DicEntry.Description
			}
			return Override{
				SubName: subname,
			}
		},
		MultipleDesc: true,
		GroupBy: func(an AssetName, assets []AssetName) string {
			return an.FldName
		},
	},
	"brid": {
		Type:      "橋梁モデル",
		TypeEn:    "brid",
		Layers:    []string{"brid"},
		LOD:       true,
		SortByLOD: true,
	},
	"rail": {
		Type:      "鉄道モデル",
		TypeEn:    "rail",
		Layers:    []string{"rail"},
		LOD:       true,
		SortByLOD: true,
	},
	"gen": {
		Type:         "汎用都市オブジェクトモデル",
		TypeEn:       "gen",
		RootType:     true,
		MultipleDesc: true,
		LOD:          true,
		SortByLOD:    true,
		Group: func(ctx ItemContext) Override {
			return Override{
				Name:   ctx.GroupName,
				Layers: []string{ctx.GroupName},
			}
		},
		Item: func(ctx ItemContext) ItemOverride {
			name := ctx.Description.Override.Name
			if name == "" {
				name = ctx.GroupName
			}
			return ItemOverride{
				Name:   name,
				Layers: []string{ctx.GroupName},
			}
		},
		GroupBy: func(n AssetName, assets []AssetName) string {
			return n.GenName
		},
	},
	"extra": {
		Type:         "その他のデータセット",
		TypeEn:       "ex",
		MultipleDesc: true,
		LOD:          true,
		SortByLOD:    false,
		GroupBy: func(n AssetName, assets []AssetName) string {
			return strings.Join(n.FeatureEx, "-")
		},
	},
}
View Source
var FeatureTypes = []string{
	"bldg",
	"tran",
	"frn",
	"veg",
	"luse",
	"lsld",
	"urf",
	"fld",
	"tnm",
	"htd",
	"ifld",
	"brid",
	"rail",
	"gen",
	"extra",
}

Functions

This section is empty.

Types

type AssetName

type AssetName struct {
	CityCode       string
	CityEn         string
	Year           string
	Format         string
	Op             string
	NoDEM          bool
	Feature        string
	FeatureEx      []string
	Ex             string
	Ext            string
	WardCode       string
	WardEn         string
	LOD            string
	LowTexture     bool
	NoTexture      bool
	FldAdmin       string
	FldName        string
	FldScale       string
	UrfFeatureType string
	GenName        string
}

func AssetNameFrom

func AssetNameFrom(name string) (a AssetName)

func (AssetName) CityOrWardCode

func (a AssetName) CityOrWardCode() string

func (AssetName) FldAdminAndName

func (an AssetName) FldAdminAndName() string

func (AssetName) FldFullName

func (an AssetName) FldFullName() string

func (AssetName) FldNameAndScale

func (an AssetName) FldNameAndScale() string

func (AssetName) IsWard

func (a AssetName) IsWard() bool

func (AssetName) LODInt

func (an AssetName) LODInt() int

func (AssetName) String

func (a AssetName) String() string

func (AssetName) WardCodeInt

func (an AssetName) WardCodeInt() int

type CMSItem

type CMSItem struct {
	ID               string             `json:"id"`
	Prefecture       string             `json:"prefecture"`
	CityName         string             `json:"city_name"`
	Specification    string             `json:"specification"`
	CityGML          *cms.PublicAsset   `json:"citygml"`
	DescriptionBldg  string             `json:"description_bldg"`
	DescriptionTran  string             `json:"description_tran"`
	DescriptionFrn   string             `json:"description_frn"`
	DescriptionVeg   string             `json:"description_veg"`
	DescriptionLuse  string             `json:"description_luse"`
	DescriptionLsld  string             `json:"description_lsld"`
	DescriptionUrf   []string           `json:"description_urf"`
	DescriptionFld   []string           `json:"description_fld"`
	DescriptionHtd   []string           `json:"description_htd"`
	DescriptionIfld  []string           `json:"description_ifld"`
	DescriptionTnm   []string           `json:"description_tnm"`
	DescriptionBrid  string             `json:"description_brid"`
	DescriptionRail  string             `json:"description_rail"`
	DescriptionGen   []string           `json:"description_gen"`
	DescriptionExtra []string           `json:"description_extra"`
	Bldg             []*cms.PublicAsset `json:"bldg"`
	Tran             []*cms.PublicAsset `json:"tran"`
	Frn              []*cms.PublicAsset `json:"frn"`
	Veg              []*cms.PublicAsset `json:"veg"`
	Luse             []*cms.PublicAsset `json:"luse"`
	Lsld             []*cms.PublicAsset `json:"lsld"`
	Urf              []*cms.PublicAsset `json:"urf"`
	Fld              []*cms.PublicAsset `json:"fld"`
	Htd              []*cms.PublicAsset `json:"htd"`
	Ifld             []*cms.PublicAsset `json:"ifld"`
	Tnm              []*cms.PublicAsset `json:"tnm"`
	Brid             []*cms.PublicAsset `json:"brid"`
	Rail             []*cms.PublicAsset `json:"rail"`
	Gen              []*cms.PublicAsset `json:"gen"`
	Extra            []*cms.PublicAsset `json:"extra"`
	Dictionary       *cms.PublicAsset   `json:"dictionary"`
	Dic              string             `json:"dic"`
	Dem              string             `json:"dem"`
	SearchIndex      []*cms.PublicAsset `json:"search_index"`
	OpenDataURL      string             `json:"opendata_url"`
	MaxLOD           *cms.PublicAsset   `json:"max_lod"`
	SDKPublication   string             `json:"sdk_publication"`
}

func (CMSItem) AllDataCatalogItems

func (i CMSItem) AllDataCatalogItems(c PlateauIntermediateItem) []DataCatalogItem

func (CMSItem) DataCatalogItems

func (i CMSItem) DataCatalogItems(c PlateauIntermediateItem, ty string) []*DataCatalogItem

func (CMSItem) Feature

func (i CMSItem) Feature(ty string) []*cms.PublicAsset

func (CMSItem) FeatureDescription

func (i CMSItem) FeatureDescription(ty string) []string

func (CMSItem) FeatureTypes

func (i CMSItem) FeatureTypes() []string

func (CMSItem) IntermediateItem

func (i CMSItem) IntermediateItem() PlateauIntermediateItem

func (CMSItem) IsSDKPublic

func (i CMSItem) IsSDKPublic() bool

type DataCatalogItem

type DataCatalogItem struct {
	ID             string                                 `json:"id,omitempty"`
	ItemID         string                                 `json:"itemId,omitempty"`
	Name           string                                 `json:"name,omitempty"`
	Pref           string                                 `json:"pref,omitempty"`
	PrefCode       string                                 `json:"pref_code,omitempty"`
	City           string                                 `json:"city,omitempty"`
	CityEn         string                                 `json:"city_en,omitempty"`
	CityCode       string                                 `json:"city_code,omitempty"`
	Ward           string                                 `json:"ward,omitempty"`
	WardEn         string                                 `json:"ward_en,omitempty"`
	WardCode       string                                 `json:"ward_code,omitempty"`
	Type           string                                 `json:"type,omitempty"`
	Type2          string                                 `json:"type2,omitempty"`
	TypeEn         string                                 `json:"type_en,omitempty"`
	Type2En        string                                 `json:"type2_en,omitempty"`
	Format         string                                 `json:"format,omitempty"`
	Layers         []string                               `json:"layers,omitempty"`
	URL            string                                 `json:"url,omitempty"`
	Description    string                                 `json:"desc,omitempty"`
	SearchIndex    string                                 `json:"search_index,omitempty"`
	Year           int                                    `json:"year,omitempty"`
	PRCS           cmsintegrationcommon.PRCS              `json:"prcs,omitempty"`
	OpenDataURL    string                                 `json:"openDataUrl,omitempty"`
	Config         *datacatalogutil.DataCatalogItemConfig `json:"config,omitempty"`
	Order          *int                                   `json:"order,omitempty"`
	OriginalURL    string                                 `json:"original_url,omitempty"`
	OriginalFormat string                                 `json:"original_format,omitempty"`
	// force not creating a type folder
	Root bool `json:"root,omitempty"`
	// force creating a type folder on root
	RootType bool   `json:"root_type,omitempty"`
	Group    string `json:"group,omitempty"`
	Infobox  bool   `json:"infobox,omitempty"`
	// alias of type that is used as a folder name
	Category string `json:"category,omitempty"`
	// internal
	Spec                string   `json:"-"`
	Family              string   `json:"-"`
	Edition             string   `json:"-"`
	CityGMLURL          string   `json:"-"`
	CityGMLAssetID      string   `json:"-"`
	CityGMLFeatureTypes []string `json:"-"`
	MaxLODURL           string   `json:"-"`
	SDKPublic           bool     `json:"-"`
}

type DataCatalogItemBuilder

type DataCatalogItemBuilder struct {
	Assets           []*cms.PublicAsset
	SearchIndex      []*cms.PublicAsset
	Descriptions     []string
	IntermediateItem PlateauIntermediateItem
	Options          DataCatalogItemBuilderOption
}

func (DataCatalogItemBuilder) Build

type DataCatalogItemBuilderOption

type DataCatalogItemBuilderOption struct {
	Type                string
	TypeEn              string
	RootType            bool
	Layers              []string
	Group               func(ItemContext) Override
	Item                func(ItemContext) ItemOverride
	MultipleDesc        bool
	ItemID              bool
	LOD                 bool
	SortByLOD           bool
	UseMaxLODAsDefault  bool
	GroupBy             func(AssetName, []AssetName) string
	SortGroupBy         func(AssetName, AssetName) bool
	SortAssetBy         func(AssetName, AssetName) bool
	OmitGroupNameFromID bool
	SearchIndex         bool
}

type DatasetItem

type DatasetItem struct {
	ID           string             `json:"id,omitempty"`
	Name         string             `json:"name,omitempty"`
	Type         string             `json:"type,omitempty"`
	Prefecture   string             `json:"prefecture,omitempty"`
	CityName     string             `json:"city_name,omitempty"`
	WardName     string             `json:"ward_name,omitempty"`
	OpenDataURL  string             `json:"opendata_url,omitempty"`
	Description  string             `json:"description,omitempty"`
	Year         string             `json:"year,omitempty"`
	Data         *cms.PublicAsset   `json:"data,omitempty"`
	DataFormat   string             `json:"data_format,omitempty"`
	DataURL      string             `json:"data_url,omitempty"`
	DataLayers   string             `json:"data_layer,omitempty"`
	Config       string             `json:"config,omitempty"`
	Order        *int               `json:"order,omitempty"`
	OriginalData []*cms.PublicAsset `json:"data_orig,omitempty"`
}

func (DatasetItem) DataCatalogs

func (i DatasetItem) DataCatalogs() []DataCatalogItem

func (DatasetItem) GetCityName

func (i DatasetItem) GetCityName() string

type Description

type Description struct {
	Desc     string
	Override Override
}

func DescriptionFrom

func DescriptionFrom(d string) Description

type Dic

type Dic map[string][]DicEntry

func (Dic) FindByAsset

func (d Dic) FindByAsset(an AssetName) *DicEntry

func (Dic) WardName

func (d Dic) WardName(code string) string

type DicEntry

type DicEntry struct {
	Code        string `json:"code"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Admin       string `json:"admin"`
	Scale       string `json:"scale"`
}

type ItemContext

type ItemContext struct {
	AssetName   AssetName
	Description Description
	DicEntry    *DicEntry
	GroupName   string
	Index       int
	AssetLen    int
}

type ItemOverride

type ItemOverride struct {
	Name   string
	Layers []string
	Order  int
}

func (ItemOverride) LayersIfSupported

func (o ItemOverride) LayersIfSupported(ty string) []string

func (ItemOverride) Merge

type Override

type Override struct {
	Name         string   `mapstructure:"name"`
	SubName      string   `mapstructure:"subname"`
	Type         string   `mapstructure:"type"`
	TypeEn       string   `mapstructure:"type_en"`
	Type2        string   `mapstructure:"type2"`
	Type2En      string   `mapstructure:"type2_en"`
	Area         string   `mapstructure:"area"`
	ItemName     string   `mapstructure:"item_name"`
	Group        string   `mapstructure:"group"`
	Layer        string   `mapstructure:"layer"`
	Layers       []string `mapstructure:"-"`
	Root         bool     `mapstructure:"root"`
	Order        *int     `mapstructure:"order"`
	DatasetOrder *int     `mapstructure:"dataset_order"`
}

func OverrideFromTags

func OverrideFromTags(tags map[string]string) (o Override)

func (Override) Item

func (o Override) Item() ItemOverride

func (Override) LayersIfSupported

func (o Override) LayersIfSupported(ty string) []string

func (Override) Merge

func (o Override) Merge(p Override) Override

type PlateauIntermediateItem

type PlateauIntermediateItem struct {
	ID                  string
	Prefecture          string
	City                string
	CityEn              string
	CityCode            string
	Dic                 Dic
	OpenDataURL         string
	Year                int
	Spec                string
	CityGMLURL          string
	CityGMLAssetID      string
	CityGMLFeatureTypes []string
	MaxLODURL           string
	SDKPublic           bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL