Hi Pablo,
Here we provide a candidate solution which may meet your requirement. The steps are as follows:
1. Load region shape file
2. Examine province shape file to get the inner lines for provinces, then save lines into a InMemoryFeatureLayer
3. Load this InMemoryFeatureLayer
We also provide some code snippet for your reference.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
Map1.CurrentExtent = new RectangleShape(-125, 72, 50, -46);
Map1.MapUnit = GeographyUnit.DecimalDegree;
ShapeFileFeatureLayer regionLayer = new ShapeFileFeatureLayer(MapPath("~/SampleData/Region.shp"));
regionLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.County1;
regionLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
InMemoryFeatureLayer innerLineLayer = new InMemoryFeatureLayer();
innerLineLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Interstate1;
innerLineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
ShapeFileFeatureLayer provinceLayer = new ShapeFileFeatureLayer(MapPath("~/SampleData/Province.shp"));
provinceLayer.Open();
Collection<Feature> features = provinceLayer.QueryTools.GetAllFeatures(ReturningColumnsType.NoColumns);
provinceLayer.Close();
Collection<PolygonShape> polygons = new Collection<PolygonShape>();
foreach (Feature feature in features)
{
MultipolygonShape multiPolygon = (MultipolygonShape)feature.GetShape();
foreach (PolygonShape polygon in multiPolygon.Polygons)
{
polygons.Add(polygon);
}
}
foreach (PolygonShape polygon in polygons)
{
foreach (PolygonShape anotherPolygon in polygons)
{
if (polygon.Id != anotherPolygon.Id)
{
LineShape line = new LineShape();
MultipointShape resultMultiPoint = polygon.GetCrossing(anotherPolygon);
if (resultMultiPoint != null && resultMultiPoint.Points.Count > 0)
{
foreach (PointShape point in resultMultiPoint.Points)
{
line.Vertices.Add(new Vertex(point.X, point.Y));
}
if (line.Vertices.Count > 1)
{
innerLineLayer.InternalFeatures.Add(line.GetFeature());
}
}
}
}
}
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.TileType = TileType.MultipleTile;
staticOverlay.Layers.Add(regionLayer);
staticOverlay.Layers.Add(innerLineLayer);
Map1.CustomOverlays.Add(staticOverlay);
}
Please let us know if you have further questions.
Regards,
Ivan