Greetings
i need to draw an inMemoryFeatureLayer on an existing google map i saw the sample "ShapeFiles over Google map" but its not working here is my code below
InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(180, 102, 255, 102), 10, GeoColor.StandardColors.DarkGreen, 1);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Green, 4, true);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(180, 102, 255, 102), GeoColor.StandardColors.DarkGreen, 1);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
inMemoryFeatureLayer.DrawingQuality = DrawingQuality.HighQuality;
inMemoryFeatureLayer.Open();
inMemoryFeatureLayer.EditTools.BeginTransaction();
PointShape point = new PointShape();
//Builds the polygon based on the structure of the text files with X and Y comma separated.
int i = 0;
while (i <= streamReaders.Length - 1)
{
PolygonShape polygonShape = new PolygonShape();
RingShape ringShape = new RingShape();
string line = null;
while (line != "")
{
line = streamReaders.ReadLine();
if (line != null)
{
string[] strSplit = line.Split(';');
ringShape.Vertices.Add(new Vertex(Convert.ToDouble(strSplit[0]), Convert.ToDouble(strSplit[1])));
point = new PointShape(new Vertex(Convert.ToDouble(strSplit[0]), Convert.ToDouble(strSplit[1])));
}
else
{
break;
}
}
//Remember to add the last vertex with the same X and Y as the first vertex to enclose completely the polygon.
ringShape.Vertices.Add(new Vertex(ringShape.Vertices[0].X, ringShape.Vertices[0].Y));
polygonShape.OuterRing = ringShape;
AreaLB.Text = Convert.ToString(polygonShape.GetArea(GeographyUnit.DecimalDegree, AreaUnit.SquareMeters));
inMemoryFeatureLayer.EditTools.Add(new Feature(polygonShape));
i = i + 1;
}
inMemoryFeatureLayer.EditTools.CommitTransaction();
ShapeFileFeatureLayer AdminLayer1 = new ShapeFileFeatureLayer(MapPath("App_Data\\KSA_Adminbndy\\Adminbndy1.shp"));
ShapeFileFeatureLayer.BuildIndexFile(MapPath("App_Data\\KSA_Adminbndy\\Adminbndy1.shp"), BuildIndexMode.DoNotRebuild);
AdminLayer1.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
AdminLayer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
ShapeFileFeatureLayer AdminLayer3 = new ShapeFileFeatureLayer(MapPath("App_Data\\KSA_Adminbndy\\Adminbndy3.shp"));
ShapeFileFeatureLayer.BuildIndexFile(MapPath("App_Data\\KSA_Adminbndy\\Adminbndy3.shp"), BuildIndexMode.DoNotRebuild);
AdminLayer3.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
AdminLayer3.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
AdminLayer3.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("POLYGON_NM", "Arial", 10, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 3, 3);
AdminLayer3.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
ShapeFileFeatureLayer AdminLayer5 = new ShapeFileFeatureLayer(MapPath("App_Data\\KSA_Adminbndy\\Adminbndy5.shp"));
ShapeFileFeatureLayer.BuildIndexFile(MapPath("App_Data\\KSA_Adminbndy\\Adminbndy5.shp"), BuildIndexMode.DoNotRebuild);
AdminLayer5.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
AdminLayer5.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
AdminLayer5.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("POLYGON_NM", "Arial", 10, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 3, 3);
AdminLayer5.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layerOverlay = new LayerOverlay("الخريطة المبدئية");
layerOverlay.Layers.Add("AdminLayer1", AdminLayer1);
layerOverlay.Layers.Add("AdminLayer3", AdminLayer3);
layerOverlay.Layers.Add("AdminLayer5", AdminLayer5);
layerOverlay.Layers.Add("inMemoryFeatureLayer", inMemoryFeatureLayer);
ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer();
shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, 212, 220, 184), GeoColor.FromArgb(255, 132, 132, 154), 1);
shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
shapeFileFeatureLayer.FeatureSource.Projection = proj4;
google = new GoogleOverlay("خريطة جوجل");
google.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings["GoogleUri"]);
google.GoogleMapType = GoogleMapType.Normal;
LayerOverlay shapeOverlay = new LayerOverlay("خريطة الحيازة", false, TileType.SingleTile);
shapeOverlay.Layers.Add("inMemoryFeatureLayer", inMemoryFeatureLayer);
shapeOverlay.TransitionEffect = TransitionEffect.None;
Map1.CustomOverlays.Add(shapeOverlay);
inMemoryFeatureLayer.Close();
Thanks