Learn R Programming

tableschema.r (version 1.1.2)

types.castGeopoint: Cast geographic point

Description

Cast geographic point

Usage

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

Run this code

types.castGeopoint(format = "default", value = list(180, 90))

types.castGeopoint(format = "default", value = '180,90')

types.castGeopoint(format = "default", value = '180, -90')

types.castGeopoint(format = "array", value = list(180, 90))

types.castGeopoint(format = "array", value =  '[180, -90]')

types.castGeopoint(format = "object", value = list(lon = 180, lat = 90))

types.castGeopoint(format = "object", value =  '{"lon": 180, "lat": 90}')

Run the code above in your browser using DataLab