0

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?

widget configuration in Lat/Long

Max Magid
  • 245
  • 1
  • 8

1 Answers1

0

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:

configure widget using method

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:

  1. Create a typescript function in a code repository to convert the value:
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
    }
}
  1. Include the function in the platform tab of slate, using a variable containing your Geohash value (v_geohash) Import function using platform
  2. Include your new coordinates in the map widget:

configure widget using function

Max Magid
  • 245
  • 1
  • 8