Click here to Skip to main content
12,632,864 members (32,094 online)
Click here to Skip to main content

Stats

33.6K views
2.7K downloads
76 bookmarked
Posted

AJAX Enabled Google Maps ASP.NET Control

, 12 Jul 2010 CPOL
Using the Google Maps API on server side with AJAX support.
GoogleMapTest
App_Code
vssver2.scc
App_Data
Bin
GoogleMap.dll
vssver2.scc
images
flag1.ico
flag2.ico
marker1.ico
marker2.ico
vssver2.scc
GoogleMap.vssscc
mssccprj.scc
vssver2.scc
GoogleMap
bin
Debug
GoogleMap.dll
GoogleMap.csproj.vspscc
mssccprj.scc
Properties
vssver2.scc
vssver2.scc
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Web.Configuration;
using GoogleMap;
using System.Collections.Generic;

/// <summary>
/// Summary description for MapData
/// </summary>
public class MapData
{
    private MapData()
    {
        
    }

    public static List<Position> RouteMapInfo
    {
        get
        {
            if (routeMapInfo == null)
                LoadRouteMapInfo();

            return routeMapInfo;
        }
    }

    private static List<Position> routeMapInfo = null;

    private static void LoadRouteMapInfo()
    {
        routeMapInfo = new List<Position>();

        XmlDocument doc = new XmlDocument();
        doc.Load(HttpContext.Current.Server.MapPath(WebConfigurationManager.AppSettings["MapDataFileLocation"]));

        XmlNodeList rtMapInfo = doc.GetElementsByTagName("routemapinfo");

        System.Globalization.CultureInfo ciTR = new System.Globalization.CultureInfo("tr-TR");

        foreach (XmlNode rtMapInfoParamList in rtMapInfo)
        {
            foreach (XmlNode paramNode in rtMapInfoParamList)
            {
                if (paramNode.Name == "point")
                {
                    string latstr = paramNode.Attributes["lat"].InnerText;
                    string lngstr = paramNode.Attributes["lng"].InnerText;

                    if (!string.IsNullOrEmpty(latstr) && !string.IsNullOrEmpty(lngstr))
                    {
                        Position p = new Position();

                        p.latitude = double.Parse(latstr.Replace('.', ','), ciTR.NumberFormat);
                        p.longtitude = double.Parse(lngstr.Replace('.', ','), ciTR.NumberFormat);

                        routeMapInfo.Add(p);
                    }
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Murat Firat
Software Developer (Senior)
Turkey Turkey
Has BS degree on computer science, working as software engineer in istanbul.

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 12 Jul 2010
Article Copyright 2010 by Murat Firat
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid