Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Arg processing for seed/purge for srid-bounds is wrong. #1027

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions cmd/tegola/cmd/cache/seed_purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,28 @@ func seedPurgeCmdValidatePersistent(cmd *cobra.Command, args []string) error {

}

func IsKnownSrcConversionSRID(code proj.EPSGCode) bool {
return code == proj.EPSG3395 ||
code == proj.WebMercator ||
code == proj.WGS84 ||
code == proj.WorldEquidistantCylindrical
}

func AvailableSrcConversions() []proj.EPSGCode {
return []proj.EPSGCode{
proj.EPSG3395,
proj.WebMercator,
proj.WGS84,
proj.WorldEquidistantCylindrical,
}
}

func seedPurgeCmdValidate(cmd *cobra.Command, args []string) (err error) {
// validate the cache-bounds-srid
if !proj.IsKnownConversionSRID(proj.EPSGCode(cacheBoundsSRID)) {
if !IsKnownSrcConversionSRID(proj.EPSGCode(cacheBoundsSRID)) {
var str strings.Builder
str.WriteString(fmt.Sprintf("SRID=%d is not a know conversion ePSG code\n known codes are:", cacheBoundsSRID))
for _, code := range proj.AvailableConversions() {
for _, code := range AvailableSrcConversions() {
str.WriteString(fmt.Sprintf(" %d\n", int(code)))
}
return errors.New(str.String())
Expand Down
Loading