Location search and geocoding API. To be used in concert with OGC APIs.
This application offers location search and geocoding.
NAME:
gomagpie - Run location search and geocoding API, or use as CLI to support the ETL process for this API.
USAGE:
gomagpie [global options] command [command options]
COMMANDS:
start-service Start service to serve location API
help, h Shows a list of commands or help for one command
etl:
create-search-index Create empty search index in database
import-file Import file into search index
GLOBAL OPTIONS:
--help, -h show helpExample (config-file is mandatory):
docker run -v `pwd`/examples:/examples -p 8080:8080 -it pdok/gomagpie start-service \
--config-file /examples/config.yaml \
--rewrites-file internal/search/testdata/rewrites.csv \
--synonyms-file internal/search/testdata/synonyms.csv
Now open http://localhost:8080or open http://localhost:8080/api to check the openAPI specification.
See examples for more details.
Create database using the ETL commands.
# First create database to populate
docker run --rm --name postgis -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=test_db -p 5432:5432 postgis/postgis
./gomagpie create-search-index --db-name test_db
./gomagpie import-file --db-name test_db \
--file internal/etl/testdata/addresses-rd.gpkg \
--feature-table "addresses" \
--config-file internal/etl/testdata/config.yaml \
--collection-id "addresses"docker build -t pdok/gomagpie .Health endpoint is available on /health.
Besides the main server, Gomagpie can also start a debug server. This server
binds to localhost and a different port which you must specify using the
--debug-port flag. You shouldn't expose this port publicly but only access it
through a tunnel/port-forward. The debug server exposes /debug for use by
pprof. For example with --debug-port 9001:
- Create a tunnel to the debug server e.g. in k8s:
kubectl port-forward gomagpie-75f59d57f4-4nd6q 9001:9001 - Create CPU profile:
go tool pprof http://localhost:9001/debug/pprof/profile?seconds=20 - Start pprof visualization
go tool pprof -http=":8000" pprofbin <path to pb.gz file> - Open http://localhost:8000 to explore CPU flamegraphs and such.
A similar flow can be used to profile memory issues.
go build -o gomagpie cmd/main.go
./gomagpie
To troubleshoot, review the Dockerfile since compilation also happens there.
Install golangci-lint and run golangci-lint run
from the root.
Either run go test ./... or go test -short ./...
- Install the Go Template plugin
- Open
Preferences>Editor>File TypesselectGo Template filesand add the following file patterns:"*.go.html""*.go.json""*.go.tilejson""*.go.xml"
- Now add template language support by running the setup-jetbrains-gotemplates.sh script.
- Reopen the project (or restart IDE). Now you'll have full IDE support in the gomagpie templates.
Also:
- Set import order in
Preferences>Editor>Code Style>Go>Importstogoimportsto align with VSCode and goimports usage in golangci-lint.
- Install the Go Template extension
- Open Extension Settings and add the following file patterns:
"*.go.html""*.go.json""*.go.tilejson""*.go.xml"
- Also add
html,jsonandxmlto the list of Go template languages. - Now you'll have IDE support in the gomagpie templates.
Gomagpie started as a fork of GoKoala.
Make a pull request...
Contacting the maintainers can be done through the issue tracker.
