Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🌐 R package for the OpenCage API -- both forward and reverse geocoding 🌐

NotificationsYou must be signed in to change notification settings

ropensci/opencage

Repository files navigation

CRAN VersionCRAN Checks StatusCRAN Downloads per MonthR-universe statusProject Status: Active – The project has reached a stable, usable state and is being actively developed.R-CMD-check Status on GitHub Actionscodecov.io StatusrOpenSci Peer-ReviewLicense

Geocode with theOpenCage API, either fromplace name to longitude and latitude (forward geocoding) or fromlongitude and latitude to the name and address of the location (reversegeocoding).

Installation

You can install {opencage} fromCRAN,R-universe orGitHub like this:

  • Release version from CRAN

    install.packages("opencage")
  • Development version from R-universe

    install.packages("opencage",repos= c("https://ropensci.r-universe.dev", getOption("repos")))
  • Development version from GitHub with{pak}

    pak::pak("ropensci/opencage")

    or with {remotes}

    remotes::install_github("ropensci/opencage")

Quickstart

For the best experience, we recommend that you read through the“Introduction toopencage”vignette (vignette("opencage")), but if you are in a hurry:

  1. Register atopencagedata.com/users/sign_up.
  2. Generate an API key at theOpenCagedashboard.
  3. Save your API key as anenvironmentvariable likeOPENCAGE_KEY=yourkey in.Renviron. Seehelp(oc_config) foralternative ways to set your OpenCage API key.

Now you are ready to turn place names into latitude and longitudecoordinates:

library(opencage)oc_forward_df(placename="Sarzeau")
placenameoc_latoc_lngoc_formatted
Sarzeau47.52877-2.764256370 Sarzeau, France

Or turn a set of coordinates into the name and address of the location:

oc_reverse_df(latitude=51.5034070,longitude=-0.1275920)
latitudelongitudeoc_formatted
51.50341-0.12759210 Downing Street, Westminster, London, SW1A 2AA, United Kingdom

But remember, the vignettes are really great! We have:

About OpenCage

TheOpenCage API supports forward andreverse geocoding. Sources of OpenCage are open geospatial dataincludingOpenStreetMap,DataScienceToolkit,GeoPlanet,Natural EarthData,libpostal,GeoNames, andFlickr’sshapefilesplus a whole lot more besides. Refer to the current fulllist ofcredits.

Code of Conduct

Please note that this package is released with aContributor Code ofConduct. By contributing to thisproject, you agree to abide by its terms.


[8]ページ先頭

©2009-2025 Movatter.jp