-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge go-whosonfirst-spatial-rtree codebase (#41)
* issue #21 - start work to merge rtree package * snapshot: app/hierarchy/update/ - RunWithOptions * perform extra checks to see if files have changed, docs * snapshot: move everything around; rip out old flags code for app/pip, untested * docs for application/application.go --------- Co-authored-by: sfomuseumbot <sfomuseumbot@localhost>
- Loading branch information
1 parent
da1a189
commit 0bfcbf2
Showing
811 changed files
with
73,537 additions
and
572 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
GOMOD=$(shell test -f "go.work" && echo "readonly" || echo "vendor") | ||
LDFLAGS=-s -w | ||
|
||
cli: | ||
go build -mod $(GOMOD) -ldflags="$(LDFLAGS)" -o bin/pip cmd/pip/main.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package update | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
|
||
"github.com/sfomuseum/go-flags/flagset" | ||
"github.com/whosonfirst/go-whosonfirst-export/v2" | ||
"github.com/whosonfirst/go-whosonfirst-spatial/database" | ||
"github.com/whosonfirst/go-whosonfirst-spatial/filter" | ||
"github.com/whosonfirst/go-whosonfirst-spatial/hierarchy" | ||
hierarchy_filter "github.com/whosonfirst/go-whosonfirst-spatial/hierarchy/filter" | ||
"github.com/whosonfirst/go-writer/v3" | ||
) | ||
|
||
type RunOptions struct { | ||
Writer writer.Writer | ||
WriterURI string | ||
Exporter export.Exporter | ||
ExporterURI string | ||
MapshaperServerURI string | ||
SpatialDatabase database.SpatialDatabase | ||
SpatialDatabaseURI string | ||
ToIterator string | ||
FromIterator string | ||
SPRFilterInputs *filter.SPRInputs | ||
SPRResultsFunc hierarchy_filter.FilterSPRResultsFunc // This one chooses one result among many (or nil) | ||
PIPUpdateFunc hierarchy.PointInPolygonHierarchyResolverUpdateCallback // This one constructs a map[string]interface{} to update the target record (or not) | ||
To []string | ||
From []string | ||
} | ||
|
||
func RunOptionsFromFlagSet(ctx context.Context, fs *flag.FlagSet) (*RunOptions, error) { | ||
|
||
flagset.Parse(fs) | ||
|
||
inputs := &filter.SPRInputs{} | ||
|
||
inputs.IsCurrent = is_current | ||
inputs.IsCeased = is_ceased | ||
inputs.IsDeprecated = is_deprecated | ||
inputs.IsSuperseded = is_superseded | ||
inputs.IsSuperseding = is_superseding | ||
|
||
hierarchy_paths := fs.Args() | ||
|
||
opts := &RunOptions{ | ||
WriterURI: writer_uri, | ||
ExporterURI: exporter_uri, | ||
SpatialDatabaseURI: spatial_database_uri, | ||
MapshaperServerURI: mapshaper_server, | ||
SPRResultsFunc: hierarchy_filter.FirstButForgivingSPRResultsFunc, // sudo make me configurable | ||
SPRFilterInputs: inputs, | ||
ToIterator: iterator_uri, | ||
FromIterator: spatial_iterator_uri, | ||
To: hierarchy_paths, | ||
From: spatial_paths, | ||
} | ||
|
||
return opts, nil | ||
} |
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
Oops, something went wrong.