ThinkGeo.com    |     Documentation    |     Premium Support

Loading External Shape File into Think Geo

I am trying to load external shape file on Map control.
I have defined 2 overlays

  1. BaseMapLayersOverlay (loading WorldMapKitRenderLayer in this Overlay)
  2. CustomMapLayersOverlay (loading custom shape file layer into this overlay)

Once BaseMapLayersOverlay is loaded, ThinkGeo Base Map is loading fine , however when I try to add custom layer, the base Map is not getting displayed, but only new layer is getting displayed.

The extents for BaseMap and Custom Layer belong to same town and should be same.
Need the custom shape layer to be shown on top of the map, so user can relate the points to actual address.

Following code is used to load custom layer

#region Add Custom Layer
private void AddCustomLayer()
{

        string shapeLocation = @"Layer\GeoWaterHydrant.shp";
        ShapeFileFeatureLayer.BuildIndexFile(shapeLocation, BuildIndexMode.Rebuild);
        ShapeFileFeatureLayer shapeLayer = new ShapeFileFeatureLayer(shapeLocation);
        shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Highway1;
        shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
        shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1;

        shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


        Proj4Projection proj4Projection = new Proj4Projection();
        proj4Projection.InternalProjectionParametersString = "+proj=tmerc +lat_0=0 +lon_0=117 +k=0.9996 +x_0=500000 +y_0=10000000 +a=6377397.155 +b=6356078.963 +towgs84=-404.78,685.68,45.47,0,0,0,0 +units=m +no_defs  no_defs";

        proj4Projection.ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326); //Geodetic (Longitude/Latitude)

        proj4Projection.Open();

        shapeLayer.FeatureSource.Projection = proj4Projection;
        shapeLayer.Open();


        LayerOverlay overlay = (LayerOverlay)Map1.Overlays["CustomMapLayersOverlay"];
        overlay.Layers.Add(shapeLayer);
        
        Map1.CurrentExtent = shapeLayer.GetBoundingBox();

        Map1.Refresh();
    }
    #endregion

Hi Saeer,

Please see the ticket you created.

Thanks,
Peter