'Can I get place details against a coordinate for free?? Geocoding/Reverse Geocoding Api is not free?
I get my current pos=sition from Geolocation.getcurrentposition, i have my coordinates now, can i get details against this coordinates without any payment
Solution 1:[1]
I finally got this, this API is free and unlimited on client side application based on the user current location getting from (GeoLocation.getCurrentPosition Method).
https://www.bigdatacloud.com/geocoding-apis/free-reverse-geocode-to-city-api
Read their terms and conditions must.
Solution 2:[2]
Not with the Geolocation package. You can in react native using the exp-location package. Find a doc here https://docs.expo.io/versions/latest/sdk/location/. You can get location, get longitude and latitude, then reverse geocode and return the address object. Pricing for exp https://expo.io/pricing there is a free option.
import React, {useState, useEffect} from 'react'
import * as Location from 'expo-location'
import * as Premmissions from 'expo-premmissions'
export function location(){
const [currentCoords, setCurrentCoords] = React.useState<Object>(null)
const [location, setLocation] = React.useState<Object> (null);
const [address, setAddress ] = React.useState<Object>(null);
useEffect(() => {
(async () => {
// get phone premission
let { status } = await Location.requestPermissionsAsync();
if (status !== 'granted') {
setErrorMsg('Permission to access location was denied');
return;
}
//get location using exp-location package
const location = await Location.getCurrentPositionAsync({});
setLocation(location);
setCurrentCoords({
latitude: location.coords.latitude,
longitude: location.coords.longitude,
})
// print the phone location
console.log(location)
const readOnlyAddress = await Location.reverseGeocodeAsync(currentCoords);
setAddress(readOnlyAddress[0]);
//print the postal address.
console.log(address)
})();
}, []);
let locationText = "waiting...";
if (location){
locationText = JSON.stringify(location);
}
let addressText = "waiting";
if(address){
addressText = JSON.stringify(address);
}
return(
<Text>{locationText}</Text>
<Text>{addressText}</Text>
)
}
Solution 3:[3]
There is a new reverse geocoding service online available. It's in the startup phase. Anyway it's possibile to use the reverse geocode engine using http/s requests. Basic demo of the service is here. https://feroeg.com/Demo.html Disclaimer: I'm the owner of the site. The data are from Open StreetMap and OpenAddresses. Feel free to experiment with it. You can use you browser to query. Example: https://www.feroeg.com/address?lat=40.786138&lon=-73.950691&mode=text
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | |
Solution 3 |