I have a dataset with geohash values (not the latitude and longitude coordinates) and want to plot these on the slate map widget.
There does not seem to be a layer type that allows me to include those. How can I have these locations on my map?
If your dataset already has an object type with a Geohash property type (https://www.palantir.com/docs/foundry/geospatial/ontology/#points), you can include it via the Object Set section in the platform tab of slate. The Geohash property will be returned as a string containing the latitude and longitude which can be split by a function in slate:
f_function using s_object_set1 (here the geohash is included in the property called “geohash”):
return {{s_object_set1.data.geohash.[0]}}.split(",")
And can be included in the map widget:
If you don’t want to create an Object Type, you could work with a typescript function. Below is an example on how to take one Geohash value and return the set of latitude and longitude:
import { Function, GeoPoint, Float } from "@foundry/functions-api";
export class MyFunctions {
@Function()
public hashToCoord(hash : string): Float[] {
var lat = GeoPoint.fromString(hash).toCoordinates().latitude
var lon = GeoPoint.fromString(hash).toCoordinates().longitude
var result = [lat, lon]
return result
}
}