Cast geographic point

types.castGeopoint(format, value)

Arguments

format

available options are "default", "array" and "object", where

default

A string of the pattern "lon, lat", where lon is the longitude and lat is the latitude (note the space is optional after the ,). E.g. "90, 45".

array

A JSON array, or a string parsable as a JSON array, of exactly two items, where each item is a number, and the first item is lon and the second item is lat e.g. [90, 45].

object

A JSON object with exactly two keys, lat and lon and each value is a number e.g. {"lon": 90, "lat": 45}.

value

geopoint to cast

See also

Examples

types.castGeopoint(format = "default", value = list(180, 90))
#> [[1]] #> [1] 180 #> #> [[2]] #> [1] 90 #>
types.castGeopoint(format = "default", value = '180,90')
#> [[1]] #> [1] 180 #> #> [[2]] #> [1] 90 #>
types.castGeopoint(format = "default", value = '180, -90')
#> [[1]] #> [1] 180 #> #> [[2]] #> [1] -90 #>
types.castGeopoint(format = "array", value = list(180, 90))
#> [[1]] #> [1] 180 #> #> [[2]] #> [1] 90 #>
types.castGeopoint(format = "array", value = '[180, -90]')
#> [[1]] #> [1] 180 #> #> [[2]] #> [1] -90 #>
types.castGeopoint(format = "object", value = list(lon = 180, lat = 90))
#> [[1]] #> [1] 180 #> #> [[2]] #> [1] 90 #>
types.castGeopoint(format = "object", value = '{"lon": 180, "lat": 90}')
#> [[1]] #> [1] 180 #> #> [[2]] #> [1] 90 #>