Skip to content

Commit 3cd840e

Browse files
committed
The Arg processing for seed/purge for srid-bounds is wrong.
For validating the args for srid-bounds we were using the wrong values. Change from dest values of conversion to supported source values.
1 parent 3537c97 commit 3cd840e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

cmd/tegola/cmd/cache/seed_purge.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,28 @@ func seedPurgeCmdValidatePersistent(cmd *cobra.Command, args []string) error {
147147

148148
}
149149

150+
func IsKnownSrcConversionSRID(code proj.EPSGCode) bool {
151+
return code == proj.EPSG3395 ||
152+
code == proj.WebMercator ||
153+
code == proj.WGS84 ||
154+
code == proj.WorldEquidistantCylindrical
155+
}
156+
157+
func AvailableSrcConversions() []proj.EPSGCode {
158+
return []proj.EPSGCode{
159+
proj.EPSG3395,
160+
proj.WebMercator,
161+
proj.WGS84,
162+
proj.WorldEquidistantCylindrical,
163+
}
164+
}
165+
150166
func seedPurgeCmdValidate(cmd *cobra.Command, args []string) (err error) {
151167
// validate the cache-bounds-srid
152-
if !proj.IsKnownConversionSRID(proj.EPSGCode(cacheBoundsSRID)) {
168+
if !IsKnownSrcConversionSRID(proj.EPSGCode(cacheBoundsSRID)) {
153169
var str strings.Builder
154170
str.WriteString(fmt.Sprintf("SRID=%d is not a know conversion ePSG code\n known codes are:", cacheBoundsSRID))
155-
for _, code := range proj.AvailableConversions() {
171+
for _, code := range AvailableSrcConversions() {
156172
str.WriteString(fmt.Sprintf(" %d\n", int(code)))
157173
}
158174
return errors.New(str.String())

0 commit comments

Comments
 (0)