Shabdar.org
Webshabdar.org
Google Maps Control for ASP.Net - Part 2 PDF Print E-mail
Written by Shabdar   
Sunday, 23 November 2008 22:32

Free Open source Control

Google Map Control for ASP.Net

Introduction

This is second part in two part series of my article Google Maps User Control for ASP.Net. In first part Google Maps Control for ASP.Net - Part 1 I have explained how to use this control in your ASP.Net application. In this part I am going to explain source code of this user control so that you can modify it for your own use.

Diagram

Google Map Control Logical Diagram

Diagram above shows working flow of this user control. I will explain you one by one each element in this diagram.

ASPX page with Google Map User Control

  • As I mentioned in part 1, we need to initialize few properties of this user control to make it work. These properties are initialized in Page_Load() event of ASPX page.
    protected void Page_Load(object sender, EventArgs e)
        {
            //Specify API key
            GoogleMapForASPNet1.GoogleMapObject.APIKey = 
                        ConfigurationManager.AppSettings["GoogleAPIKey"]; 
    
            //Specify width and height for map.
            GoogleMapForASPNet1.GoogleMapObject.Width = "800px"; 
            // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet1.GoogleMapObject.Height = "600px";
    
            //Specify initial Zoom level.
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 14;
    
            //Specify Center Point for map. 
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = 
                            new GooglePoint("1", 43.66619, -79.44268);
    
            //Add pushpins for map.
            //This should be done with intialization of GooglePoint class.
            //In constructor of GooglePoint, First argument is ID of this pushpin. 
            //It must be unique for each pin. Type is string.
            //Second and third arguments are latitude and longitude.
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(
                                    new GooglePoint("1", 43.65669, -79.45278));
          }
    
  • When you initialize these properties, they gets stored in GOOGLE_MAP_OBJECT session variable. Later on this session variable is accessed by GService.asmx web service to draw google map.
  • Go to source of GoogleMapForASPNet.aspx.cs file. Check Page_Load() method.
        protected void Page_Load(object sender, EventArgs e)
        {
            .
            .
            .
            if (!IsPostBack)
            {
                Session["GOOGLE_MAP_OBJECT"] = GoogleMapObject;
            }
            else
            {
                GoogleMapObject = (GoogleObject)Session["GOOGLE_MAP_OBJECT"];
                .
                .
                .
    

    As you can see, I am storing GoogleMapObject property in a session variable if this is a first time load of page. If this is a post back then I use existing session variable value and assign it to GoogleMapObject property.

User Control (GoogleMapForASPNet.ascx)

  • GoogleMapForASPNet.ascx file contains a &ltDIV> element with ID=GoogleMap_Div. Google map is drawn on this &ltDIV> element
  • GoogleMapForASPNet.ascx is responsible for calling DrawGoogleMap() javascript function on page load. If you see source of GoogleMapForASPNet.ascx.cs file, it contains following lines in Page_Load() event.
    Page.ClientScript.RegisterStartupScript(Page.GetType(), "onLoadCall", " 
                                                if (window.DrawGoogleMap) { DrawGoogleMap(); } 
                                                ");
    

    This causes DrawGoogleMap() function to get fired.

GoogleMapAPIWrapper.js

  • This javascript acts as a wrapper between ASP.Net calls and Google Maps Core API functions.
  • When DrawGoogleMap() function is called, it calls web service method GService.GetGoogleObject() to get session variable values.
  • Once different parameters are retrieved from session variable, it will start calling Google Maps core API functions to draw a map.

Web Service (GService.asmx)

  • As I have mentioned before, GService.GetGoogleObject() and GService.GetGoogleObjectOptimized() are functions defined in GService.asmx file.
  • These functions retrieves Google Map parameters from session variable.

How to define a Web Service Method

  • This control uses Web Service Methods to get values from a session variable. These methods are defined in Gservice.cs(GService.asmx code behind) file.
  • Go to source of GService.cs file. Observe how GetGoogleObject() web method is defined.
        [WebMethod(EnableSession = true)]
        public GoogleObject GetGoogleObject()
        {
            GoogleObject objGoogle =  
                (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];
    
            System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"] = 
                                                              new GoogleObject(objGoogle);
            return objGoogle;
        }
    

    Return value type from this method is GoogleObject.

How to call ASP.Net function (Web service method) from Javascript using a Web Service

  • If you go to HTML source of GoogleMapForASPNet.ascx file, you will see that I am using <ScriptManagerProxy> control.
    When &ltServiceReference> is used with &ltScriptManagerProxy> or &ltScriptManager> controls, it allows you to use web service methods defined in code behind.
  • Go to source of GoogleMapAPIWrapper.js file. Observe how I am calling a web service method in DrawGoogleMap() function.
    function DrawGoogleMap()
    {
        if (GBrowserIsCompatible())
        {
        map = new GMap2(document.getElementById("GoogleMap_Div"));
        geocoder = new GClientGeocoder();
      
         GService.GetGoogleObject(fGetGoogleObject);
        }
    }
    

    GService.GetGoogleObject() is a web service method. fGetGoogleObject() is a javascript function that should be called once web service method returns.
    function fGetGoogleObject(result, userContext)
    {
        map.setCenter(new GLatLng(result.CenterPoint.Latitude, 
                            result.CenterPoint.Longitude), result.ZoomLevel);
        
        if(result.ShowMapTypesControl)
        {
            map.addControl(new GMapTypeControl());
        }
        .
        .
        .
    

    result is return value from web service method GService.GetGoogleObject(). Thus result is of type GoogleObject. You can access properties of result in javascript to get map parameters.

Difference between GetGoogleObject() and GetGoogleObjectOptimized()

  • Both of these methods work in similar fashion. GetGoogleObject() is called when page loads for first time. It returns all of the GoogleObject properties to javascript function. While GetGoogleObjectOptimized is called on postback. It does not return all of the properties. Instead it returns minimum properties required to make a change in existing map.
  • If you view source of GoogleMapAPIWrapper.js file, there are two functions defined in it as below,
    function endRequestHandler(sender, args)
    {
        GService.GetOptimizedGoogleObject(fGetGoogleObjectOptimized);
    }
    function pageLoad()
    {
        if(!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack())
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
    }  
    

    These function causes GService.GetOptimizedGoogleObject() to get fired when an AJAX call finishes. For example let's say you have a button in an UpdatePanel. When you click it, it postbacks the page. When this postback completes, above function will get fire.

Functions defined in GoogleMapAPIWrapper.js

  • To make this article short, I don't want to explain each and every function defined in this file. Instead I will explain important functions only. If you want more details for any code that's not explained here, you can post your questions in Comments section..
  • function CreateMarker(point,icon1,InfoHTML,bDraggable,sTitle)
    {
        var marker;
            marker = new GMarker(point,{icon:icon1,draggable:bDraggable,title: sTitle});
        if(InfoHTML!='')
        {
            GEvent.addListener(marker, "click", function() { this.openInfoWindowHtml(InfoHTML); });
        }
            GEvent.addListener(marker, "dragend", function() {  
                GService.SetLatLon(this.value,this.getLatLng().y,this.getLatLng().x);
                RaiseEvent('PushpinMoved',this.value);  });
        return marker;
    }
    

    This function creates a marker on Google Map. As you can see, I am adding two events with each marker. First one is click(). When a user clicks on marker, a balloon (info window) pops up. This is a javascript event. Second one is dragend(). If a user wants he can drag a pushpin to a new location. This will cause a web method GService.SetLatLon() to get executed. This method sets new latitude and longitude values in Session Variable. As you can see this function also calls RaiseEvent() function which causes an AJAX postback.
    function RaiseEvent(pEventName,pEventValue)
    {
    document.getElementById('').value = pEventName;
    document.getElementById('').value = pEventValue;
    __doPostBack('UpdatePanel1','');
    }

    When postback finishes, new latitude and longitude values will be picked up from Session Variable.
  • function RecenterAndZoom(bRecenter,result)

    This function causes Recentering of map. It finds all visible markers on map and decides center point and zoom level based on these markers.
  • function CreatePolyline(points,color,width,isgeodesic)

    This function creates polylines between given points. See Polylines property in GoogleObject class.
  • function CreatePolygon(points,strokecolor,strokeweight,strokeopacity,fillcolor,fillopacity)

    This function creates polygons between given points. See Polygons property in GoogleObject class.

How to define Icons for google map

  • If you see implementation of fGetGoogleObject() and fGetGoogleObjectOptimized() javascript functions, you can see that I am creating custom icons for google map. This is how they are defined.
        .
    .
    myIcon_google = new GIcon(G_DEFAULT_ICON);
    markerOptions = { icon:myIcon_google };

    myIcon_google.iconSize = new GSize(result.Points[i].IconImageWidth,
    result.Points[i].IconImageHeight);
    myIcon_google.image = result.Points[i].IconImage;
    myIcon_google.shadow = result.Points[i].IconShadowImage;
    myIcon_google.shadowSize = new GSize(result.Points[i].IconShadowWidth,
    result.Points[i].IconShadowHeight);
    myIcon_google.iconAnchor = new GPoint(result.Points[i].IconAnchor_posX,
    result.Points[i].IconAnchor_posY);
    myIcon_google.infoWindowAnchor = new GPoint(result.Points[i].InfoWindowAnchor_posX,
    result.Points[i].InfoWindowAnchor_posY);
    .
    .
  • There are various properties that you can set for a custom icon. Following article explains you each of these properties in detail.
    Making your own custom markers

Special Notes

I have published this article on www.codeproject.com as well. Here is the link to this article.

Google Maps Control for ASP.Net - Part 1

 

Comments/Questions

 

Thank you very much for this great web user control.

I have a one question here, how can i put some pins on client click. For example i want users to put only one pin on the map and there will be a save marker button when the user clicks on the button, the coordinates will be saved in database.

Thanks
=> Barbaros (Thursday 05-Jun-08 05:40 AM)

See my CreateMarker function. In this function I have defined a click event, which opens up a balloon. You need to add similar code for map click event. Somethink like this,

GEvent.addListener(map, 'click', function(overlay, latlng) {
var lat = latlng.lat();
var lon = latlng.lng();

Once you have lat/lon values, you can create marker based on these lat longs values

var point = new GLatLng(lat,lon);
map.addOverlay(new GMarker(point));

To save this new lat longs in database, you can define a webmethod and call it in javascript.

GService.SaveNewMarker(lat,lon);

=> Shabdar (Thursday 05-Jun-08 09:51 AM)


Can you provide a sample code to add a puspin when clicked on the map. i cannot invoke the createmarker code onclick of map
=> Prajith (Thursday 21-Aug-08 01:05 AM)



i did it like this in my way , can you suggest a better way,


Untitled Page

function display()
{
GEvent.addListener(map, "click", function(marker, latlng)
{
var inputForm3 = document.createElement("form");
inputForm3.setAttribute("action","");
inputForm3.onsubmit = function() { storeMarker(latlng); return false;};
var lng = latlng.lng();
var lat = latlng.lat();
inputForm3.innerHTML = ''
+ 'Add Transformer'
+ 'Transformer Name:'
+ ''
+ 'Transformer NO:'
+ ''
+ ''
+ ''
+ ''
+ '';
map.openInfoWindow (latlng,inputForm3);
});
}








Back


Google map with draggable pushpins.


Drag any pushpin and see changed latitude and longitude value at bottom of page.


=> prajith (Thursday 21-Aug-08 01:30 AM)



First, Thanks for a Nice collection of code.
But, when I use "MapWithDraggableIcons" I gets a Error in the following function:
Is Says "document.getElementById('')" dont return a valid Object.

I look forward to hear from you.
Regads
Thomas.


function RaiseEvent(pEventName,pEventValue)
{
document.getElementById('').value = pEventName;
document.getElementById('').value = pEventValue;
__doPostBack('UpdatePanel1','');
=> Thomas Olsen (Sunday 08-Jun-08 05:51 AM)
Thank you for reporting this. This was a bug. I have fixed it. You can download source code again.
=> Shabdar (Monday 09-Jun-08 10:22 AM)


Shabdar,

I see you already corrected it (I asked the same question on the codeproject site). I also found another solution.

I see you moved the RaiseEvent function out of the GoogleMapAPIWrapper.js and into the GoogleMapForASPNET.ascx.
To leave it in the .js file you can also do this:

Add script section after UpdatePanel:







var panelXXXYYY = '';
var hidEventName = '';
var hidEventValue = '';


Change RaiseEvent function in.js file to :

function RaiseEvent(pEventName,pEventValue)
{
document.getElementById(hidEventName).value = pEventName;;
document.getElementById(hidEventValue).value = pEventValue;
if(document.getElementById(panelXXXYYY) != null)
{
__doPostBack(panelXXXYYY,'');
}
}

Or something like this of course.

Regards,

Geert Veenstra
=> Geert Veenstra (Tuesday 10-Jun-08 04:57 PM)



Hi Shabdar,

I upgraded to your new v1.5 control, so far it looks great.

In v.1.4 I had added G_PHYSICAL_MAP map type, enableDoubleClickZoom, and enableScrollWheelZoom, and all worked great. I moved my code changes over into the new GoogleMapAPIWrapper,js file (see below) but none of the functions work now. Any ideas?

Chris

// Add the Terrain map type
map.addMapType(G_PHYSICAL_MAP);

map.setMapType(eval(result.MapType));
// Add zoom via mouse double click
map.enableDoubleClickZoom();
// Add zoom via mouse scroll wheel
map.enableScrollWheelZoom();
=> Chris Mangiapane (Wednesday 11-Jun-08 12:14 AM)
Hi

I corrected my own question; For those that might like to use the G_PHYSICAL_MAP map type, enableDoubleClickZoom, and/or enableScrollWheelZoom, the code snippnet above needed to be moved from fGetGoogleObjectOptimized to the fGetGoogleObject method in the new GoogleMapAPIWrapper,js file.

Shabdar, you might like to consider adding this functionality to the next release.

Chris
=> Chris Mangiapane (Wednesday 11-Jun-08 10:16 AM)


Thanks,

I will include this in next release.
=> Shabdar (Wednesday 11-Jun-08 11:57 AM)



When I send parameters to a aspx file this mymap.aspx?id=2
I got a Decode error in s = System.Web.HttpContext.Current.Request.MapPath(PageName).Split(new char[] { '' }); Becayse Pagename include th "?id=2"
I have changed this to solv the problem in cGoogleMap.cs:
public static string GetLocalPath()
{
string[] s = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.Split(new char[] { '/' });
string PageName = s[s.Length - 1];
int PageNameLength = PageName.IndexOf("?"); // New
if (PageNameLength != -1) // New
{ // New
PageName = PageName.Substring(0, PageNameLength);
} // New
s = System.Web.HttpContext.Current.Request.MapPath(PageName).Split(new char[] { '' });


string path = s[0] + "";
for (int i = 1; i < s.Length - 1; i++)
{
path = path + s[i] + "";
}


return path;

I hope you will aplly this to your code base !

=> Thomas Olsen (Wednesday 11-Jun-08 01:58 AM)
Thanks for this correction,

I will include this update in next release.
=> Shabdar (Wednesday 11-Jun-08 11:58 AM)


Hi Shabdar,

It seems to me that the call to GetLocalPath (and also GetHttpURL) is not really necessary.

I think this because in the IconImage set part you go through all this code, but at the end there is a line _icon = value; which makes all previous code unneeded ?

Or is all that code there just to make sure (check) that the bitmap really exists ?

Regards,

Geert Veenstra
=> Geert Veenstra (Tuesday 24-Jun-08 11:31 AM)



Is there a way to put a hyperlink inside the InfoHTML html text that contains javascript to fire a server-side event?

I one to add a 'Select' link in the InfoHTML. When clicked, it should fire a server-side event with that marker's information sent to the code-behind, so the server can change the marker icon and redraw the map.

Sure would appreciate a small example; I've been struggling with this one for days.

Chris
=> Chris Mangiapane (Saturday 14-Jun-08 08:36 PM)
Ok I answered part of my own question :) I added a 'Select' tag inside the InfoHTML. When clicked, it fires a server-side event and passes the marker's id. The server-side code records the selection and changes the marker icon color. BUT, the map does not redraw itself!

How do I direct the map to redraw itself?

The only work around I have found is to do a post-back --Response.Redirect("default.aspx")
=> Chris Mangiapane (Wednesday 25-Jun-08 11:00 AM)



GetLocalPath() in cGoogleMap.cs doesn't handle URLs with query strings.

ex:
'locate_dealer.aspx?zipcode=02360' is not a valid virtual path.

I did a second split on the ? to fix it.
=> Steve (Monday 16-Jun-08 08:31 AM)
Hi
Please see my reply =>
Thomas Olsen (Wednesday 11-Jun-08 01:58 AM)

Regards
Thomas Olsen.
=> Thomas Olsen (Tuesday 24-Jun-08 01:16 AM)



Hey, this is very useful and i love that you can dynamically set the push pins by longitude and latitude, but is there a way of setting them by a postcode? Or is there a simple way of getting the longitude and latitude values from a postcode?

Help with this would be invaluable. Thanks Si!
=> Simon Caine (Sunday 22-Jun-08 09:57 PM)
Hi

In denmark we use "," as the default seperator, but the converter function use systemet setting, it must be hardcodet to use "." as Seperator.
I made a small addon to Code:
public static double GetNumericValue(object pNumValue)
{
if ((pNumValue == null))
{
return 0;
}
System.Globalization.NumberFormatInfo GoogleFormat = new System.Globalization.NumberFormatInfo(); // New
GoogleFormat.NumberDecimalSeparator = "."; // New
if (IsNumeric(pNumValue))
{
return double.Parse((pNumValue.ToString()), GoogleFormat); // Updated.
}
else
{
return 0;
}


I hope you will use this in next release, or make your own type of code ;)
=> Thomas Olsen (Monday 23-Jun-08 05:36 AM)
I was hoping you'd show how to read an SQL table and get the Lng/Lat data as pushpins into your maps... Thank you!
=> Brian (Tuesday 24-Jun-08 03:08 PM)
I think most of the people know how to read an sql table and load values in variable. If not, there are plenty of examples on net.

I didn't want to make my sample to tightly bind with SQL Database. That's the reason I didn't include it in my samples as well.
=> Shabdar (Wednesday 25-Jun-08 09:12 AM)



There's an automated SQL geocoder out there already. While it isn't open-source, I'm fairly certain that it is free. Link: http://sql.geocoder.jetkey.com/
=> Mike (Monday 30-Jun-08 07:11 AM)



Is it possible to hide the map control on the page and then show it on the click of a Button ?
This button would be in another UpdatePanel on the same Page.

I tried it, but ran into a problem where the UpdatePanelXXXYYY could not be found (I don't know the exact message right now) ?

Regards,

Geert Veenstra
=> Geert Veenstra (Wednesday 25-Jun-08 11:06 PM)
Hi Shabdar

Has anyone taken a look a the GStreetviewOverlay in order to provide a map 'street view'?

Here is a nice glimpse at what it can do:
http://googlemapsapi.blogspot.com/2008/03/street-view-in-api-or-how-i-spent-my.html

Any plans to add this in upcoming versions?
=> Chris Mangiapane (Wednesday 02-Jul-08 11:01 AM)
I have a requirement as:
I want to add a Plane Map of India on a aspx Page. It should only show states boundaries. On clicking of a particular state it should get highlighted and i want to show some further information pertaining to that state, which is stored in database. How can i do that in visual studio 2005.
=> Gaurav (Thursday 03-Jul-08 12:29 AM)
Is it possible to use the Google Maps Control in SQL Server Reporing services 2005?

I have stored the coordinates in the DB and to jump to an URL. The parameter ( coordinates, Text ) should be transferd over the Hyperlink Address.

Or is there an other way ?
=> Peda (Thursday 03-Jul-08 07:10 AM)
HI,

I downloaded your component, started up VS2008 after updating to 3.5 the application run quite well.

I then tried the setup steps outlined above to create a new project and on build received a message that I was missing a Script Manager. I added one and the result was a blank page.

Do you have any suggestions on how to get started so that the default map displays?

Thanks In Advance,
James

=> James Hein (Thursday 10-Jul-08 01:50 AM)
I solved the problem by also adding the GoogleMapApiWrapper.js file to my project.

I have built Google Maps before inside plain HTMl but I am having problems making the transition to the ASP.NET version/implementation. Do you have any full examples of say how to implement a click to create a marker (I see the function in the included file) because I don't know how to 'wire' it all together in this environment.

I am also interested in basic functionality like clicking a few points and creating a polygon / line from those clicked points for example.

Thanks in advance
James.
=> James Hein (Thursday 10-Jul-08 03:21 AM)



Great article!I have to remember the latitude and longitude of the icons in sql table.I did it,but with one error,which come very rare.When I drag one icon everything is ok.But when I have two or more icons when i am dragging some of them the dragged before the last go to the "old" place and in the table the "old coordinates" are stored.But the last is stored with new coordinates.I can't understand why.
=> stefan (Friday 11-Jul-08 05:51 AM)
Hi again!I have another question.I make my error,but i have one question about the service.

public void SetLatLon(string pID, double pLatitude, double pLongitude)
{
GoogleObject objGoogleNew = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];
GoogleObject objGoogleOld = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"];
objGoogleNew.Points[pID].Latitude = pLatitude;
objGoogleNew.Points[pID].Longitude = pLongitude;
//objGoogleOld.Points[pID].Latitude = pLatitude;
//objGoogleOld.Points[pID].Longitude = pLongitude;
}
I marked this two lines an everything is ok.What is the purpose of them.

I marked them because i think that the GetOptimizedGoogleObject() can't understand about the changet point location.
=> stefan (Friday 11-Jul-08 09:15 AM)
Is it possible to use this in a Web Application VS2005? I have spent quite a few hours trying. First I recieved the GService is undefined error and seam to have gotten past that by adding Inline scripts = true



But now I get Error: no element found
Source File: http://localhost/website/GService.asmx/GetGoogleObject
Line: 1

I see the div with the Google logo on the bootom but no map

Any ideas would be appreciated
=> Dave (Tuesday 15-Jul-08 07:46 PM)
I figured this out and it does work on a Web Application Project. First do not use InlineScript = "true" as shown above. The GService is undefined error was being caused by the fact I was doing a url rewrite for the pages in the global.asax Application_BeginRequest which was causing the errors with GService.asmx.

By removing this for .asmx extentions everthing is working fine.

if (Request.Path.IndexOf(".asmx") == -1)
{
// do page rewrite function
}

Hope this may help someone out as it took me quite some time to figure it out.

Great control!!!

Thanks,
Dave
=> Dave (Wednesday 16-Jul-08 09:22 AM)



Have you thought about incorporating this?

"If you have an existing Maps API site, you can 3D-enable your page with as little as one line of code."
=> Brian (Wednesday 16-Jul-08 09:36 AM)
I noticed the following behavior in your example "Google Map with Draggable pushpins"
when you zoom in and move the pushpin to a new location the map will zoom out to the original zoom level. Is there a way to keep it from doing that?
I have tried to set the zoomlevel (GoogleMapForASPNet1.GoogleMapObject.ZoomLevel) to different values in different places of the script
- load page area (doesnt seem to change the zoomlevel)
- in OnPushpinMoved

It seems that it still will go back to the original zoomlevel

Any suggestions how to fix this?

Thanks for a nice google map control
=> Islandhopper8 (Saturday 19-Jul-08 12:33 PM)
First you have to find the function RecenterAndZoom in the GoogleMapAPIWrapper.js file, then you have to comment the following lines:

//var iZoomLevel = map.getBoundsZoomLevel(bounds);
var point = bounds.getCenter();
// if(iZoomLevel>14)
// {
// iZoomLevel = 14;
// }
if(cnt<=0)
{
point = new GLatLng(result.CenterPoint.Latitude,result.CenterPoint.Longitude);
// iZoomLevel =result.ZoomLevel;
}
// map.setZoom(iZoomLevel);
map.setCenter(point);

also check this in the function IgnoreZeroLatLongs at the beginning of the same file

// var iZoomLevel = map.getBoundsZoomLevel(bounds);
var point = bounds.getCenter();

// map.setZoom(iZoomLevel);
map.setCenter(point);

then try it
=> Gabriel Baldeon (Thursday 16-Oct-08 01:07 PM)



Hi,
I am facing the problem to draw Poly line on the GMap. i.e I am able to draw up to 15 Lan&Lat values, if above I am not able to draw line dynamically.
Here I am retrieving the Lag & Lat values dynamically from Sql-Server.
Even here I am mentioning the error which I am getting….




Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'GetGoogleObject' failed with the following error: System.InvalidOperationException-- Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.




Thanks & Regards,
Hanu
=> Hanu (Monday 21-Jul-08 08:42 AM)
I am having the same problem. Was anyone able to resolve this?
=> Tejal Gandhi (Thursday 30-Oct-08 11:57 AM)



Hi all!
I need help.I am not familiar with Javascript and want to ask something about Polylines.Can i create a InfoHTML for a polyline,when it is clicked or mouseover to show some info?
Thanks
=> stefoto (Monday 21-Jul-08 09:19 AM)
I just wanted to say that I enjoyed reviewing and using this control. I have successfully implemented it with minor changes. A previous post mentioned having to change the "GetLocalPath" function. However, it didn't work so I changed it to the following which fixed it.


public static string GetLocalPath()
{
string[] s = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.Split(new char[] { '/' });
string PageName = s[s.Length - 1];
int PageNameLength = PageName.IndexOf("?");
if (PageNameLength != -1)
{
PageName = PageName.Substring(0, PageNameLength);
}
s = System.Web.HttpContext.Current.Request.MapPath(PageName).Split(new char[] { '//' }); //NEW because '' is not valid char

string path = s[0] + ""; //places proper backslashes
for (int i = 1; i < s.Length - 1; i++)
{
path = path + s[i] + ""; // new
}
return path;
=> brent (Monday 28-Jul-08 10:37 AM)
Do you do any custom development? I have a Google Maps project I would like to be completed.
Thanks,
Steve
=> Steve (Monday 04-Aug-08 10:45 AM)
Hi
We do Google Map project, please provide me with your project details, we'll send you an offer.

Please contact me at "tol (a-NoSpam) promobil.dk"

Regards
Thomas Olsen.
=> Thomas Olsen (Tuesday 05-Aug-08 01:58 AM)



Hi;
Thanks for the great control. I wonder if i can get geocodes of any point i click on the map.
=> Burak (Friday 15-Aug-08 09:52 AM)
Hi Shabdar. Great google map control but there is a runtime error if i use this control with the browsers(IE,FF).
I downloaded the newest Version from here: downloads/GoogleMapControl.zip

If i click one time with the right mouse button on the map, this runtime error appears:
line: 784
Error: 'this.ff.width' is Null or not an object

This is the line (main.js):
Uj.prototype.Ow=function(a){return new N(a.x+this.ff.width,a.y+this.ff.height)};

Thanks,
=> Quang (Thursday 21-Aug-08 03:15 AM)
I met this error,too.Admin can explain for us? :(
Thanks!
=> John (Saturday 23-Aug-08 01:22 PM)



Hi,
I have same problem, I discover that situation occurs when no markers on the map.
=> DDdeveloper (Wednesday 10-Sep-08 08:49 AM)



Hi there, looks to be a great control but I can't seem to get your control to work.

if (hidEventName.Value == "PushpinMoved")
{
//Set event name to blank string, so on next postback same event doesn't fire again.
hidEventName.Value = "";
OnPushpinMoved(hidEventValue.Value);


This line doesn't seem to work, sine the hidEventName is in the contentTemplate, so it can't be accessed, or am I doing something wrong?

Cheers, Sarkie.
=> Sarkie (Friday 22-Aug-08 04:06 AM)
thank you
=> xna (Wednesday 03-Sep-08 09:39 AM)
hi.,
*I am having some problems in writing to databases... can u show me a sample test page where database connection is used
and the database design too..
*is it possible for me to convert a text file with lat and lang to a organized XML file.
thanks
=> hussain (Thursday 04-Sep-08 02:39 AM)
Thank You very much for your great control,I want to say that it
is the greatest one as I ever seen before.you save my life,you are
the god.
=> intrepid (Friday 05-Sep-08 12:43 AM)
H! Great article.
I have two questions.1-Can I use this without webservice?
and 2-I want a image from DBase along with text to b displayed in a bubble that comes when user click the pin.
For first question I tried to write methods in the code-behind file and using "PageMethods" I called them from javascript.Functions get called ,but with some script errors.
Can you comment on it please.
=> Nirav (Thursday 11-Sep-08 12:09 AM)
One More Problem
When I add more(50+) points on map it takes too long to get loaded.
What to do when we have thousands of loactions to be pointed on the map.
=> Nirav (Thursday 11-Sep-08 02:55 AM)
Thanks for a great control. In my part of the world (Kenya) we get some pretty lousy internet connections. When a connection fails partway the javascript fails at

if(GBrowserIsCompatible())

Now I can either move this into a try..catch block, or test that the function is instantiated first with

if(GBrowserIsCompatible)

I need to bubble this error up into an error event for the control that I can handle in the calling program.

The problem is that what I know about JavaScript is dangerous and I'd be very grateful for any suggestions you may have.

Regards Bob Morris
=> Bob Morris (Wednesday 17-Sep-08 01:47 PM)
This thing is awsome!!! Thank you so much. The only thing I am missing is Street View. Anyway to do this?
=> Dale (Thursday 25-Sep-08 08:53 AM)
First of all, great article. I have a question about Geocoding. I keep getting a 'request timed out' error when entering Seattle, WA in the GooglePoint address property. Its pretty much straight from the sample. Perhaps I'm doing something wrong. Any suggestions?
=> Sancho (Tuesday 07-Oct-08 03:23 PM)
Hi, you made a great job... It's very usefull control. But i've got a question, i try to get the ID of a point when i click on it to show it in a label...As you do with the pushpin moved. Is there a way to get back and handle the informations from the bubble???? Please answer me if you have any idea or anyone else got any idea...

Thank you.
=> panos (Wednesday 19-Nov-08 07:10 AM)
If I want to display a point's infoHTML by default, how would I do that? Whenever a point has some infoHTML, it should be displayed. How this can be done?
=> Sanket Apte (Saturday 29-Nov-08 11:51 PM)
Thank you very much for this great web user control.
How do I plot routemap or polyline based on some langitude and longitude values in a looop.

Any one please advice or guide me to any URL...of doumentation please..

thanks

venky
=> venky (Tuesday 02-Dec-08 12:58 PM)
Dear Shabdar,

Thanks for the great control....

I've got some queries...

How can I get the Latitude & Longitude of a point clicked on the map.

Thanks,
Yogesh J S
=> Yogesh (Wednesday 03-Dec-08 03:14 AM)
I was wondering if you have worked on the getBounds or adding the ability to get directions yet?

Charles
=> Charles Ralston (Thursday 04-Dec-08 02:51 PM)
No...
=> Yogesh (Thursday 04-Dec-08 10:29 PM)



Comments
Add New Search
+/-
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
Please input the anti-spam code that you can read in the image.
oksi |206.186.126.xxx |2009-03-31 06:04:16
Thank you for your article and the great control.



Can you please provide an example of receiving Address if you now lat and long?

jim kalis |77.83.147.xxx |2009-04-20 21:58:49
Dear Shabdar,

Thanks for the great control....

I've got some queries...

How can I get the Latitude & Longitude of a point clicked on the map.

Thanks,
Jim Kalis
Shabdar  - Admin |198.96.180.xxx |2009-05-07 04:49:58
jim kalis,

To find latitude and longitude information when you click
mouse on map, do following.

Go to GoogleMapAPIWrapper.js file. Look
for function DrawGoogleMap(). Add following line at the end of this function.

GEvent.addListener(map,"click",MapClickFun ction);

Add following function in GoogleMapAPIWrapper.js file.

function MapClickFunction (overlay,latlng)
{
if (latlng)
{

alert(latlng.lat()+","+latlng.lng());
}
}


This will alert you latitude and longitude information whenver you click
on map.
chintan  - To find Area information when you click.Pls tell m |219.64.34.xxx |2009-05-21 01:47:05
Shabdar wrote:
jim kalis,



To find latitude and longitude information when you click

mouse on map, do following.



Go to GoogleMapAPIWrapper.js file. Look

for function DrawGoogleMap(). Add following line at the end of this function.



GEvent.addListener(map,"click",MapClickFun ction);



Add following function in GoogleMapAPIWrapper.js file.



function MapClickFunction (overlay,latlng)

{

if (latlng)

{



alert(latlng.lat()+","+latlng.lng());

}

}




This will alert you latitude and longitude information whenver you click

on map.
roshan  - programmer |86.96.227.xxx |2010-01-11 01:33:31
how can i get the latitide and longtitude information when i click on the
pushpins
chintan  - To find Area information when you click |219.64.34.xxx |2009-05-21 01:49:03
Pls tell me if i click one particular area in say mumbai than how to get that
area name.
Shabdar  - admin |198.96.180.xxx |2009-05-21 03:55:18
To get area name(or address) where you click map, first you need to find
latitude and longitude where you have clicked. See my previous post on how to
find this point(latitude/longitude). Then you need to do reverse geocoding of
this point. Go to following link and download reverse geocoding javascript
library

http://www.zeali.net/zpages/Google_Maps_API_Rev...

Study examples on above site to know how to geocode a latitude and longitude
information. That will give you full address of the place where you have clicked
on the map.
chintan  - Re: To find Area information when you |219.64.34.xxx |2009-05-21 23:22:24
First of all gr8 application to work with.Thanks for this.



I went thr the link mentioned where i found they are doing reverse geocoding
with javascript.But this reverse geocoding info is not available for India.



Is there way out to get area information by applying patch in javascript of this
application.
Rajni  - Error in js file method: GBrowserIsCompatible() |125.19.11.xxx |2009-05-21 22:56:36
Hi,

very nice article, i am using this control and follow the steps which u defined
in part1 but browser is not showing anything. there is blank page. Please Help
me. For that i copied js file into my project but now it gives me error in js
method: GBrowserIsCompatible().





please help me.
Dima  - Fixes |213.33.221.xxx |2009-05-24 03:39:55
Hi!

I have really enjoyed the control, but I've also made some changes, maybe usable
for others.

1. First of all, I moved GMap control initialization from script body to
initialize function, which is fired by body onload event. This change prevents
web request hanging with Firefox browser and adds compatibility with MS IE 6.0.
Don't forget to modify your body tag to launch GUnload on unload event and
Initialize() on load - I did it using body tag runat="server" attribute
and custom attribute adding in the control initialization itself.

2. I've also found some odd code (commented) - it prevented me from using outer
icons:

public string IconImage
{
get
{
return _icon;
}
set
{

//Get physical path of icon image. Necessary for Bitmap object.
/*string sIconImage = value;
if (sIconImage == "")
return;
string ImageIconPhysicalPath = cCommon.GetLocalPath() +
sIconImage.Replace("/", "\\");
//Find width and height of icon using Bitmap image.


using (System.Drawing.Image img =
System.Drawing.Image.FromFile(ImageIconPhysicalPat h))
{
IconImageWidth = img.Width;
IconImageHeight = img.Height;
}
_icon = cCommon.GetHttpURL() + sIconImage;

*/
_icon = value;
}
}

Anyway, the control is great and helpful!

Kind regards,
Dmitry
ipaman |96.10.249.xxx |2009-06-18 04:15:43
is there a way to capture a double click or a right-mouse event so I can bring
up a menu for the user to select?

I want to have a handler method on my code-behind that can get these events.



Thx,

ipaman
Tommy  - Map Boundary |208.110.214.xxx |2009-06-30 06:32:26
Terrific tools. A question, is there any way I can get boundary of map? There is
only center point property of map control. How can I get to know the boundary
coordinates?Anyone?

Thanks
Paul Johnston  - One little question |194.106.151.xxx |2009-07-06 22:18:49
Hi this is a fantastic example for using google maps in asp well done. i am
using a map which refreshes the puspins every 10 seconds for a db. the only
thing is that when it refreshes it returns to the original center and zoom
level. i have tried without success to fix this any tips



thanks

Paul
ashraf tammam  - Draggable |217.52.250.xxx |2009-07-13 05:44:52
Hello



i tried to change .draggable property for a displayed marker. it is not working
till i changeth altitude of this marker. any fix ??????



regards
ashraf tammam |217.52.250.xxx |2009-07-13 05:46:02
Hello



i tried to change .draggable property for a displayed marker. it is not

working till i changed the latitude of this marker. any fix ??????



regards
Vincent Blain  - Dev |209.78.110.xxx |2009-08-03 16:14:19
Google Driving Directions



GoogleMapForASPNet.asx



line 281 add



if (result.ShowDirections) {

//Direction

gdir = new GDirections(map, document.getElementById("directions_canvas"
;));

GEvent.addListener(gdir, "load", onGDirectionsLoad);

GEvent.addListener(gdir, "error", onGDirectionsErrors);

gdir.load("from: " + result.Directions.FromAddress + " to: " +
result.Directions.ToAddress, { "locale": result.Directions.Locale });

}



Line 436 add



function onGDirectionsErrors() {

if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)

alert("No corresponding geographic location could be found for one of the
specified addresses. This may be due to the fact that the address is relatively
new, or it may be incorrect.\nError code: " + gdir.getStatus().code);

else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)

alert("A geocoding or directions request could not be successfully
processed, yet the exact reason for the failure is not known.\n Error code:
" + gdir.getStatus().code);



else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)

alert("The HTTP q parameter was either missing or had no value. For geocoder
requests, this means that an empty address was specified as input. For
directions requests, this means that no query was specified in the input.\n
Error code: " + gdir.getStatus().code);



// else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)
Vincent Blain  - dev |209.78.110.xxx |2009-08-03 16:27:18
part 2



else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)

alert("A geocoding or directions request could not be successfully
processed, yet the exact reason for the failure is not known.\n Error code:
" + gdir.getStatus().code);



else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)

alert("The HTTP q parameter was either missing or had no value. For geocoder
requests, this means that an empty address was specified as input. For
directions requests, this means that no query was specified in the input.\n
Error code: " + gdir.getStatus().code);



// else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)
Vincent Blain |209.78.110.xxx |2009-08-03 16:29:52
part 2 (ignore previous)



else if (gdir.getStatus().code == G_GEO_BAD_KEY)

alert("The given key is either invalid or does not match the domain for
which it was given. \n Error code: " + gdir.getStatus().code);



else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)

alert("A directions request could not be successfully parsed.\n Error
code: " + gdir.getStatus().code);



else alert("An unknown error occurred.");

}
Vincent Blain |209.78.110.xxx |2009-08-03 16:30:16
part 2 (ignore previous)



else if (gdir.getStatus().code == G_GEO_BAD_KEY)

alert("The given key is either invalid or does not match the domain for
which it was given. \n Error code: " + gdir.getStatus().code);



else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)

alert("A directions request could not be successfully parsed.\n Error
code: " + gdir.getStatus().code);



else alert("An unknown error occurred.");

}
Vincent Blain |209.78.110.xxx |2009-08-03 16:30:45
part 2 (ignore previous)



else if (gdir.getStatus().code == G_GEO_BAD_KEY)

alert("The given key is either invalid or does not match the domain for
which it was given. \n Error code: " + gdir.getStatus().code);



else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)

alert("A directions request could not be successfully parsed.\n Error
code: " + gdir.getStatus().code);



else alert("An unknown error occurred.");

}
Vincent Blain |209.78.110.xxx |2009-08-03 16:36:36
part 2 (ignore previous)



else if (gdir.getStatus().code == G_GEO_BAD_KEY)

alert("The given key is either invalid or does not match the domain for
which it was given. \n Error code: " + gdir.getStatus().code);



else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)

alert("A directions request could not be successfully parsed.\n Error
code: " + gdir.getStatus().code);



else alert("An unknown error occurred.");

}
Robert  - Multiple maps interfering? |87.208.108.xxx |2009-08-24 07:20:41
Hi Shabdar,

Started using this control. must say; great work. Have translated it to vb.net,
and stil works super.

I only have one problem: when i open a second map, that has different tagprefix,
or tagname, and different ID, it still seems to manipulate pointers or other
properties on the already open map. The id`s of the two maps are different in de
aspx file, but when i draw for example polylines in the newly opened map,
(different aspx file, new map, other id) it also shows in the already opened
one.

Is this something formiliar, or am i doing something wrong?

Regards,

Robert
Andrew  - Multiple maps interfering? 2 |146.176.163.xxx |2009-09-16 07:04:57
Hi Shabdar,



Thanks for nice control!



I have similar problem as Robert but I have this control on separate pages and
they influence each other when browsing.



Is it possible to get access to this map through javascript from page source
(.aspx)?



Kind regards,

Andrew
Andrew  - Center |146.176.163.xxx |2009-09-16 07:29:25
And another problem I found :(

when I would like to center in some place and then I put a marker in there
marker appear in wrong place (upper left corner)
Nagendra  - Onclick create Pinpoints |125.63.77.xxx |2009-10-12 08:58:48
Hi,

Its really Good Usercontrol for Google Map implementation.

I need to create pin points onclick of map (on some location) and if he clicks
on one more location there also i need to create pin p[oint and i have to show
the direction also.

can you reply ,how can i do this

Thanks in advance

Nagendra
Nagendra  - Creating pinpoints |125.63.77.xxx |2009-10-12 09:00:42
Hi,

Its really Good Usercontrol for Google Map implementation.

I need to create pin points onclick of map (on some location) and if he clicks
on one more location there also i need to create pin p[oint and i have to show
the direction also.

can you reply ,how can i do this

Thanks in advance

Nagendra
Pat Clifford  - Rendering GoogleMapControl inside a table |194.106.44.xxx |2009-10-20 10:41:08
Hi Shabdar,



Great control, just wondering if you have come across the following issue when
rendering the control inside a . The Map overlay does not fill the entire
GoogleMapControl. Code that follows will reproduce this:







Simple Google Map





Back



Simple Google Map



















Pat Clifford |194.106.44.xxx |2009-10-20 10:46:01
"













"
Pat Clifford  - Rendering Googlemapcontrol inside |194.106.44.xxx |2009-10-20 10:43:51
Hi Shabdar,



Here is the code:





Simple Google Map





Back



Simple Google Map



















Pat Clifford |194.106.44.xxx |2009-10-20 10:49:09
Code:






Simple Google Map





Back



Simple Google Map



















Pat Clifford  - re: |194.106.44.xxx |2009-10-20 10:49:51
Pat Clifford wrote:
"





Simple Google Map





Back



Simple Google Map

































"
Pierre Maroun |199.243.239.xxx |2009-10-29 12:05:45
Please shabdar I need to unsubscribe from the forums, i receive to many emails
(cc) with question and no answers so not useful for me!!

Thank you anyway
Shabdar  - admin |198.96.180.xxx |2009-10-29 12:32:59
You don't seem to be subscribed for email. Where did you post your question?
This page or some other page? I need to know that in order to unsubscribe you
completely.
Belma  - help about gmap error message |217.64.209.xxx |2009-11-12 08:35:39
Hi,



I keep getting the below stated error for my data and am helpless looking for
solutions. Do you have any idea?



The server method 'GetGoogleObject' failed with the following error:
System.InvalidOperationException--Maximum length exceeded.



If you can help me I would really appreciate it.



Thanks,



Belma
Peter James |75.158.104.xxx |2009-11-14 16:16:45
Great article, really useful.

I am maintaining a website written in VB.net. Converting to C# is not an
option. I need to add the ability to access Google maps and add push pins to
it. I have converted your code to VB but am having problems. When the Page Load
event is called I get a Object reference not set to an instance of an object
when I try to use the GoogleMapForASPNet1 object. Obviously I need to set a
reference to it, but where?



Thanks
Girish  - How to integrate this function in javascript?? |116.72.253.xxx |2009-11-18 00:06:26
Hi to All,

I got the source for drawing the arrowIcon image on the polyline on site
http://www.econym.org.uk/gmap/example_arrows.htm

It contains following javascript :: WHICH WE CAN VIEW ON PAGE SOURCE.


////////////////////////////////////////////////// ////////////

I want to integrate functions in that javascript in our control's javascript
GoogleMapAPIWrapper.js so that we can draw the polyline with arrow head image.

I want to achieve directed polyline on google map.

Please reply me ho we can achive this. .................


Regards,
Girish
Shabdar  - admin |198.96.180.xxx |2009-11-18 09:41:32
Hi Girish

This is great work, you can add your custom javascript code to draw arrows in
GoogleMapAPIWrapper.js file under fGetGoogleObject() function.

Please add your custom code at the end of fGetGoogleObject() function.
Girish  - reminder: How to integrate this function in javasc |116.72.253.xxx |2009-11-18 05:15:35
Girish wrote:
Hi to All,

I got the source for drawing the arrowIcon image on the polyline on site
http://www.econym.org.uk/gmap/example_arrows.htm

It contains following javascript :: WHICH WE CAN VIEW ON PAGE SOURCE.


////////////////////////////////////////////////// ////////////

I want to integrate functions in that javascript in our control's javascript
GoogleMapAPIWrapper.js so that we can draw the polyline with arrow head image.

I want to achieve directed polyline on google map.

Please reply me ho we can achive this. .................


Regards,
Girish
Jeff  - hideventsname |24.73.60.xxx |2009-12-01 18:19:39
I saw the above msg referencing the same issue I am running into.
When i compile your project I recv errors that hidEventname and hiEventValue do
not exist in the current context. The msg above refers to the fact that the
code has been fixed. Where do I obtain the latest code? The release I havehas
files dated as currently as September 2009. Am I missing something?
Peter  - MarkerClusterer in control |194.78.28.xxx |2009-12-03 09:42:36
Dear Shabdar,

The user control is really great!!!

Is it possible to add clustering of markers to the control, like the library
MarkerClusterer (part of the Google Maps Open Source Utility Library) does?

This would be a very nice feature and would improve the usability of the map.

Lot's of thanks!
Peter
Jim |82.141.234.xxx |2009-12-15 10:42:52
Hi,



I had to rebuild my hard drive and since then I can't get the API to work. I've
restored my back ups and installed ajax.



When I open my site I get the following error in .net development tool.



Warning 1 'GooglePoint' overrides Object.Equals(object o) but does not override
Object.GetHashCode() C:\Documents and Settings\jim\My
Documents\Visual Studio 2005\Projects\GoogleMapOnlineTrack\App
_Code\cGoogleMap.cs 262 14 C:\...\Goog leMapOnlineTrack\



Any ideas what I'm missing?



Thanks,Jim
Tobias Andersson |85.231.131.xxx |2010-01-15 19:07:08
Hi,

Thanks for a great control!

I'm trying to understand the source code. (I have not programmed javascript
before)

Could someone explain to me how to interpret:

GService.GetGoogleObject(fGetGoogleObject);

with 'fGetGoogleObject' defined as:

function fGetGoogleObject(result, userContext)

The 'GService.GetGoogleObject()' does not even take any arguments... I'm
confused.

Thanks
/Tobias
Sajid  - Software Engineer |212.118.142.xxx |2010-01-17 09:20:39
Hi Shabdar,



Thats great work.

Apart am badly looking for two things



1) A polyline direction between the start and end car markers.

2) How to add a car with its number attached with the image. Is this possible
with the GoogleMapAPIWrapper.js file functions available in version 1.5?



I would appreciate your sincere effort in providing me with peace of help.





thanks & regards

Sajid

yatin  - issue with google map control |59.145.122.xxx |2010-02-03 03:23:56
hi



i am getting Gservice is not defined javascript error when running the project
ne ideas?
Robert  - re: Multiple maps interfering? 2 |87.208.108.xxx |2010-02-03 03:50:09
Hi Andrew,

Did you ever managed to get this fixed?

I didnt anyway.. so i`m curious if you could.

Regards!

Andrew wrote:
Hi Shabdar,

Thanks for nice control!

I have similar problem as Robert but I have this control on separate pages and
they influence each other when browsing.

Is it possible to get access to this map through javascript from page source
(.aspx)?

Kind regards,
Andrew
Anjum Rizwi  - 'GService' is undefined |198.96.180.xxx |2010-02-26 05:25:30
Excellent article.



I have used this in DotNetNuke project. Everything is working fine without
Update panel.



When I included UpdatePanle with the way u suggested.



I am getting error. 'GService' is undefined.



I have add one more property to support to support the alphabate icon URL in
GooglePoint class.



Code:


string iconUrlTemplate = "http://chart.apis.google.com/chart?chst=d_map
_pin_letter&chld={0}|{1}|{2}";

string iconUrl = string.Empty;



Control code behind:

int asciiCode = (int)'A';

string bgColor = "8EC8DE";

string textColor = "000000";

if (!isDisplayLetter) textColor = bgColor;



GooglePoint gpOriginCity = new GooglePoint();

gpOriginCity.IconUrl = string.Format(gpOriginCity.IconUrlTemplate,
Convert.ToChar(asciiCode++), bgColor, textColor);



Hope it helps to other.
Shabdar  - admin |198.96.180.xxx |2010-02-26 10:30:13
This control do not support Ajax Update Panel. You can not place it inside
Update Panel. This is limitation from Google Map.
Saxxon |85.236.236.xxx |2010-03-09 05:17:48
is your GooglePoint class missing the following?

public override int GetHashCode()
{
return base.GetHashCode();
}

nano  - thanks |190.104.4.xxx |2010-03-12 03:34:39
Very good project, thanks a lot.
vijay  - re: thanks |123.176.39.xxx |2010-04-15 01:31:44
How to create matkers using create marker function in APIwrapper without using
GooglePoint.



Please help





Developer |117.195.7.xxx |2010-04-17 11:54:12
This article is very useful..bt i also hav some queries..this control is very
useful to find distance between the two points and it shows tht on map...but how
can i get that distance in a variable and retrieve it in a label on aspx page
without loading/displaying a map??
conrad  - Custom Icons don't show in IFRAME |207.47.114.xxx |2010-05-17 15:47:08
I am loading the Google Maps solution thgrough an IFRAM and the cusomt icon's
don't show.

I load the same map outside of the IFRAME and the custom icons show.

Is this a known issue?

-Conrad
Daryl  - Error getgoogleobject |80.101.138.xxx |2010-05-20 16:07:04
Hi Folks,

On some pc's i get the error: The server method GetGoogleObject failed with the
folowing error: --
There was an error processing the request.

Randomly happens on pc's which have the exact same browser version/security
level as on other pc's where it does work!

Kind of a big problem as i finalized the program, only to discover it's useless
for so many pc's :(

Link: http://locator.stoepje.biz

Thanks!
snow  - Zoomlevel not working |86.96.229.xxx |2010-05-24 02:32:33
Hi ,

I wnat to zoom maximum on click.

on page load when i define GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 7;

but on click event of button I want zoom level of map to be maximum. I written
this code under click event


GooglePoint GP = new GooglePoint();
GP.ID = "2";
GP.Latitude =Convert.ToDouble(reader["Y"].ToString());
GP.Longitude = Convert.ToDouble(reader["X"].ToString()); ;

GoogleMapForASPNet2.GoogleMapObject.AutomaticBound aryAndZoom = false;
GoogleMapForASPNet2.GoogleMapObject.ZoomLevel = 19;
GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP) ;


but it does not zoom to maximum always display at level of 14 only which is not
maximum.
Anonymous |115.242.106.xxx |2010-06-11 06:47:46
How to add two maps on single page??
Borno Md. Imtiaz Sayeed  -  open infoHtml for last inserted push point |180.234.136.xxx |2010-06-23 14:29:18
Hi,
i am borno here facing some problem while trying to customize it.

1. when using timer.tick function get some new values and plot it on map, i need
to open infoHtml for last inserted push point.(must without post back).in my
code if i let it to do postback last pushpoints infoHtml stay open. but if i do
it inside update panel last pushpoint's infohtml does not appear instead
previous one stay active.

2. Multiple google map open facilities.As it use same session values overlap.


I need some reply soon...
thank you.
Saira  - serialization error |119.160.106.xxx |2010-07-08 02:08:35
Hello Shabdar,

Great project! very handy. Need your advise on a serialization error which
occurs when more than 500 points are plotted. Any fix for that? Basically not
more than 500 points can be mapped because of this error.

'Error during serialization or deserialization using the JSON
JavaScriptSerializer. The length of the string exceeds the value set on the
maxJsonLength property'


Kindly help

Thanks
Ross |77.208.155.xxx |2010-07-27 10:00:54
Hi Shabdar,



It's rare to find such an indepth explanation of a control on the web together
with sample files. I have the contorl working well but I have a question. Is it
possible to put 2 maps on one page? I thought it might simply be a matter of
adding another control called GoogleMapforASPNet2 but it appears a little more
complex than that.



Many thanks

Ross
igor  - find alternative addresses |87.2.90.xxx |2010-08-18 05:14:46
If I post a wrong address, how can I find addresses similar, alternative ...
exist GeocodeAddressAlternative ?



tk
Mike C |81.144.181.xxx |2010-08-27 06:20:00
Great control!

I need to have the user control on multiple forms. On of the forms is in a
subfolder and when it loads the user control appears not to render.

To simulate this in your sample app I created a new folder called test and
copied in the SimpleMapWithNoBubble page. I experienced the same behaviour, are
there any suggetions anybody can offer?
Last Updated on Tuesday, 23 March 2010 11:46