Oct 12, 2011

Distance between two locations with the help of Latitude and Longitude

Finding Distance between two locations with Latitude and Longitude.

Lets see how can we find out the distance and duration between two diffrent locations,
if you have the latitude and longitude of two places.


Here is the pic of the application :-








Steps for finding distance with latitude/longitude.
1) Lets say we have latitude and longitude set P1 and P2.
    Google MAP comes up with the class GLatLng. This class helps to encapsulate Latitude
    and Longitude.
   
GLatLng is a point in geographical coordinates longitude and latitude. Notice that although usual map projections associate longitude with the x-coordinate of the map, and latitude with the y-coordinate, the latitude cooridnate is always written first, followed by the longitude, as it is custom in cartography.  

2) From this GLatLng points we need to get place name first.
   
class GClientGeocoder will help us to get the place name from LatLng.
  
This class is used to communicate directly with Google servers to obtain geocodes for user specified addresses. In addition, a geocoder maintains its own cache of addresses, which allows repeated queries to be answered without a round trip to the server. As a general best practice, it is not recommended to use GClientGeocoder functions in a loop. Developers that have multiple addresses to geocode should probably use our HTTP Geocoder instead.

Method :-
getLocations(latlng:GLatLng, callback:function)

This method performs reverse-geocoding, the conversion of a latitude/longitude pair into human-readable addresses. getLocations() sends a request to the Google geocoding service, asking it to return the address for the given latlng and pass the response in the given callback. As this method requires a call to a Google server, you must also pass a callback method to handle the response. This response will contain a Status code, and if successful, one or more Placemark objects. Note that this method may instead pass an addressable String, as indicated above; in that case, the service will do a standard geocode. If however, the first argument contains a GLatLng, the service will do a reverse-geocode.

Here is the example of function :-
function showAddress(response) {
  map.clearOverlays();
  if (!response || response.Status.code != 200) {
    alert("Status Code:" + response.Status.code);
  } else {
    place = response.Placemark[0];
    point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
    marker = new GMarker(point);
    map.addOverlay(marker);
    marker.openInfoWindowHtml(
        'orig latlng:' + response.name + ' ' + 
        'latlng:' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + ' ' +
        'Status Code:' + response.Status.code + ' ' +
        'Status Request:' + response.Status.request + ' ' +
        'Address:' + place.address + ' ' +
        'Accuracy:' + place.AddressDetails.Accuracy + ' ' +
        'Country code: ' + place.AddressDetails.Country.CountryNameCode);
  }
}


3) With the help of place name, we will query map for getting the distance and duration.
 
A sample code snippet for displaying location with map :-   
// Create a directions object and register a map and DIV to hold the 
// resulting computed directions

var map;
var directionsPanel;
var directions;

function initialize() {
  map = new GMap2(document.getElementById("map_canvas"));
  directionsPanel = document.getElementById("my_textual_div");
  directions = new GDirections(map, directionsPanel);
  directions.load("from:"+ fromAddress + "to: " + toAddress);
}

  fromAddress and toAddress is the same which we can retrieve easily with as we have discussed in step 2.

Let's see the demo in a sample application

 








From:    To: 
Place A:   Place B: 
Language: 

Formatted DirectionsMap



58 comments:

Repairing of hp laptop are very well done by us as we have experts that are well versed with the technology used in hp laptop to build them. Get in touch with us for swift & skilled help in repairing your hp laptop system. hp service center in Delhi. Call us: 7217871051
Hp Service Center in Delhi

Lenovo Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 7217871051
Lenovo Service Center in Ghaziabad

Hp Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 7217871051
Hp Service Center in Ghaziabad

Repairing of hp laptop are very well done by us as we have experts that are well versed with the technology used in hp laptop to build them. Get in touch with us for swift & skilled help in repairing your hp laptop system. hp service center in Delhi. Call us: 7217871051
Hp Service Center in Gurgaon

Lenovo Laptop Service Center offer fixing for your PC needs, we are experts in PC chip level fix, call us: 7217871051
Lenovo Service Center in Uttam Nagar

Hp Laptop Service Center offer fixing for your PC needs, we are experts in PC chip level fix, call us: 7217871051
HP Service Center in Uttam Nagar

Lenovo Laptop Service Center offer fixing for your PC needs, we are experts in PC chip level fix, call us: 7217871051
Lenovo Service Center in Neta ji subhash Place

Hp Laptop Service Center offer fixing for your PC needs, we are specialists in PC chip level fix, call us: 9891868324
Hp Service Center in Rajouri Garden

Lenovo Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 9891868324
Lenovo Service Center in Nehru-Place

Dell Laptop Service Center offer fixing for your PC needs, we are specialists in PC chip level fix, call us: 9891868324
Dell Service Center in Lajpat-Nagar

Hp Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 9891868324
Hp Service Center in Pitampura

Lenovo Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 9891868324
Lenovo Service Center in Pitampura

Hp Laptop Service Center offer fixing for your PC needs, we are experts in PC chip level fix, call us: 9891868324.
HP Service Center in Uttam Nagar

Lenovo Laptop Service Center offer fixing for your PC needs, we are specialists in PC chip level fix, call us: 9891868324
Lenovo Service Center in Mangolpuri

Hp Laptop Service Center offer fixing for your PC needs, we are specialists in PC chip level fix, call us: 9891868324.
Hp Service Center in Mangolpuri

Lenovo Laptop Service Center offer fixing for your PC needs, we are experts in PC chip level fix, call us: 9891868324.
Lenovo Service in Center in Okhla


Hp Laptop Service Center offer fixing for your PC needs, we are experts in PC chip level fix, call us: 9891868324.
Hp Service in Center in Okhla

Hp Laptop Service Center offer fixing for your PC needs, we are experts in PC chip level fix, call us: 9891868324.
Hp Service in Center in Greater Noida

Hp Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 9891868324.
Hp Service Center in Najafgarh

Lenovo Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 9891868324.
Lenovo Service Center in Najafgarh

Lenovo Laptop Service Center offer fixing for your PC needs, we are specialists in PC chip level fix, call us: 7042640351.
Lenovo Service Center in Chattarpur


The school maintains the authors' obligation to greatness in all fields, with accentuation on its maxim Higher Stronger Brighter. High ethics are an essential of a decent individual. Contact on us: 8130269997.
top 10 schools in rohini

The school keeps up the creators' commitment to significance in all fields, with complement on its saying Higher Stronger Brighter. High morals are a fundamental of a nice person. Contact on us: 8130269997.
cbse school in Rohini

The school keeps up the creators' commitment to significance in all fields, with complement on its saying Higher Stronger Brighter. High morals are a fundamental of a nice person. Contact on us: 8130269997.
Top Schools in Rohini

Arising as a broadly perceived promoting organization in all features of publicizing and marking arrangements centering in outside, on the web and electronic media spaces. Contact on us: 9868946230.
Hoarding advertising

Arising as a broadly perceived promoting organization in all features of publicizing and marking arrangements centering in outside, on the web and electronic media spaces. Contact on us: 9868946230.
Digital wall painting

It is attempt of Mast Banarasi Paan Company to construct a chain of establishment outlets in a large portion of the urban areas of India to guarantee that heavenly Banarasi Paan is made accessible to each client with a similar flavor, taste, quality and cleanliness and we are the best paan supplier in INDIA
Paan Café

It is attempt of Mast Banarasi Paan Company to construct a chain of establishment outlets in a large portion of the urban areas of India to guarantee that heavenly Banarasi Paan is made accessible to each client with a similar flavor, taste, quality and cleanliness and we are the best paan supplier in INDIA
Flavour Paan

Lenovo Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 7838122281.
Dell Service Center in Mumbai

Hp Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 7838122281.
Hp Service Center in BKC-Mumbai

Dell Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 7838446546.
Dell Service Center in Mumbai

Lenovo Laptop Service Center offer repairing for your laptop needs, we are experts in laptop chip level repair, call us: 7838446546.
Lenovo Service Center in Mumbai

The school maintains the authors' obligation to greatness in all fields, with accentuation on its maxim Higher Stronger Brighter. High ethics are an essential of a decent individual. Contact on us: 8130269997.
Nursery Admissions 2021-2022
Best Schools in Delhi
GD GOENKA Rohini

Arising as a broadly perceived promoting organization in all features of publicizing and marking arrangements centering in outside, on the web and electronic media spaces. Contact on us: 9868946230.
Hoardings in Delhi

Arising as a broadly perceived promoting organization in all features of publicizing and marking arrangements centering in outside, on the web and electronic media spaces. Contact on us: 9868946230.
Outdoor Advertising Companies in Delhi

G.D. Goenka Public School Rohini Sector- 9 is a Co-educational Senior Secondary School, recognized and affiliated to the Central Board of Secondary Education (CBSE). It has classes from Preschool till Class 12th. The school upholds the founders' commitment to excellence in all fields, with emphasis on its motto Higher Stronger Brighter. High morals are a prerequisite of a good human being.
top 10 schools in rohini
cbse school in Delhi
Nursery Admissions 2021-2022

Arising as a broadly perceived promoting organization in all features of publicizing and marking arrangements centering in outside, on the web and electronic media spaces. Contact on us: 9868946230.
Hoardings in Delhi
Digital wall painting
Auto Rickshaw advertising

Four Square Media Services is engineered in Delhi NCR. The Company eyes the vision of getting one of the India's striking and assumed Outdoor Advertising Companies in Delhi by fulfilling our client's basics and giving our colossal clients the best quality results using our ability and rich experiences of advancing. Contact on us: 9868946230.
Hoardings in Delhi
Digital wall painting
Advertising wall painting

One thing we make sure that we provide tobacco-free paan and currently we have a paan franchise in INDIA so people who want to eat paan or purchase paan just type of google paan near me and you find your nearest mast banarasi paan shops.
Karva Chauth Suhag Thali
Paan Café
Flavour Paan
Paan Franchise

Four Square Media Services is engineered in Delhi NCR. The Company eyes the vision of getting one of the India's striking and assumed Outdoor Advertising Companies in Delhi by fulfilling our client's basics and giving our colossal clients the best quality results using our ability and rich experiences of advancing. Contact on us: 9868946230.
Hoardings in Delhi
Digital wall painting
Wall painting advertising
Outdoor advertising

Mast Banarasi Paan also Provides home delivery for it all products along with the service of event management. Customers can also order delicious Paan by submitting their requests online. Mast Banarasi Paan is a natural Paan for all paan lovers because it offers the Best Goal where people belonging to all age groups can visit and eat and enjoy 120 + delicious varieties of Paan.
banarasi paan
paan near me
Flavour Paan
family paan café

Four Square Media Services is engineered in Delhi NCR. The Company eyes the vision of getting one of the India's striking and assumed Outdoor Advertising Companies in Delhi by fulfilling our client's basics and giving our colossal clients the best quality results using our ability and rich experiences of advancing. Contact on us: 9868946230.
Digital wall painting
Auto Rickshaw advertising
Advertising wall painting
Auto rickshaw ad in delhi
Rural wall painting advertising

We offer out of Warranty Laptop Repair, removal of Virus, screen change, a wireless network set up, battery removal, motherboard replacement and several others are offered at a budget-friendly price and negotiable. We can provide on-call support and repair your laptop at your home.
Dell Laptop Service Center in Noida
Dell laptop service center in Mumbai
Dell Laptop Service Center in Grugram
Dell laptop service center in Ghaziabad
Dell Laptop Service Center in Faridabad
Dell Laptop Service Center in Chandigarh

Dell Laptop Service Center In Udyogvihar
Dell Laptop Repairing Service Center UdyogVihar phase 1, phase 2, phase 3, Gurgaon.UdyogVihar is the center for Gurgaon development, thousands of companies and factories are situated in UdyogVihar area. If laptops, servers, dell desktops stop working we are in the process to support you we and also offer you same day repair service. There are many major brands in this manufacturing region of the Indian economy. We provide the best service and goods for our warranty, even if we work for the manufacturing industries on weekends, there are two to three technicians for swift answers.contact us 8929181953,8929185096,9891868324

Dell Service Center Faridabad

Computers have become an indispensable part of our society and life. We use it for work, studies, shopping, buying movie tickets, booking shows and many other works. Life has become just at the click, we no more need to travel and get the booking on the train rather we reserve a seat sitting at the comfort of our house. There are few things that need to be regularly checked in your computer which is the maintenance so that we can keep working smoothly and lead a hassle free work. BS System, Delhi is one such name which offers the servicing for Dell laptops.CONTACT US 8929181953,8929185096,9891868324

Asus Service Center In Delhi

Fix Your Hardware And Software Issues By Hiring Asus Laptop Service Center In Delhi, NCR Due to the prolonged usage, your laptop might need a reliable and trustworthy service center that can able to deals with all kinds of software assistance or physical damage. We are offering authorized Asus Laptop Repair in Delhi, NCR, and help you in fixing all kinds of problems related to hardware or software like virus issues, keyboard repairs, motherboard repair, laptop screen replacement, data recovery, touch-pad repair & backup problems.

The professionals at Asus Laptop Service Center in Delhi, NCR, are well-trained and certified to analyze the problems of the laptop in quicker time. The long-term experience on Asus laptop repair service makes us be the professionals in repairing and troubleshooting the faulty laptop in the fast and competent manner thus saving your money and time. The Asus Service Center in Delhi, NCR offer specialist, affordable and quick laptop repairs for both residential and business users.

High-Tech Tools & Affordable Manpower

Asus Laptop Service Center in Delhi, NCR, is qualitative with plenty of technical benefits to provide. Delhi, NCR, being the famous city in Maharashtra, numerous IT professionals, high-profile people and executives of worldwide companies like to move to this location. Therefore, one can easily contact the service center for refurbishing the Asus Laptops. Our technicians at Asus Service Center in Delhi, NCR, perform deeper analysis on laptop & research more before providing a perfect repair solution.

We also offer customized repair solution for our customers depending on their requirements and budget. We make use of affordable manpower and high-tech tools for providing quality repair solution on laptop services. If you do not know how to make your system standalone without any error then our specialists will offer tips and suggestions which seem to be quite useful. Our team of highly dedicated professionals believes in offering high-quality services at reasonable rates. We ensure to provide timely service.CONTACT US 8929181953,8929185096,9891868324

Lenovo Service Center Noida

There are many problems that you might find while using a Lenovo laptop and such problems could not be resolved online resultant you have to search for the best Lenovo Service Center in Noida. The BS System point you all the problems that you face while using the laptop and provide better response through quality guidance and service.CONTACT US 8929181953,8929185096,9891868324

Bs system solution in Delhi provides the best solution for laptop repair. Our experienced engineers take complete care and responsibility for your device and provide you a high-quality solution. The Lenovo Laptop Technical support is available for all range of customers. IF YOU ARE INTERESTED YOU MAY CALL -9891868324, 9643406897, and 9643409808
laptop repairing center in Delhi
best laptop service center in Delhi

Bs system solution in Delhi provides the best solution for laptop repair. Our experienced engineers take complete care and responsibility for your device and provide you a high-quality solution. The Lenovo Laptop Technical support is available for all range of customers. IF YOU ARE INTERESTED YOU MAY CALL -9891868324, 9643406897, and 9643409808
laptop service in Delhi
laptop reparing center in Mumbai

The ventilated external shell protects against electrical hazards, molten substance splash and squeezes. With its eventuality for integration of a Petzl headlamp, hearing protection, and multiple accessories, it's an entirely modular helmet, therefore meeting the specific fresh conditions of professionals.
petzl HELMETS Vertex price in Mumbai
Petzl HARNESS Avao Bod price in Mumbai

Spotting the best wedding photographer in Kolkata can be quite a hectic task. Here’s Crazy lens photography to end your quest. We specialize in a fun and candid style of wedding photography, which can be customized according to your needs.
best pre wedding photographer in kolkata
pre wedding photography in kolkata

Klever Trade is a new-generation online stock trading platform which will change the way you trade forever. Klever Trade is a new-generation online stock trading platform which will change the way you trade forever. 02614245940
How to trade in algo
Best api for algo trading

We always attempt to keep international standards in our vending machines to give the superior quality and taste of natural tea and coffee to our customers and users. We are one of the well-known providers of Coffee Machine in Gurgaon. 09873633436
Coffee Vending Machine in gurgaon
Vending Machine in Gurgaon

T-shaped front points are designed for excellent penetration of hard ice and comfort on mixed terrain, while providing solid purchase in snow
Petzl ICE AXES Quark price in Mumbai
Petzl CRAMPONS Sarken price in Mumbai

https://tajendrasengar.blogspot.com/2010/02/starting-my-iditarod.html?showComment=1636614969704#c3883916061308882231
https://tajendrasengar.blogspot.com/2011/10/distance-between-two-locations-with.html?showComment=1636614978756#c1022465967706585882
https://tajendrasengar.blogspot.com/2011/10/how-to-write-html-code-inside-blogger.html?showComment=1636614988460#c2699402435038729607
https://tajendrasengar.blogspot.com/2011/10/googles-new-web-programming-language.html?showComment=1636615000146#c8725957282607187515
https://tajendrasengar.blogspot.com/2011/10/how-to-stop-function-inlining.html?showComment=1636615010786#c423651027877727528

Boxing Stars Mod Apk is designed with boxing fighters in mind. It is very good for fans of boxing and provides some superb graphics for the players. One of the coolest features of the mod is that players can choose from a selection of different boxers and use them against each other in various competitions like the World Boxing Cup.
https://apkmodule.com/boxing-stars-mod-apk/

Post a Comment