Skip to content
This repository was archived by the owner on May 24, 2021. It is now read-only.
Open
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: 5 additions & 15 deletions pkg/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"os"
"path/filepath"
"strconv"
"sync"

"github.com/disintegration/imaging"
"github.com/gocarina/gocsv"
Expand Down Expand Up @@ -203,7 +202,6 @@ func ReadShapeFile(lblPath string) gdal.Layer {
srs := gdal.CreateSpatialReference("")
srs.FromEPSG(4326)
lblDataSource := gdal.OpenDataSource(lblPath, 1)
// lblLayer := lblDataSource.CreateLayer("Labels", srs, gdal.GT_MultiPolygon, []string{})
lblLayer := lblDataSource.LayerByIndex(0)
return lblLayer

Expand Down Expand Up @@ -268,20 +266,12 @@ func RunBatch(client *maps.Client, csvPath string, skipFirst bool, zoom int, siz
coordinates := readCSVFile(csvPath, skipFirst)
var numSkip int
bar := progressbar.NewOptions(len(coordinates), progressbar.OptionSetRenderBlankState(true))
// Initialize goroutine variables
var wg sync.WaitGroup
wg.Add(len(coordinates))

for _, coord := range coordinates {
go func(coord *coordinate) {
defer wg.Done()
skipped := Run(client, []string{coord.Latitude, coord.Longitude}, zoom, size, path, noRef, wtLbl, force)
if skipped {
numSkip++
}
bar.Add(1)
}(coord)
skipped := Run(client, []string{coord.Latitude, coord.Longitude}, zoom, size, path, noRef, wtLbl, force)
if skipped {
numSkip++
}
bar.Add(1)
}
wg.Wait()
return len(coordinates), numSkip
}