Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 928c4c3

Browse files
committedApr 7, 2025·
fix(server): fix response of city code parameter of citugml files api
1 parent 71c0cfa commit 928c4c3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
 

‎server/datacatalog/citygml_files.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type GeoCoder func(ctx context.Context, address string) (quadtree.Bounds, error)
1919

2020
const maxBounds = 30
2121

22-
func ParseCityGMLFilesQuery(ctx context.Context, conditions string, geocoder GeoCoder) (bounds []geo.Bounds2, filter cityGMLFileFilterFunc, err error) {
22+
func parseCityGMLFilesQuery(ctx context.Context, conditions string, geocoder GeoCoder) (bounds []geo.Bounds2, filter cityGMLFileFilterFunc, err error) {
2323
switch conditionType, cond := parseConditions(conditions); conditionType {
2424
case "m":
2525
for m := range strings.SplitSeq(cond, ",") {

‎server/datacatalog/repos.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (h *reposHandler) CityGMLFiles(admin bool) echo.HandlerFunc {
126126
ctx := c.Request().Context()
127127
conditions := c.Param(conditionsParamName)
128128

129-
bounds, filter, err := ParseCityGMLFilesQuery(ctx, conditions, geocoder)
129+
bounds, filter, err := parseCityGMLFilesQuery(ctx, conditions, geocoder)
130130
if err != nil {
131131
if errors.Is(err, rerror.ErrNotFound) {
132132
return echo.NewHTTPError(http.StatusNotFound, "not found")
@@ -136,8 +136,13 @@ func (h *reposHandler) CityGMLFiles(admin bool) echo.HandlerFunc {
136136
}
137137

138138
var cityIDs []string
139-
for _, b := range bounds {
140-
cityIDs = append(cityIDs, h.qt.FindRect(b.QBounds())...)
139+
if len(bounds) > 0 {
140+
for _, b := range bounds {
141+
cityIDs = append(cityIDs, h.qt.FindRect(b.QBounds())...)
142+
}
143+
} else {
144+
// conditions is just a city id
145+
cityIDs = strings.Split(conditions, ",")
141146
}
142147
cityIDs = lo.Uniq(cityIDs)
143148

0 commit comments

Comments
 (0)
Please sign in to comment.