Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
Warning: MapViewDirections Error: Error on GMAPS route request: ZERO_RESULTS for final destination only

In my app, a user may want to run from point A to Point B, so we show them the route on a map.

The user plugs in their start location, it's sent to the server, and then spit out on the map on the following page (once they've started running.)

When trying to show them their route on the map, I keep getting the above warning for the info associated with the runner's destination.

The console logs it as:

object{

latitude: -1,

longitude: -1,

}

When I hard code coordinates into the function, the console logs the correct latitude and longitude, but it still does not spit it out on the map. Below is some of my code:

const [user_latitude, setUserLatitude] = useState(0)
const [user_longitude, setUserLongitude] = useState(0)
const [ startRun, setStartRun] = useState(null)
const [ endRun setEndRun ] = useState(null)

useFocusEffect(
    React.useCallback(()=?{
        let isActive = true;
        
        const fetchGeoPosition = () =>{ //gets runner's current position
            navigator.geolocation.getCurrentPosition(
            position=>{
                if(isActive){
            setUserLatitude(position.coords.latitude)
            setUserLongitude(position.coords.longitude)
    }
    
    ...

const finalLocation = async()=>{
    let running_response = await client_instance.get_final_locations

    setEndRun({ //this spits out -1,-1 when pulled from server
        latitude: client_response["location_info"]["end_lat"],
        longitude: client_response["location_info"][end_lon"],
    })
}
...
finalLocation()

setStartRun(
    {
        latitude: user_latitude,
        longitude: user_longitude
    },
)

...

<MapViewDirections
    origin={startRun}
    destination={endRun}
    strokeWidth={5}
/>

<Marker coordinate={startRun}/> //This will render their start pin
<Marker coordinate={endRun}/> //This renders -1,-1 when imported from server
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I ran into a similar problem and after some googling I discovered the reason for that error was because I was trying to get "directions from one island to another" (In my case, my origin coordinates was in Nigeria and the destination coordinates was in Australia). After changing my origin to the same country, I started getting directions.

You can refer to this page for some more clarity

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!