forked from Project-OSRM/osrm-backend
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make place-connectivity-gen work and add related logs.
issue: #238
- Loading branch information
1 parent
0773592
commit b721258
Showing
10 changed files
with
128 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
package main | ||
|
||
import "flag" | ||
import ( | ||
"flag" | ||
"runtime" | ||
) | ||
|
||
var flags struct { | ||
inputPath string | ||
outputFolder string | ||
inputFile string | ||
outputFolder string | ||
numberOfWorkers int | ||
maxRange float64 | ||
} | ||
|
||
// defaultRange indicates default max drive range in meters. | ||
// This value always bigger than max driven ranges for existing vehicles. | ||
// During query time could just take subset of pre-processed result based on real range. | ||
const defaultMaxRange = 800000 | ||
|
||
func init() { | ||
flag.StringVar(&flags.inputPath, "i", "", "path for input file in json format") | ||
flag.StringVar(&flags.inputFile, "i", "", "path for input file in json format") | ||
flag.StringVar(&flags.outputFolder, "o", "", "path for output folder") | ||
flag.IntVar(&flags.numberOfWorkers, "num_of_workers", runtime.NumCPU(), "number of workers to build connectivity map") | ||
flag.Float64Var(&flags.maxRange, "range", defaultMaxRange, "maximum drive range in meters used for preprocessing.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,34 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"flag" | ||
"os" | ||
"time" | ||
|
||
"github.com/Telenav/osrm-backend/integration/service/connectivitymap" | ||
"github.com/Telenav/osrm-backend/integration/service/spatialindexer/ranker" | ||
"github.com/Telenav/osrm-backend/integration/service/spatialindexer/s2indexer" | ||
"github.com/golang/glog" | ||
) | ||
|
||
func main() { | ||
// @todo: add logic to generate connectivity for charge stations | ||
fmt.Print("Hello World!") | ||
flag.Parse() | ||
defer glog.Flush() | ||
startTime := time.Now() | ||
|
||
if flags.inputFile == "" || flags.outputFolder == "" { | ||
glog.Fatal("Empty string for inputFile or outputFolder, please check your input.\n") | ||
} | ||
|
||
indexer := s2indexer.NewS2Indexer().Build(flags.inputFile) | ||
if indexer == nil { | ||
glog.Fatalf("Failed to build indexer, stop %s\n", os.Args[0]) | ||
} | ||
indexer.Dump(flags.outputFolder) | ||
|
||
connectivitymap.NewConnectivityMap(flags.maxRange). | ||
Build(indexer, indexer, ranker.CreateRanker(ranker.SimpleRanker, nil), 1). | ||
Dump(flags.outputFolder) | ||
|
||
glog.Infof("%s totally takes %f seconds for processing.", os.Args[0], time.Since(startTime).Seconds()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 31 additions & 29 deletions
60
integration/service/spatialindexer/poiloader/poi_format.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters