Social Networking :: Google Map API - Get Distance In Miles Instead Of Kilometers (KM)
May 7, 2015
Following the series of question, this is the code as of now has been developed and working fine. Now need to make some more tweek with this
1. Instead of distance from source to destination in KM can we have it in Miles
2. I need to show the distance between source and destinace only if destination falls under 25 mile radius from source else need to show the label message that no record found.
Here is the code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="sqlmap.aspx.cs" Inherits="sqlmap" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
[Code] ....
C# file
-----
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
I used a Google Maps Distance Finder API that comes with two textboxes, one for the source, and one for the destination. It also comes with a button, that when clicked, will find the distance between the two locations using the funciton GetDistance(). The code before the function initializes the map. I created another button and used VB.Net to run SQL code first, and then to automatically populate the two textboxes, then I had it call the function GetDistance().
The issue I ran into is that the function won't calculate the distance, and the map never changes from its default state. I believe it's because it's not running the code that initializes the map. (I could be wrong) I have tried WebBrowser1, to call the click of the button, but I had to Inherit Forms, which I can't do, and I have also tried adding the top code into the GetDistance() function. Is it possible to call the initializing code before GetDistance()?
Here is the JS function code:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script> <script type="text/javascript"> var source, destination; var directionsDisplay; var directionsService = new google.maps.DirectionsService(); google.maps.event.addDomListener(window, 'load', function () {
[Code] ....
Here is the VB Code I use to call the JS Function:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim cn As New OleDb.OleDbConnection("Provider = Microsoft.ACE.OleDb.12.0;" & _ "Data Source=|DataDirectory|Address Database One Calculation.mdb") cn.Open() Dim cmd1 As OleDb.OleDbCommand Dim sqlconnection1 As String
[Code] .....
For reference, here is the explanation of the full API Code: [URL] ....
var from_Lati = 19.132324234 // from latitude var from_longi = 19.11233334 // from longitude
and I have TO latitude and Longitude in Array as
var To_Lati = [18.132323,18.90941,18.31232423] // to latitude in array var To_Longi = [18.2132123,18.242423,18.43243] // to longitude in array
I have gone through many reference on internet but can't find the solution for calculating the distance with respect to array.. Now I want to find the distance between them using JavaScript...
I want to create a google maps that it can Calculate Distance, Travel Duration, draw (plot) Route between two locations and display Directions. Now I want to hide Directions Panel.
URL....This link shows a demo that let user to put origin and destination then get direction. I want to know how to add a option which is let user to use their current location as origin location (Location from).
All the facebook, twitter & LinkedIn api are working properly i have integrated this into my project. But still google api code is not findin in your site.
I need to implement google analytics in my asp.net website where I can see all website visits, Bounce Rates, Unique Visitors, Page Views, Country, etc from my website admin panel.
Is there any way to install google plugin's in .net. for e.g. if chinese wan't there content should display in there language then it should display on one click
I'm trying to make a web application to create a google route map for a ride. In which I want to map the Marker places as a support station on given route how can I do this.
I am implementing google translate in my asp.net through that we can translate our website to 60 more language but when I implement totally my alignment is changing so what to do now?