Dear Sir,Madam,
We want read the text column name from map canvas please give a solution.
thanks & Regards
Harish Upadhyay
How to read text column name from map canvas
Hi Harish,
Thanks for your post and welcome to MapSuite World, do you mean get the text column from GdiPlusGeoCanvas class, If yes, I am sorry to say that there isn’t a existing API to get it for now. If not would you please give us more information about your scenario,
Thanks
Summer
Dear Sir,
My text column add process given below
ShapeFileFeatureLayer austinStreetsLabelLayer = new ShapeFileFeatureLayer(@"…\SampleData\Data\austinstreets.shp");
austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.LocalRoad1("FENAME"));
austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add("AustinStreetsLabelLayer", austinStreetsLabelLayer);
winformsMap1.Overlays.Add(staticOverlay);
winformsMap1.CurrentExtent = new RectangleShape(-97.749141617693908, 30.300592918607943, -97.741202279009826, 30.29492809316849);
winformsMap1.Refresh();
After that i want to read text column Name ("FENAME") please give me a solution .
public void read_column_name(string namre_of_laye)
{
FeatureLayer worldLayer = winformsMap1.FindFeatureLayer(namre_of_laye);
worldLayer.Open();
Collection selectedFeatures = worldLayer.FeatureSource.GetAllFeatures();
worldLayer.Close();
}
Regards
Harish Upadhyay
Hi Harish,
Following code is for your consideration, would you please try it?
public void read_column_name(string namre_of_laye)
{
string columnName;
FeatureLayer layer = winformsMap1.FindFeatureLayer(namre_of_laye);
if (layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle != null)
{
columnName = layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.TextColumnName;
}
else
{
foreach (Style style in layer.ZoomLevelSet.ZoomLevel01.CustomStyles)
{
if (style is TextStyle)
{
columnName = ((TextStyle)style).TextColumnName;
}
}
}
}
Thanks,
Summer
Dear Sir,
This function working properly.
Thanks
Harish Upadhyay
Hi Harish,
if you have any more question , please feel free to let us know.
Best Regards
Summer