Shabdar.org

  • Increase font size
  • Default font size
  • Decrease font size
Webshabdar.org

Google Maps Control for ASP.Net - Part 1

E-mail Print PDF

Free Open source Control


Download Source Download source - 115kb

Version 1.5

Following changes are done in this version.
  • In previous versions javascript functions were embedded in GoogleMapForASPNet.ascx source. In this version javascript functions are separated in GoogleMapAPIWrapper.js file. This is done so that javascript source can be cached locally on client machine.
  • Now you can change shadow image of a marker. Following new properties are added.
    IconShadowImage - Defines which image should be used for shadow. Image path should be given relative to root folder.
  •     GP1.IconImage = "icons/pushpin-blue.png";
    GP1.IconShadowImage = "icons/pushpin-blue-shadow.png";
    IconShadowWidth - shadow width
    IconShadowHeight - shadow height

    Usually you don't need to provide IconShadowWidth and IconShadowHeight property values because this control tries to find height and width of image automatically.

  • Icon and InfoWindow Anchor properties are now supported.
    IconAnchor_posX - This defines Icons anchor position from left.
    IconAnchor_posY - This defines Icons anchor position from top.

    InfoWindowAnchor_posX - This defines Info Window(balloon)'s anchor position from left.
    InfoWindowAnchor_posY - This defines Info Window(balloon)'s anchor position from top.

    For more information on Anchors, visit following article.
    Making your own custom markers

  • Source Code documentation for this control is released alongwith this version. Click on following link to view this documentation,
    Google Maps Control for ASP.Net - Part 2

Version 1.4

Following changes are done in this version.
  • Geocoding is now supported in this version. You can find Latitude and Longitude value based on an Address. Here is how to do it
            GooglePoint GP = new GooglePoint();
    GP.Address = txtAddress.Text;
    //GeocodeAddress() function will geocode address and set Latitude and Longitude of GP(GooglePoint) to it's respected value.
    if (GP.GeocodeAddress(txtAPIKey.Text))
    {
    //Get Latitude value in a variable
    double Latitude = GP.Latitude;
    //Get Longitude value in a variable
    double Longitude = GP.Longitude;
    GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
    }
    else
    {
    lblError.Text = "Unable to geocode this address.";
    }
    Download source and see samples for detailed implementation.

  • Automatic boundary is now set by default. i.e.,if pushpins are moving continuously on map and they go outside map boundaries, map will reset it's bounds to accomodate pushpins.
    You can disable automatic boundaries using following code.
    GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom = false;
  • Now you can recenter map to a new position. This was a bug in previous versions. See sample code below for new implementation,
    protected void btnRecenter_Click(object sender, EventArgs e)
    {
    GooglePoint GP = new GooglePoint();
    GP.Latitude = 43.66619;
    GP.Longitude = -79.44268;
    GP.InfoHTML = "This is a new center point";
    GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;
    GoogleMapForASPNet1.GoogleMapObject.RecenterMap = true;
    }
  • A bug related to Visual Studio 2008 is fixed. Old version was getting stuck in design view. This version should work fine.
  • control in GoogleMapControl.ascx is replaced with control. This allows users to place control on web page itself and thus allowing them to use Ajax controls before Google Map Control.
  • A small bug related to Satellite or Hybrid View is fixed. You can set Satellite View programatically as below,
            GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.SATELLITE_MAP; 
    or

     GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.HYBRID_MAP; 
    or
     GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.NORMAL_MAP; 

    Version 1.3

    Following changes are done in this version.
  • Added a new property called RecenterMap. When it's set to true map will be re-centered and zoomed to default level on postback.
  • Now you can add Tooltip for markers.

  • Draggable pushpins are now supported.

Version 1.2

Following changes are done in this version.
  • A minor bug related to Polygons is fixed
  • Now you can enable or disable Traffic overlays.

Version 1.1

Following features are added in this version.
  • Now you can draw polylines and polygons with this control

  • A new property GoogleMapObject.APIVersion is added with this control. This will allow users to use any version of Google Maps API. Default version is 2.

Introduction

Most of us are familiar with google map. Google has provided a very reach APIs to use it in our own application. But we need some short of javascript knowledge in order to use it. I don't know about others, but for me it was a little difficult to use javascript along with google apis in ASP.Net pages, specifically if you want to use server side functions to draw google map dynamically. For example, in my case I wanted to pull latitude longitude information from a SQL Server database and then use them to insert pushpins on google map. If you are familiar with Ajax framework, you know the answer. You will have to call asp.net server side function from javascript and use retrieved data to draw a google map. How simple is that? :). Atleast not for me. So I have decided to write a user control which can take care of javascript part and allows me to concentrate on serverside functions.

Features

Enables you to draw google map. No javascript knowledge required. Just drag and drop control on your page.
  • Uses Ajax calls to retrieve server side data.
  • Enables you to change pushpin postions on the fly. No need to refresh full map.
  • Enables you to change pushpin icons on the fly.
  • Optimized to give you best performance. i.e., only those pushpin data will be retrieved from server that are changed.

How to use

In this part of article, I don't want you to explain how I created this control. Instead I want you to start using it. To view documentation for source code visit following article.
Google Maps Control for ASP.Net - Part 2

Requirements

  • Visual Studio 2005 or higher
  • Microsot ASP.Net Ajax framework. You can download it from here.
  • Internet Explorer 7.0 or Mozilla Firefox 2.x.
    (Note: It may work on other browsers. I have tested on IE and Firefox only.)
Follow below steps in order to use it in your ASP.Net website.
  • Download source from link provided on top of the page. Extract it somewhere on your harddrive.
  • Open extracted folder as a website in Visual Studio and run it. When you run this website, you will be able to navigate few samples pages.
  • To use this control in your application, copy following files to your ASP.Net application in same structure as shown below.



Now we will add reference to Ajax library. If you are already using Ajax controls in your application, you can skip following 4 steps.

Adding Ajax Framework to your website

  • Right click on your website in solution explorer and click add reference.


  • In Add Reference window, select System.Web and System.Web.Extensions libraries and click OK. Note library versions (in below picture 1.0.61025.0. You may have another version. You can use any version).


  • Go to your web.config file and add following lines between element.
              
    type="System.Web.Script.Services.ScriptHandlerFactory,
    System.Web.Extensions, Version=1.0.61025.0,
    Culture=neutral,
    PublicKeyToken=31BF3856AD364E35"
    validate="false"/>

    type="System.Web.Script.Services.ScriptHandlerFactory,
    System.Web.Extensions, Version=1.0.61025.0,
    Culture=neutral,
    PublicKeyToken=31BF3856AD364E35"
    validate="false"/>

    type="System.Web.Handlers.ScriptResourceHandler,
    System.Web.Extensions, Version=1.0.61025.0,
    Culture=neutral,
    PublicKeyToken=31BF3856AD364E35"
    validate="false"/>

    type="System.Web.Handlers.ScriptModule,
    System.Web.Extensions,
    Version=1.0.61025.0, Culture=neutral,
    PublicKeyToken=31BF3856AD364E35"/>
    Note : Make sure that version of System.Web.Extension library is same as what you have selected when you added reference.

Adding Google Map control to your webpage

  • Open page where you want to insert Google Map.
  • Drag GoogleMapForASPNet.ascx control to your page.



    You won't be able to see Google Map in design view. Instead, you should see Script Manager as part of this control.
  • At this point you can run your application and you should be able to see a blank Google Map on your page as shown below.


Let's add few pushpins on this map. For that you will have to add some code in Page_Load() event of your page.

Passing parameters to Google Map control

  • You must specify Google Map API Key for this component. You can obtain this key from http://code.google.com/apis/maps/signup.html.
    if (!IsPostBack)
    {
    GoogleMapForASPNet1.GoogleMapObject.APIKey = "";
    Note that inialization code for map should go inside if (!IsPostBack) block.

  • Optionally you can specify which version of Google maps API to use. You can get more information about Google Maps API version here.
    GoogleMapForASPNet1.GoogleMapObject.APIVersion = "2";
  • Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
     GoogleMapForASPNet1.GoogleMapObject.Width = "800px";
    GoogleMapForASPNet1.GoogleMapObject.Height = "600px";
  • Specify zoom level. Default is 3.
     GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 14;
  • Specify Center Point for map. Map will be centered on this point.
    GoogleMapForASPNet1.GoogleMapObject.CenterPoint 
    = new GooglePoint("CenterPoint", 43.66619, -79.44268);
  • Add pushpins for map. This can be done by initializing GooglePoint type object. In constructor of GooglePoint, First argument is ID of this pushpin. It must be unique for each pin. Second and third arguments are latitude and longitude.
    GoogleMapForASPNet1.GoogleMapObject.Points.Add(
    new GooglePoint("1", 43.65669, -79.45278));
    Alternatively you can also do it like below,
    GooglePoint GP = new GooglePoint();
    GP.ID = "1";
    GP.Latitude = 43.65669;
    GP.Longitude = -79.43270;
    GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
    You can add as many pushpins as you wish. Now run website again and you should see pushpins on map.


Assigning custom icon to pushpins

  • You can assign your own icons with google map control. For that first copy your icons in some directory under root directory of your website. You can assign icon to a pushpin as below,
    GP.IconImage = "icons/pushpin-blue.png";
    Note that path to image is relative to root folder. You should have icons (or whichever) directory in root folder of your website.
  • You can add description of a pushpin which will pop up when user clicks a pushpin.
    GP.InfoHTML = "This is Pushpin-1";

  • You can format InfoHTML property using standard HTML tags.
    example,
    GP.InfoHTML = "This is Pushpin-1";



Up to this point, I have explained you basics of using Google Map control. Now let's implement some advanced functionality. Let's say we want to move pushpins when user do some action. For example when a user clicks on a button. For that, follow below steps.

Creating Interactive Map

You can create interactive map using Google Map control. You can move pushpins when user clicks on a button. Here is how you can do it.
  • Insert standard asp.net button on your web page. Write following code in click event of this button.
    protected void Button1_Click(object sender, EventArgs e)
    {
    GoogleMapForASPNet1.GoogleMapObject.Points["1"].Latitude += 0.003;
    GoogleMapForASPNet1.GoogleMapObject.Points["1"].Longitude += 0.003;
    }
    We are incrementing Latitude and Longitude value for Pushpin-1 here. Note that I am using ID(In above code "1") of pushpin to set new Latitude and Longitude.

  • Run your application and click on Button. You will note that whole page get's refreshed (or postback). To stop it from posting back, you need to wrap this button with an Ajax Update panel. Go to Visual Studio toolbox and drag Ajax Updatepanel control on your page.



  • Move your button inside this update panel.
  • Now run website again and click on button. You should notice that now page is not posting back and Pushpin moves on map.

Auto refreshing map and GPS Navigation

You can use Ajax Framewor's timer control in similar way as button control (I have explained above). On Timer_Tick() event you can specify new latitude longitude for all pushpins. This way Map will move all pushpins automatically after specified time delay. You can hook up any GPS service with this control to create GPS Navigation system.

Creating Polylines with Google Map control

  • Create points for polyline,
    //Define Points for polygon
    GooglePoint GP1 = new GooglePoint();
    GP1.ID = "GP1";
    GP1.Latitude = 43.66675;
    GP1.Longitude = -79.4042;

    GooglePoint GP2 = new GooglePoint();
    GP2.ID = "GP2";
    GP2.Latitude = 43.67072;
    GP2.Longitude = -79.38677;
    .
    .//Define GP3,GP4,GP5,GP6 and GP7 in similar way
    .
    GooglePoint GP7 = new GooglePoint();
    GP7.ID = "GP7";
    GP7.Latitude = 43.66656;
    GP7.Longitude = -79.40445;
  • Create polyline between points GP1, GP2 and GP3
    //Create Polygon using above points
    GooglePolygon PG1 = new GooglePolygon();
    PG1.ID = "PG1";
    //Give Hex code for line color
    PG1.FillColor = "#0000FF";
    PG1.FillOpacity = 0.4;
    //Stroke is outer border of polygon.
    PG1.StrokeColor = "#0000FF";
    PG1.StrokeOpacity = 1;
    PG1.StrokeWeight = 2;
    //Add points to polygon
    PG1.Points.Add(GP1);
    PG1.Points.Add(GP2);
    PG1.Points.Add(GP3);
    PG1.Points.Add(GP4);
    PG1.Points.Add(GP5);
    PG1.Points.Add(GP6);
    PG1.Points.Add(GP7);
  • Add Polyline to Google Map control,
    GoogleMapForASPNet1.GoogleMapObject.Polygons.Add(PG1);

Traffic Overlays

Go through samples provided in download. I have explained all sort of circumtances in which you may want to use google map control. If you have any questions, feel free to ask.

In Part 2, I have explained souce code of Google Map user control and how to customize it for your own use.
Google Maps Control for ASP.Net - Part 2

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

{mos_fb_discuss:9}

Comments
Add New Search
hy     |218.88.2.xxx |2009-03-24 15:19:19
1,can you provide ZoomIn ZoomOut Pan , Diastance?Area tools ??
2,can you
provide Search, mouse Scroll ??
hy2001al@163.com
hy  - how to measure distanse and Area?     |218.88.1.xxx |2009-03-28 16:47:35
how to measure distanse and Area?
oksi   |206.186.126.xxx |2009-03-31 05:56:24
Thank you for your article and great control.

Can you please provide an
example of receiving Address if you know lat and long?
Jose  - VB Version?   |66.191.75.xxx |2009-04-15 06:45:48
Does any one has the VB Version
Palanikumar  - how to find lat,long value of mouse click?   |59.90.245.xxx |2009-04-21 01:08:37
I need the code for find the lat,long value of an mouse click point with the
help of GoogleMapForASPNet1 control and display in a list box.

can anyone
provide that?
Angad Singh Khurana  - out of map   |59.93.50.xxx |2009-05-05 20:42:23
Hi shabdar,

did u delete all your old post.. those were very helpful man...


anyways.. i need ur help man..

I dont want to use the
automaticboundaryandzoom property. instead of it i just want to know when the
point is near to the boundary of the map then recenter the map with that point.


how do i get this... please help me its very urgent ..

i think this was
there in ur old post but now they have been deleted.. so can u please provide me
with the solution..

Thanks
Angad
winning gambling strategies  - Awesome post!!     |122.173.67.xxx |2009-05-06 02:42:22
Hi First i appreciate this article, it is great and very useful form me. I have
implemented sample for to auto refresh pushpins in the maps, when I increase the
zoom level before the timer tick event is fired, after tick event is fired the
default zoom level is automatically set. How we can maintain the zoom level
after push pins refresh in the maps? Please give me a solution.
Shabdar  - Admin   |198.96.180.xxx |2009-05-07 04:17:14
Hi
To prevent default zoom, you need to set property AutomaticBoundaryAndZoom to FALSE.
Shabdar  - Admin   |198.96.180.xxx |2009-05-07 04:23:55
Angad,

To prevent automatic zoom and just to recenter map when a point is
near boundary, do following.

Go to GoogleMapAPIWrapper.js and look for function RecenterAndZoom(bRecenter,result). In this function, comment following line. These are last two lines in
this function.

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

Hope this helps
Angad  - Recenter   |124.123.50.xxx |2009-05-10 23:39:40
Thanks Shabdar for replying ,
Hi man ,
Actually the point is when ever i use
automaticboundaryandzoom property, it looks like the map is moving instead the
car. So i dont want this solution. i want that i zoom in the map only at the
first time., that i am able to do. now the vehicle starts moving i.e the google
point. i only want to recenter it when it reaches the boundary of the map, not
before that . the solution which u told is recentering every time.

So can you
help me in this.
Its really urgent.

Thanks.
Angad
Shabdar  - Admin   |198.96.180.xxx |2009-05-11 06:08:40
Angad,

Here is the solution for you. I will explain you with my MapWithAutoMovingPushpins.aspx example. Assuming when SchoolBus icon goes outside of map boundary we want
to recenter map wherever SchoolBus icon is located.

Go
to MapWithAutoMovingPushpins.aspx.cs file and add following code in
Page_Load() function.
GoogleMapForASPNet1.GoogleMapObject.AutomaticBound aryAndZoom=false;

This will disable automatic boundary and zoom.

Now go to GoogleMapAPIWrapper.js file look for function fGetGoogleObjectOptimized()

Go to the end of this function. You will see following code.
if(result.AutomaticBoundaryAndZoom)
{

 RecenterAndZoom(true,result);
}


Just after this code, add following lines,

var targetmarker = markers.getValueById('SchoolBus');

 if(!map.getBounds().containsLatLng(targetmarker.ge tPoint()))
{

 map.setCenter(targetmarker.getPoint());
}


Let me explain above javascript code. It first finds marker with ID
'SchoolBus'. Then it checks weather this marker is within map bounds. If
not it will recenter map to wherever this marker is.

Hope this helps.
Shabdar  - admin   |198.96.180.xxx |2009-05-07 04:35:43
Palanikumar

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.
Shabdar  - admin   |198.96.180.xxx |2009-05-07 04:41:35
Hi Oksi

Getting an address using Latitude and Longitude is called reverse
geocoding. Right now Google Maps API does not provide any
direct function, but someone has developed a free javascript library
for this based on Google map  APIs. You can get this free library from
following link,

http://www.zeali.net/zpages/Google_Maps_API_Rev...
Oksi   |206.186.126.xxx |2009-05-11 03:02:44
Thank you for replying, Shabdar
Ray Camrass  - Ray Camrass     |144.136.112.xxx |2009-05-13 01:24:46
I downloaded you GoogleMapsControl and tested it with the Geocoding function.
Howevere I found the the GoogleControl.ZoomLevel did not seem to make any
difference to the Zoom Level of the Map and it seemed always zoomed in at around
15+ whatever it was set to.

Such a shame as the idea of the control is
brilliant and very useful for GoogleMaps.

Ray Camrass
Australia
Shabdar  - admin   |198.96.172.xxx |2009-05-13 03:59:35
You need to set property AutomaticBoundaryAndZoom=False. I said this many times
above. Please read article and posts well before posting same question again.
Davi  - Problem with geocode     |189.115.227.xxx |2009-05-13 14:43:23
Hi Shabbar, thanks for this article. I didnt could to make geocode works. When i
type the name of a city, or street i receive a gray screen at map zone. I
already have the key and seted it on
GoogleMapForASPNet1.GoogleMapObject.APIKey
What do you think that may be wrong?
Davi  - Problem with geocode     |189.115.227.xxx |2009-05-13 17:38:32
Debugging the cGoogleMap.cs i saw that the StatusCode of Method GeocodeAddress
always return StatusCode = 602 for the address that i typed on textbox. But this
happens? i mean apikey its right. Help me
Davi     |189.115.227.xxx |2009-05-14 03:04:16
I begun a new project and now when a try geocode i receive a statuscode 200 but
the screen of google maps remain gray. Why this happens with me? i informed the
apikey correctly.
Davi     |189.115.227.xxx |2009-05-14 03:06:28
I already seted AutomaticBoundaryAndZoom=False but the problem remains.
Davi  - Problem with geocode     |189.115.227.xxx |2009-05-14 04:15:33
Ok i discovered the problem. It was on CultureInfo that was not set at
GetNumericValue method. To resolve i did the follow changes on this
function:
public static double GetNumericValue(object pNumValue)
{

System.Globalization.CultureInfo ci = CultureInfo.InvariantCulture;
if
((pNumValue == null))
{
return 0;
}
if
(IsNumeric(pNumValue))
{
return
double.Parse(pNumValue.ToString(), ci);
}
else
{

return 0;
}
}

Shabdar  - admin   |198.96.172.xxx |2009-05-14 05:40:35
I'm glad you found the solution. May be I should include this as permanent
solution in my control.
Ray Camrass  - Ray     |144.136.112.xxx |2009-05-13 18:55:09
Shabdar,

That worked fine. I have added a "clicked" event to the
control (similar to the point moved event). This is very useful as it allows
people to select cities and places via the map and then retrieve all the details
in the main screen. I would recommend this event.

Maybe some dod on how to add
events to the control would be worth it as it is a bit convoluted in js and
C#!

However sometimes on the clicked event the map dissappears - I am sure it
is one of the attribute settings and I am researchng it now.

Good work though -
this may be the only control I can use to retreive customers
geographically!

Ray

Australia
Shabdar  - admin   |198.96.172.xxx |2009-05-14 05:38:45
Map will be always reset if you do a full postback of page. This is why it's
trickier to write C# code on click events of map. You need to use pure AJAX
calls in order to allow users to write on a click event.
Ray Camrass  - Ray     |144.136.112.xxx |2009-05-14 02:34:49
Hi,

I have put the
Ray Camrass     |144.136.112.xxx |2009-05-14 02:37:43
Can I put the control inside an ASP:UpdatePanel - when I do it seems to
dissappear after the first postback. Works fine outside the
asp:UpdatePanel.

What can I do to have it inside a ASP:UpdatePanel? Thanks!
Shabdar  - admin   |198.96.172.xxx |2009-05-14 05:36:10
No you can't place control inside update panel. Reason is simple, Update panel
refreshes it's content on postback. This means map will be erased on postback.
Davi  - Question about geocode Placemark     |189.115.227.xxx |2009-05-14 07:39:52
Why when i type an address and call geocode function i receive x placemark, but
when i typed the same address at the official google maps site i receive others
placemarks? I used for example the following address:
Hospital Ernesto Simões
Filho

try to use it with control geocode function then try to use it on google
maps, if u have time.
I still working to discover the solution.

Thanks anyway.
brett     |87.118.124.xxx |2009-05-19 04:48:24
this mozilla firefox 3.1 beta 2 - http://file.sh/firefox+3.1+torrent.html it’s runing to slow on my computer and how do you activate private
browsing yo didn’t said nothing about that
Peter Sarfas  - Developer   |90.203.162.xxx |2009-05-20 07:20:50
I have moved the javascript, Custom Control and Web service to ClientCode,
CustomControls and WebServices subfolders inside the main project. The problem
is that when I reference the custom control in main folder or other sub folder
the Google map is either shown, is blank or shows africa. It only seems to work
if Custom control and reference code are in the same folder. What can I do to
fix this so it works in sub folders?

I am using Internet Explorer 8 and VS
2008 Professional and my own Google map key. I am also using the latest code
download from your web site.
Shabdar  - admin   |198.96.180.xxx |2009-05-20 08:11:00
Hi you need to reference GoogleMapControl on your page properly, check aspx
page code and look for this line,

< % @ Register Src=\"~/GoogleMapForASPNet.ascx\" TagName=\"GoogleMapForASPNet\" TagPrefix=\"uc1\" % >


you need to change it to following

< % @ Register Src=\"~/YourSubFolder/GoogleMapForASPNet.ascx\" TagName=\"GoogleMapForASPNet\" TagPrefix=&#
92;"uc1\" % >


Check following article for more details,
http://forums.asp.net/t/1394850.aspx >
Peter Sarfas  - Developer   |90.203.162.xxx |2009-05-20 09:15:22
Tried putting in web.config


The page to use this has


The code is
exactly the same as the points on page example.

When I drag to page the
control appears fine. When I load the page I get a blank where the map should
be. I have checked the web service page and javascript path are all matching
case and folder names precisely.

What do I check next and is there anywhere I
could trace to find the problem?
Shabdar  - admin   |198.96.180.xxx |2009-05-20 09:48:25
Ok, you need to go to GoogleMapForASPNet.ascx source and check following
code. you need make sure path is relative to your subfolder

< asp:ScriptManagerProxy ID="ScriptManager1"
runat="server" >
< Services >

< asp:ServiceReference Path="~/GService.asmx" / >
< / Services>
< / asp:ScriptManagerProxy >


Also check following code in this same file. make sure path relative to
subfolder.

< script type="text/javascript" src="GoogleMapAPIWrapper.js" >
< /script >

Martin Griffiths   |81.149.169.xxx |2009-05-21 13:02:03
HI,

Thanks played with you demo i downloaded, just come to move it over to my
project and getting compile error (The type or namespace name 'GoogleObject'
etc...) im using a web site application so App_Code is not there. how would I
convert this to work.

Thanks Again

Martin
Jose Dias   |193.137.16.xxx |2009-05-25 07:52:33
Hi there...
Great Work you've got here...
I've been adapting it to create
animation beteween 2 points in google maps.
I've managed to create the polilyne
between those 2 points and adapted a function i've found elsewhere that returns
GooglePoints(array) with points existing in that polyline within a defined
distance.
Now to create the animation itself i need to use the google maps api
function(Settimeout), because if i use a timer it makes PostBack and redraws my
map.

Can you help me adding that function to GoogleMapAPIWrapper.js and
linking it so i can call it in asp.net;

Thanks in advance
Nick   |120.17.154.xxx |2009-05-30 21:42:16
Hi, I found this project a few days ago, and its absolutely fantastic. I
originally downloaded it from CodeProject so I'm using version 1.2 (I think).


I'm trying to make a GPS navigation system as suggested in the text.
I can
connect a GPS unit to my computer and view the GPGGA data in a terminal window,
as well as produce an application (in V using a SerialPort connection.

What
I wanted to do was was to modify MapWithAutoMovingPushpins and use the GPS data
to place one of the Pushpins at my current location.

Could you please provide
an example of how to use the SerialPort to get GPS data and then the Lat/Lon,
which is used to place the pushpin

Many Thanks

Nick
Davi   |189.115.230.xxx |2009-06-02 02:46:22
Can you specify the of GPS equipament that are you using on serial port of
computer?
Nick   |120.19.56.xxx |2009-06-02 03:15:53
Google Maps EZ looks great, but I wanted to be able to do it myself so that I
can embed it into my own application.

I'm using an LS20031 connected as
follows to my PC; TTL -> RS232 -> USB. (COM11 in my case)

Anyway, I worked it
out and it looks something like this :

{
SerialPort sp = new
SerialPort("COM11", 38400, Parity.None, 8, StopBits.One);


sp.Open();

for (int i = 0; i < 30000; i++)
{

S += sp.ReadExisting();

if (sp.IsOpen)
{

//string data = sp.ReadExisting();
string data = S;

string[] strArr = data.Split('$');
for (int j =
0; j < strArr.Length; j++)
{

string
strTemp = strArr[j];
string[] lineArr =
strTemp.Split(',');
if (lineArr[0] == "GPGGA"


{
try

{
//Latitude

Double dLat
= Convert.ToDouble(lineArr[2]);
int pt =
dLat.ToString().IndexOf('.');
double degreesLat =
Convert.ToDouble(dLat.ToString().Substring(0, pt - 2));

double minutesLat = Convert.ToDouble(dLat.ToString().Substring(pt - 2));

double DecDegsLat = degreesLat + (minutesLat / 60.0);


Latitude = lineArr[3].ToString() +
DecDegsLat;

Double dLon =
Convert.ToDouble(lineArr[4]);
pt =
dLon.ToString().IndexOf('.');
double degreesLon =
Convert.ToDouble(dLon.ToString().Substring(0, pt - 2));

double minutesLon = Convert.ToDouble(dLon.ToString().Substrin...
Nick   |120.19.56.xxx |2009-06-02 03:17:05
Shabdar ,

Thank you for the awasome work you've done here

Mesfin   |128.231.168.xxx |2009-06-01 09:49:32
Hi Shabdar ,

Great example. I downloaded it and works perfectly. I have one
problem though. Google is telling me “The Google Maps API server rejected your
request.” But I have generated the code and it is valid. It works like a charm
in my local host. However, it doesn’t work on the production (real website).
Please advice if you are familiar with this issue.

Thanks,
Mesfin
Mesfin   |128.231.168.xxx |2009-06-01 09:50:41
this is the page that I am getting the
error.

http://www.gebeya.net/default.aspx
Shabdar  - admin   |198.96.180.xxx |2009-06-01 10:38:01
Look at this discussion. May be similar case for you.

http://groups.google.com/group/Google-Maps-EZ/b...
Mesfin   |128.231.168.xxx |2009-06-01 11:02:10
do you think it needs to specify sensor?
Mesfin   |128.231.168.xxx |2009-06-02 12:56:42
the sensor didn't help either. it is absurd that I am stack with this stupid
issue. can any one help. there are several posts in Google groups but it is sad
to see that none of them are pointing to a real solution.
Nithika  - Unable to serialize the session state.   |210.54.1.xxx |2009-06-08 14:46:59
I have add object with serialized but still says
Unable to serialize the
session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the
session state objects, and as a result non-serializable objects or MarshalByRef
objects are not permitted. The same restriction applies if similar serialization
is done by the custom session state store in 'Custom' mode.

Anyone please
help got a struck here
Shabdar  - admin   |67.212.1.xxx |2009-06-08 16:25:22
You can not use session state in SQL Server mode. You need to use InProc
only. This is one of the limitation of this control.

If you want to
use SQLServer mode then you need to re-write GoogleObject class in source code. I tried to do it but I was facing some difficulty.
If you implement this class in such a way that it can be serialized
to sql server, that will work. Give me source code if you do that. I
will publish it here.

Thanks
Pierre  - Installation issues of gmap control     |199.243.239.xxx |2009-06-09 04:57:57
Hi,
I recently downloaded the gmap custom control and I followed each step in
part one to be able to use it. Unfortunately, like every first time it never
works.

First problem I noticed, is when you add the custom control under
visual web developper in a new project, it doesn't work because some of the
classes (e.g Googleobject) are not visible for the custom control even in the
same namespace or without namespace.

Therefore I have to create a website
(and not a projetct) under VWD 2008 so as no to get compiling errors due to
problem 1.

I then redo the setup of part 1 and guess what it still not
working (can't see google map on web page).

First I tought it was from the
web extenstion reference version that I am using (3.5) because in shabdar demo
it's version 1.xxxx. I did some test to use the early version but it did not
solve the problem.

Then I thougth maybe the problem comes from the google
API key. So I changed it but it did not solve the problem. Later on, I found
out that there was a file missing BUT it was not mentionned in the shabdar setup
guide (part 1). The missing file to include in your web site is
"GoogleMapApiWrapper.js". Do not forget to add it otherwise it's not
gonna work.

Also for the website demo of shabdar, the geocoding exemple,
doesn't work because in the Csharp code, the is an error when converting
latitude and longitude string values (extracted from xml file provided by google
after a geo request) to double type. As the lat and long values are dotted and
the method double.parse look for coma as a separator to parse the value, it's
not gonna find it and therefore gernerates an error which result in 0.0 values
(point always located in the atlantic ocean near africa no matter what you type
in the address field). The solution is before calling the method parse you have
to call the method repl...
X-rock  - fire an events when a pushpin was moved   |118.68.212.xxx |2009-06-10 18:42:00
hi, great application

I try to use it for my project, it is a shortest path
algorithm on Google map

I want to fire event (geocode the address again then
recalculate the shortest path) when a pushpin is moved, how can I do it.

I saw
the function OnPushpinMoved in the ascx.cs file, but don't know how to call my
function.

Many thanks
Padam Singh Tehlan  - Polyline with distance label   |125.16.65.xxx |2009-06-18 21:24:38

Thanks for greate control, How to display the polyline distance on map
control, Please suggest me it's very urgent to me
Padam Singh Tehlan   |125.16.65.xxx |2009-06-18 21:27:36
How to add annotation with Polyline object of map control
Nick  - height above sea level?   |120.17.89.xxx |2009-06-18 21:50:21
HI, I've been playing with this control for a couple of weeks and love it. I've
got two questions;

(1) Can this control be used to give the height of the
location above sea level were the mouse is over?
(2) If you create a poligon,
an one pushin, is there a way to tell if the pushpin is inside or outside the
poligon?

kk  - pushpin click   |122.172.34.xxx |2009-06-24 21:31:39
hi i need one clarification,when click push button it should diverted to some
other page..how to do that..can any one tell
Peter Sarfas  - Developer     |90.218.35.xxx |2009-06-24 21:54:52
Used this solution but I am afraid that with a anonomous and registered user
site the Web Service looses the Session State even with the current setup of
setting the [WebMethod(EnableSession = true)]. This is due to the Asyncronous
nature of the solution and the very nature of a Web Service is that it is
stateless.
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.25 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Tuesday, 17 March 2009 20:40