Solved

asp.net google maps

Posted on 2010-08-20
3
591 Views
Last Modified: 2012-05-10
Hello experts

(1) I have latitude and longitude for every store saved in the database.
Example
storeID, storeName, latitude, longitude
100, ABC Store, 23.3323,236523
200, XYZ Store, 56.325,65.236

(2) I am passing storeID in url as query string to the locator page(locator.aspx)
Sample URL
http://www.myWebsite.com/locator.aspx?storeID=100

(3) On the page load method of locator.aspx page, I can query the database and get the latitude and longitude of the store.

In the page load method

string storeID = Request.QueryString["storeID"].ToString()
string latitude="";
string longitude="";

//Query the database with with storeID and get the latitude and longitude of the store.

I will have
latitude = 23.3323 and longitude=236523

I have a div tag on the aspx page
<div id="map_canvas" style="width:250px; height:250px"></div>

I want to show this latitude and longitude on the google map.

How do i do ?

Thanks




































0
Comment
Question by:neetu2008
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Expert Comment

by:gbarcalow
ID: 33486836
0
 
LVL 5

Assisted Solution

by:muhammadyasir
muhammadyasir earned 150 total points
ID: 33486866
Add a literal to your page and assign this in your page load like this.


Literal.Text ="<script type="text/javascript" src="http://www.google.com/jsapi?key=ABCDEFG"></script>
<script type="text/javascript">
  google.load("maps", "2.x");
   
  // Call this function when the page has been loaded
  var map = new google.maps.Map2(document.getElementById("map_canvas"));
  map.setCenter(new google.maps.LatLng("+Latitude+", "+Longitude+"), 13);   <=== Here is your lat long strings
    
</script>";

Open in new window

0
 
LVL 3

Accepted Solution

by:
gbarcalow earned 350 total points
ID: 33487028
Google gives you the info you need to embed a map, find the ll= tag and inject your long and lat.


Adding this code to any web page will give you a amp at long 47.128082 lat -122.21466

Easiesy way it to go to maps.google.com, find the zoom you want, click the link button then copy the 'Paste to HTML to embed in website' text. Also available is the 'Customize and preview embedded map' to change map size.
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&amp;ll=47.128082,-122.214661&amp;spn=1.244538,1.83197&amp;t=h&amp;z=9&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/?ie=UTF8&amp;ll=47.128082,-122.214661&amp;spn=1.244538,1.83197&amp;t=h&amp;z=9&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>

Open in new window

0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question