Google maps help
Google maps help
I want to use google maps in my site developed using visual studio(.net). I have found the code and learnt how to use it. Now I want to open the map in a new windows when a button is clicked. Since the google maps code is a javascript code I don't know how to use it with a button click (I am new to programming). I also want to pass two parameters from the database to use in coordinates of the map. what is the proper way to do this.
Re: Google maps help
Though there are some guys who fetch Google map images from web for offline use, according to my memory it is illegal (Google only allows fetching their maps online). I came across a nice .Net cotrol written for Google Maps in CodeProject. I'm sure it will give you some help. Lat Lays Flat - Part 1 : A Google Maps .NET Control.
Re: Google maps help
I'm not using them Offline. I'm using the code given by Google themselves. I just need to know how to open the map in a new window when a button click is performed.
Re: Google maps help
Looks like you want to open a map in a new window. For this you will have to get familiarized with Google Maps API. It's easy.
Then you will need to add code to open up a new window and pass the coordinates to it as query strings or using any other method. I do not have ASP.NET installed to give it a try. The installer is giving an error. I will check if i could install it.
Then you will need to add code to open up a new window and pass the coordinates to it as query strings or using any other method. I do not have ASP.NET installed to give it a try. The installer is giving an error. I will check if i could install it.
Re: Google maps help
Hello
Try this sample. May help you out. Make sure to add your APIKEY to the script which is in the MapWindow.aspx
Thanks
Try this sample. May help you out. Make sure to add your APIKEY to the script which is in the MapWindow.aspx
Thanks
Last edited by Neo on Tue Oct 11, 2011 10:13 am, edited 1 time in total.
Reason: Attachment added to post
Reason: Attachment added to post
Re: Google maps help
The code I use don't ask for a API key. This is the code
Instead of hard coding the coordinates I want to pass them from a database. I can't call this javascript code from a button click in Visual Studio
Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=true">
</script>
<script type="text/javascript">
function initialize() {
var myLat = 6.581481;
var myLng = 79.96459;
var latlng = new google.maps.LatLng(myLat,myLng);
var myOptions = {
zoom: 17,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
Re: Google maps help
Hi
Made some alterations for the code. Try this.
Made some alterations for the code. Try this.
Re: Google maps help
I also had time to do some modifications. Had little help from http://www.mikeborozdin.com/post/Workin ... SPNET.aspx
Re: Google maps help
Thank a ton guys. This is exactly what I wanted
You guys were so helpful. Thanks again.
You guys were so helpful. Thanks again.