Getting geo-coordinates from address in PhoneGap application using Google API

Introduction:
In this post we will discover the use of Google API to get the latitude and longitude by passing the address/location in PhoneGap application.

Description:
It is very easy to get the geographic coordinates (latitude & longitude) from a particular address using Google API. Google API exposes Geocoder() method which takes the address as input parameter and returns the geometry.location as output. We can parse the geometry.location to get the latitude and longitude value.

Here is the code snippets to get the latitude and longitude value from specific address. Continue reading

Getting address from latitude/longitude value using Google API and PhoneGap

Introduction:
In this post we will discover the use of Google API to get the current address and type of address by using the PhoneGap geolocation API and Google API.

Description:
Sometimes we need to get the address of a location from geolocation value. It is very very easy to get the same using Google API and PhoneGap. First we need to get the geolocation value i.e latitude and longitude using PhoneGap geolocation API.

Here are the steps that we need to follow.

1. Include the Phonegap/Cordova JavaScript file and Google API JavaScript file inside your html page.

<script type="text/javascript" src="phonegap/cordova.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"></script>

Continue reading