Hi all,
How to display a village name/town name etc. for a point i.e coordinate in a map?
My coordinates will be from a database .. The table will contain the name of the village.
Hi all,
How to display a village name/town name etc. for a point i.e coordinate in a map?
My coordinates will be from a database .. The table will contain the name of the village.
In the layer’s TextStyle set TextColumnName to the database column holding the town names.
Hi Vanlal,
There are several resources that can help you learn more about Map Suite and how best to achieve your goals.
To start out I recommend reviewing our Map Suite Desktop Edition Quick Start Guide that can provide you with many of the basics such as Styles and Labeling: wiki.thinkgeo.com/wiki/Map_S...tart_Guide
We also provide extensive sample applications with the Evaluation Edition download that demonstrate many other features of Map Suite in working sample applications. These sample applications are installed at a default location of Start Button - All Programs - ThinkGeo - Map Suite Desktop Edition - VS2010 Samples.
I was finally able to plot my text with my point …
If I keep on zooming , the text is gone , when i zoom out only , then it is displaying…
What should i adjust to make it correct?
ShapeFileFeatureLayer indianLabelLayer = new ShapeFileFeatureLayer(@"C:\IND_adm\IND_adm3.shp");
indianLabelLayer.RequireIndex = false;
indianLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("name", "Arial", 7, DrawingFontStyles.Bold, GeoColor.FromArgb(255, 91, 91, 91));
indianLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.PointPlacement = PointPlacement.Center;
indianLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping;
// indianLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.DuplicateRule = LabelDuplicateRule.NoDuplicateLabels;
indianLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
InMemoryFeatureLayer pointsLayer = new InMemoryFeatureLayer();
pointsLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.GetRandomGeoColor(RandomColorType.All)), 5);
pointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
// Display the values.
foreach (VillageClass value in ht.Values)
{
PointShape pointShape = new PointShape(value.latx, value.laty);
Feature feature = new Feature(value.latx, value.laty);
indianLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.LabelPositions.Add(value.id, new WorldLabelingCandidate(value.name, pointShape));
pointsLayer.InternalFeatures.Add(feature);
}
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add("PointsLayer", pointsLayer);
staticOverlay.Layers.Add("indianLabelLayer", indianLabelLayer);
winformsMap1.Overlays.Add("PointsOverlay", staticOverlay);
winformsMap1.Refresh(staticOverlay);
}
Hi Vandal,
In your loop you are applying setup a new property for the ZoomLevelSet.ZoomLevel01 ONLY. If you want this to be applied to all the other ZoomLevels of the ZoomLevelSet you would need to conduct an ApplyUntilZoomLevel.ZoomLevel20 after you setup your new LabelPositions.
foreach (VillageClass value in ht.Values)
{
PointShape pointShape = new PointShape(value.latx, value.laty);
Feature feature = new Feature(value.latx, value.laty);
indianLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.LabelPositions.Add(value.id, new WorldLabelingCandidate(value.name, pointShape));
pointsLayer.InternalFeatures.Add(feature);
}
indianLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.ZoomLevel20;
I tried the above code, it is still not showing the labels, when i zoomed down to a deeper level…
Vandal,
I want to be sure what your goal is before we continue.
It seems you want to change the LabelPositions for the indianLabelLayer labels to the locations found in your ht file.
Are you sure you do not want to simply create new points from your ht file and then label those points with the village names?
Are you looking to display both your administrive areas from your IND_adm3.shp file and also display the Village names from your pointLayer?
Or do you really want to have your administrative area labels to change position based on your ht file?
The code you have is taking the lat/long information from ht, using this lat/long to change the position of the labels for your Administrative area shapefile, and then create a new point in the pointLayer that only has a PointStyle assigned (no TextStyle is assigned to the pointsLayer). So you are only moving the administrative area labels to new postitions.
As you can tell I am guessing as to what you you want to see on your map.Any description about what you want to see would help me to direct you to a better solution.
I have a hashtable(ht) in which ID of a village is the key and the class VillageClass is mapped to this key.VillageClass contains Name,Latitude,Longitude etc… This i have already set it from my database.
Are you sure you do not want to simply create new points from your ht file and then label those points with the village names?
Yes, i want to create a point on this coordinates and label them with the village name.
When i zoom the points do not change , but the labels appear at a certain level only…
Regards,
Vanlal
Vanlal,
You need to then setup a separate Layer for your Villages so that you can apply the Village names in your hashtable to the correct village points.
You will need to loop through your hashtable and create a Feature in an InmemoryFeatureLayer for each village. You will also need to create the necessary columns within the InMemoryFeatureLayer and then parse the correct column values out of the hashtable for each Feature.
We have a sample application that demostrates how one can do this with a text file located here:
wiki.thinkgeo.com/wiki/Map_S...atureLayer