Skip to content

Commit

Permalink
Merge pull request #44 from pfeiferj/empty-files
Browse files Browse the repository at this point in the history
add a flag for generating empty offline files
  • Loading branch information
pfeiferj authored Jan 12, 2024
2 parents 26fcbf7 + af91916 commit e84815a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions generate_offline.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func GenerateAreas() []Area {
return areas
}

func GenerateOffline(minGenLat int, minGenLon int, maxGenLat int, maxGenLon int) {
func GenerateOffline(minGenLat int, minGenLon int, maxGenLat int, maxGenLon int, generateEmptyFiles bool) {
log.Info().Msg("Generating Offline Map")
EnsureOfflineMapsDirectories()
file, err := os.Open("./map.osm.pbf")
Expand Down Expand Up @@ -197,8 +197,9 @@ func GenerateOffline(minGenLat int, minGenLon int, maxGenLat int, maxGenLon int)
if area.MinLat < float64(minGenLat)-OVERLAP_BOX_DEGREES || area.MinLon < float64(minGenLon)-OVERLAP_BOX_DEGREES || area.MaxLat > float64(maxGenLat)+OVERLAP_BOX_DEGREES || area.MaxLon > float64(maxGenLon)+OVERLAP_BOX_DEGREES {
continue
}

haveWays := Overlapping(allMinLat, allMinLon, allMaxLat, allMaxLon, area.MinLat-OVERLAP_BOX_DEGREES, area.MinLon-OVERLAP_BOX_DEGREES, area.MaxLat+OVERLAP_BOX_DEGREES, area.MaxLon+OVERLAP_BOX_DEGREES)
if !haveWays {
if !haveWays && !generateEmptyFiles {
continue
}

Expand Down
3 changes: 2 additions & 1 deletion mapd.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,10 @@ func main() {
minGenLonPtr := flag.Int("minlon", -180, "the minimum longitude to generate")
maxGenLatPtr := flag.Int("maxlat", -90, "the maximum latitude to generate")
maxGenLonPtr := flag.Int("maxlon", -180, "the maximum longitude to generate")
generateEmptyFiles := flag.Bool("generate-empty-files", false, "Includes empty files when generating map")
flag.Parse()
if *generatePtr {
GenerateOffline(*minGenLatPtr, *minGenLonPtr, *maxGenLatPtr, *maxGenLonPtr)
GenerateOffline(*minGenLatPtr, *minGenLonPtr, *maxGenLatPtr, *maxGenLonPtr, *generateEmptyFiles)
return
}
EnsureParamDirectories()
Expand Down

0 comments on commit e84815a

Please sign in to comment.