Closed aureliensibiril closed 1 year ago
Hey
The problem seems to be in the "truck1"+"POINT"
argument.
The Get
method does not support the format specification, and you are trying to pass it through the object identifier string.
This is why the server returns id not found
.
I will add format parameter support for this method soon.
I think there is an issue with TileClient.Keys.Get("key","id", true)
. It returns a result but without lat and lon. There are nil
. so I resorted to TileClient.Execute("GET", "key", "id", "POINT")
which works.
@aureliensibiril please try v0.10.0
@SamiAlsubhi I rewrote api a bit, and everything seems to be working fine:
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/xjem/t38c"
)
func main() {
tile38, err := t38c.New(t38c.Config{
Address: "localhost:9851",
Debug: true,
})
if err != nil {
log.Fatal(err)
}
defer tile38.Close()
if err := tile38.Keys.Set("fleet", "truck1").Point(1, 2).Do(context.TODO()); err != nil {
log.Fatal(err)
}
truck1, err := tile38.Keys.Get("fleet", "truck1").Point(context.TODO())
if err != nil {
log.Fatal(err)
}
// truck1: {"point":{"lat":1,"lon":2},"fields":null}
printJSON("truck1", truck1)
}
func printJSON(msg string, data interface{}) {
b, _ := json.Marshal(data)
fmt.Printf("%s: %s\n", msg, b)
}
Closing as resolved. Feel free to reopen this issue or create a new one if you encounter some problems.
Hi,
I'm trying to retrieve a point in the Point output format. To do so, I tried to force a bit the Keys.Get without success, I found a way around but I am under the impression that this is not a good solution.
I can't get to understand why it failed when the two commands look exactly the same.