====== Source Code WebEditionSample GPStoGoogleMap CS 100108.zip ====== ====TestForm.aspx.cs==== using System; using System.Configuration; using ThinkGeo.MapSuite.Core; using ThinkGeo.MapSuite.WebEdition; namespace GPStoGoogleMap { public partial class TestForm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); Map1.CurrentExtent = new RectangleShape(-10608900,4716556,-10604285,4714110); Map1.MapUnit = GeographyUnit.Meter; Map1.MapTools.OverlaySwitcher.Enabled = true; Map1.MapTools.MouseCoordinate.Enabled = true; //Adds the Google Map as an overlay GoogleOverlay google = new GoogleOverlay("Google Map"); google.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings["GoogleUri"]); google.GoogleMapType = GoogleMapType.Normal; Map1.CustomOverlays.Add(google); LayerOverlay layerOverlay = new LayerOverlay("PointOverlay", false, TileType.SingleTile); layerOverlay.TransitionEffect = TransitionEffect.None; InMemoryFeatureLayer pointLayer = new InMemoryFeatureLayer(); pointLayer.Open(); pointLayer.Columns.Add(new FeatureSourceColumn("Text")); pointLayer.Close(); //Sets the projection parameters to go from Geodetic (EPSG 4326) or decimal degrees to Google Map projection (Spherical Mercator). // Proj4Projection proj4 = new Proj4Projection(); proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326); proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString(); //Applies the projection to the InMemoryFeatureLayer so that the point in decimal degrees (Longitude/Latitude) can be //match the projection of Google Map. pointLayer.FeatureSource.Projection = proj4; //Values in Longitude and Latitude. double Longitude = -95.2809; double Latitude = 38.9543; //Creates the feature made of a PointShape with the Longitude and Latitude values. Feature GPSFeature = new Feature(new PointShape(Longitude, Latitude)); //Format the Longitude and Latitude into a nice string as Degrees Minutes and Seconds string LongLat = DecimalDegreesHelper.GetDegreesMinutesSecondsStringFromDecimalDegreePoint(GPSFeature); //Sets the InMemoryFeatureLayer to have it displayed with Square symbol and with text. GPSFeature.ColumnValues.Add("Text",LongLat); pointLayer.InternalFeatures.Add(GPSFeature); pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Square, GeoColor.StandardColors.Red, GeoColor.StandardColors.Black, 2, 12); pointLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Text", "Arial", 12, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 3, -10, 10); pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add(pointLayer); Map1.CustomOverlays.Add(layerOverlay); } } } } ====TestForm.aspx==== <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestForm.aspx.cs" Inherits="GPStoGoogleMap.TestForm" %> <%@ Register Assembly="WebEdition" Namespace="ThinkGeo.MapSuite.WebEdition" TagPrefix="cc1" %> Use Google Map
<%-- This sample displays a google map. Click buttons below to switch between different Google maps.


--%>