ThinkGeo.com    |     Documentation    |     Premium Support

.shp files data doesn't show in control

Hello there,

I am using the ThinkGeo Map v 9.0.and I am faced with difficulties displaying .shp files on control.

When I try to load a shape file, the map is white, and nothing is display.

RPMap.MapUnit = GeographyUnit.DecimalDegree;
RPMap.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);
LayerOverlay worldOverlay = new LayerOverlay();
worldOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)));

ShapeFileFeatureLayer placeCityLayer =
new ShapeFileFeatureLayer(@"…\WorldStreet_3rdPartyData\Place\City\ms_place_city.shp");
placeCityLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Gray, 1, true);
placeCityLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Circle, GeoBrushes.White, new GeoPen(GeoColors.Black, 2), 7);
placeCityLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColors.Black, 2), GeoBrushes.White);
placeCityLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

worldOverlay.Layers.Add(“PlaceCity”, placeCityLayer);
RPMap.Overlays.Add(“WMK”, worldOverlay);
RPMap.Refresh();

What can be the problem?

Sincerely,

Aleksandr

Bathymetry.zip (2.3 MB)

Thanks Aleksandr,
The Shape file you provide is 3857 project while you set the map as DecimalDegree. You need add a line before worldOverlay.Layers.Add(“PlaceCity”, placeCityLayer);

.....
placeCityLayer.FeatureSource.Projection = new Proj4Projection(3857, 4326);
worldOverlay.Layers.Add(“PlaceCity”, placeCityLayer);

The you will get the correct map show up.

Thanks

Frank

1 Like

It is working now, thanks!

Thanks Alexander,
Good to know it works. Go ahead let us know if you have any more questions.

Thanks

Frank