I am testing out the ThinkGeo map suite for a project we are looking into. I am able to load some basic shapefiles into the map control and view them, however, I seem to have an issue with a handful of other shapefiles not displaying. The one I am trying to load now, displays a line down the center of each road in the county. I have tested the shape file, and it displays properly in our ArcGIS software. This is the code I am using. Any suggestions would be appreciated.
OpenStreetMapOverlay osmOverlay = new OpenStreetMapOverlay("Open Street Map");
MapHarford.CustomOverlays.Add(osmOverlay);
string mapPath = System.String.Empty;
mapPath = MapPath("~/App_Data/PlowMaps/20140929Centerline.shp");
ShapeFileFeatureLayer.BuildIndexFile(mapPath);
ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(mapPath);
shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.LocalRoad1;
MapHarford.HighlightOverlay.HighlightStyle = new FeatureOverlayStyle(GeoColor.FromArgb(150, GeoColor.FromHtml("#449FBC")), GeoColor.FromHtml("#014576"), 1);
MapHarford.HighlightOverlay.Style = new FeatureOverlayStyle(GeoColor.SimpleColors.LightBlue, GeoColor.SimpleColors.LightBlue, 0);
Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(2248);
proj4.ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(3857);
shapeFileFeatureLayer.FeatureSource.Projection = proj4;
shapeFileFeatureLayer.Open();
MapHarford.CurrentExtent = shapeFileFeatureLayer.GetBoundingBox();
shapeFileFeatureLayer.Close();
shapeFileFeatureLayer.Name = "Centerline";
MapHarford.DynamicOverlay.Layers.Add("Centerline", shapeFileFeatureLayer);
Shape file not displaying on Map
Hi Steve,
Thanks for your post!
Could you please try to add
shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Below your code
shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.LocalRoad1;
And have a try?
If this still not work, maybe it’s the projection issue that your shapes are not render in right location, could you please provide your shape file to us and we can find the root cause?
Thanks,
Gary