Getting Started with Reverse Geocoding
Reverse geocoding turns GPS coordinates into real places like countries, cities, and addresses. Here's how to set it up in minutes.
Step 1: Get Your Resource Key
You'll need a Resource Key to access our reverse geocoding service. Follow the Configurator explanation to create one. Make sure your Resource Key includes at least the Country field.
Step 2: Install the Library
Step 3: Set Up Your Pipeline
The pipeline is how you connect to 51Degrees APIs (learn more in basic pipeline description and Pipeline). Use the Resource Key you created in step 1.
Step 4: Add Your Coordinates
You need to provide latitude and longitude coordinates (called evidence). Use these specific keys:
- query.51D_pos_latitude
- query.51D_pos_longitude
The keys aren't case-sensitive.
Step 5: Run the Query
Call process()
to start the reverse geocoding lookup.
Step 6: Get Your Results
Your results are in the flowData
object (not returned from process()
). Each property has a hasValue
boolean. If it's populated, hasValue
is true and value
contains the result. If not, hasValue
is false and you'll find why in the null reason property.
Find complete working code examples on GitHub for each language:
Troubleshooting
Having issues? Here are common problems and fixes:
Resource Key Problems
**"Resource Key not found" error:** Your Resource Key is invalid. Create a new one with the properties you need.
Properties missing from results: Your Resource Key might not have access to location properties. Check what your key can access at https://configure.51degrees.com/YOUR_RESOURCE_KEY or create a new key with the right permissions.
Wrong Evidence Keys
If you get an error about missing evidence, check you're using the correct keys:
- query.51d_pos_latitude
- query.51d_pos_longitude
Wrong keys get ignored, which can cause errors if you don't have any valid evidence.