Execute a PlazaQL query
client.Query.Execute(ctx, params) (*FeatureCollection, error)
POST/api/v1/query
Execute a PlazaQL query
package main
import (
"context"
"fmt"
"github.com/plazafyi/plaza-go"
"github.com/plazafyi/plaza-go/option"
)
func main() {
client := githubcomplazafyiplazago.NewClient(
option.WithAPIKey("My API Key"),
)
featureCollection, err := client.Query.Execute(context.TODO(), githubcomplazafyiplazago.QueryExecuteParams{
PlazaqlQuery: githubcomplazafyiplazago.PlazaqlQueryParam{
Data: githubcomplazafyiplazago.F(`$$ = search(node, amenity: "cafe").around(distance: 500, geometry: point(48.8566, 2.3522));`),
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", featureCollection.Features)
}
{
"features": [
{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"@id": "bar",
"@type": "bar",
"amenity": "bar",
"cuisine": "bar",
"name": "bar"
},
"type": "Feature",
"id": "node/21154906"
}
],
"type": "FeatureCollection"
}Returns Examples
{
"features": [
{
"geometry": {
"coordinates": [
2.3522,
48.8566
],
"type": "Point"
},
"properties": {
"@id": "bar",
"@type": "bar",
"amenity": "bar",
"cuisine": "bar",
"name": "bar"
},
"type": "Feature",
"id": "node/21154906"
}
],
"type": "FeatureCollection"
}