Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

asp.net google maps

Posted on 2010-08-20
3
Medium Priority
?
596 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 600 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 1400 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

660 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