ThinkGeo.com    |     Documentation    |     Premium Support

Need Help With Text Next to Marker

Have a program that places a graphic of a bus on a map based on the lan and lon, The feature overide is y (lon), x (lat), and the vehicle number is the feature ID. I need that vehicle number to appear by the marker image (the bus). I’ve looked at several examples and nothing seems to be working. Here’s a small snippet of the code that adds the vehicle location and the marker overlay.

        'Add vehicle location to feature layer
        Frm_DispatchMap.DispMapInmemoryFeatureLayer.InternalFeatures.Add(New Feature(lon, lat, veh))

        'Active Vehicle Overlay
        Frm_DispatchMap.DispMapMarkerOverlay.FeatureSource = Frm_DispatchMap.DispMapInmemoryFeatureLayer.FeatureSource

        'Zoom to OverLay


        Frm_DispatchMap.DispMapMarkerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Image = My.Resources.Bus_13x16
        Frm_DispatchMap.DispMapMarkerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Height = 16
        Frm_DispatchMap.DispMapMarkerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Width = 16
        Frm_DispatchMap.DispMapMarkerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
        Frm_DispatchMap.DispMapMarkerOverlay.MapControl = Frm_DispatchMap.Map_DispatchMap
        Frm_DispatchMap.Map_DispatchMap.Overlays.Add(Frm_DispatchMap.DispMapMarkerOverlay)

Hi Steven,

We have a sample named VehicleTracking here: https://github.com/ThinkGeo/VehicleTrackingSample-ForWinForms

It looks your question is how to label the feature ID in your marker, for winforms edition, I think you can try these ways:

  1. Pre-build images which contains the values, then you just need to set it, this should looks best.
  2. Build another layer for example inmemoryFeatureLayer, don’t set shape style, just set text style, adjust the yOffset ans xOffset, make the text render behind marker, this maybe don’t works because the zindex, we can discuss it more detail if you want to choose this way, and the text maybe not render so well for example it’s too long than marker image.
  3. The marker is added as a control in MarkerOverlay, you can also try to add another control which render text.

Wish that’s helpful, and do you think set tooltip text in marker also works for your scenario?

Regards,

Ethan

Ethan,

I’ve tried to display the text for a point to no avail. All I want to do is display the ID or TAG text where the point is at. I just can’t seem to get it. I created a new InMemoryFeatureLayer, didn’t set a DefaultPointStyle, but did set a DefaultTextStyle. I queried my InMemoryFeatureLayer and it shows 40 rows of data but nothing shows on the map. I zoom to the InMemoryFeatureLayer and it zooms to the proper area for the points but nothing shows on the map.

Thanks,
Steve

Hi Steve,

Here is a sample, it generate random 20 points and label them, I think you can modify it and show us what’s the problem you face so we can help you on it.

9576.zip (11.8 KB)

Regards,

Ethan

Perfect, that example allowed me to see how it was done on a simple basic level. I took that info and expanded it and can now show both the vehicle icon and the text. THANK YOU once again !!!

Hi Steven,

I am glad to hear that’s helpful.

Any question please let us know.

Regards,

Ethan