RandBox Module Tour (4/12): location โ Geospatial and Address
Overview
- Coordinates:
coordinates/latitude/longitude
- Address & region:
address/city/state/country
- Phone and postal:
phone/postal/postcode/zip
Examples
import RandBox from 'randbox'
const rb = new RandBox()
const gps = rb.coordinates?.({ precision: 6 })
const addr = rb.address?.()
const tel = rb.phone?.({ locale: 'us' })
Links
- Index:
/en/docs/location/
- Pages:
/en/docs/location/coordinates
,/en/docs/location/address
,/en/docs/location/phone
FAQ
- Valid ranges for lat/long?
- Latitude
[-90, 90]
, longitude[-180, 180]
.
- Latitude
- How to control coordinate precision?
- Use the
precision
option; mind rounding/formatting.
- Use the
- Are phone numbers locale-aware?
- Yes, use
locale
such asus/uk/fr
.
- Yes, use
Last updated on: