Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

AJAX Enabled Google Maps ASP.NET Control

, 12 Jul 2010
Using the Google Maps API on server side with AJAX support.
GoogleMap.zip
GoogleMapTest
App_Code
vssver2.scc
App_Data
Bin
GoogleMap.dll
vssver2.scc
images
flag1.ico
flag2.ico
marker1.ico
marker2.ico
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)

About the Author

Murat Firat
Software Developer (Senior)
Turkey Turkey
Has BS degree on CS, working as SW engineer at istanbul.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 12 Jul 2010
Article Copyright 2010 by Murat Firat
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid