ThinkGeo.com    |     Documentation    |     Premium Support

Street marker

Hello


I want to draw a marker on a certain street that i chose, i can get the layer to draw a line for the segment of street but i want a point such as a marker. Can you help me with that?


Thanks



Saddam,


 Well, streets are line based features so they are displayed using a LineStyle. If you want to display a street with a point, you are going to have to choose what point of the street. Below is a code sample, where the mid point of street is chosen.


 



 



    winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
           
    winformsMap1.BackColor = Color.LightGoldenrodYellow;

    ShapeFileFeatureLayer streetLayer = new ShapeFileFeatureLayer(@"..\..\data\Riyadh.shp");
    streetLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.LocalRoad2;
    streetLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

    LayerOverlay staticOverlay = new LayerOverlay();
    staticOverlay.Layers.Add("StreetLayer", streetLayer);
    winformsMap1.Overlays.Add(staticOverlay);

    InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();
    inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Blue,12);
    inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

    streetLayer.Open();
    Collection<Feature> features = streetLayer.FeatureSource.GetFeaturesByColumnValue("REC", "116116");
    streetLayer.Close();

    MultilineShape multilineShape = (MultilineShape)features[0].GetShape();
    PointShape pointShape = multilineShape.GetPointOnALine(StartingPoint.FirstPoint, 50);

    inMemoryFeatureLayer.Open();
    inMemoryFeatureLayer.InternalFeatures.Add(new Feature(pointShape));
           
    LayerOverlay layerOverlay = new LayerOverlay();
    layerOverlay.Layers.Add(inMemoryFeatureLayer);
    winformsMap1.Overlays.Add(layerOverlay);

    winformsMap1.CurrentExtent = inMemoryFeatureLayer.GetBoundingBox();
    inMemoryFeatureLayer.Close();

    winformsMap1.Refresh();

 


 


You might also be interested in looking at the sample Start End LineStyle"in the Code Community. It shows how to inherit from LineStyle to have the start end end points displayed distinctly. Keep in mind that those are just some examples for displaying a point on a street. Map Suite is very flexible and lets you implement as you wish.wiki.thinkgeo.com/wiki/Map_Suite_De..._LineStyle