# Is there a way to click Marker?

**URL:** <https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277>\
**Category:** MapWinGIS\
**Created:** [October 5, 2019, 1:34pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277 "2019-10-05T13:34:02Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 5, 2019, 1:34pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/1 "2019-10-05T13:34:02Z")

</div>

Hello,  
Is there a way to click Marker then view its coördinates?  
Anyone know how to do this?..thanks in advance

 ![MarkerMouseEvent](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/970c316051737bfd07af6f6b025fb155795ea277.png)

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [October 5, 2019, 4:33pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/2 "2019-10-05T16:33:57Z")

</div>

[This example](https://www.mapwindow.org/documentation/mapwingis4.9/_show_attributes_8cs-example.html) shows how to identify a shape within a layer, and get it’s properties. You can also get it’s Shape, and extract the x, y coordinate.

Note that the above example is based on hovering, using the Identify feature. There is also a way to [Select features](https://www.mapwindow.org/documentation/mapwingis4.9/group __shapefile__ selection.html) using the mouse click, but we don’t have a published example of that. If it helps, I may be able to come up with an example.

Hope this can get you started.

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 5, 2019, 4:58pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/3 "2019-10-05T16:58:46Z")

</div>

@jerryfaust thank you for the info. and for the link I’ll try it out see if I can get it working,

---

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 5, 2019, 5:27pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/4 "2019-10-05T17:27:17Z")

</div>

i tried the example  
 ![CodeView](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/b24c4f58cc77ede369d896bee1487e6b51d9ed05.png)  
but when i run the program, i got an error  
 ![ErrorView](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/42b1fdf604d5bd84fb98100dfa7e5a6556192319.png)

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [October 8, 2019, 7:08pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/5 "2019-10-08T19:08:53Z")

</div>

Hello @SandMan88

Sorry for the delayed response. I built a simple app almost identical to your example, and I’m able to run. So I’m guessing that there’s perhaps some fundamental issue, perhaps with the map control settings or something. **Would you mind zipping up your entire sample project so that I can try it here?** You don’t have to send your data, I can use one of my shapefiles.

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 9, 2019, 1:55am UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/6 "2019-10-09T01:55:25Z")

</div>

Hello @jerryfaust  
Here is My Sample Project,Thank you for time,  
i installed MapWinGIS-only-v5.0.0.0-x64 and i’m using visual studio 2012  
[MapWinGIS.zip](https://mapwindow.discourse.group/uploads/short-url/3A6XPvegqcF1cfmUvvwJrvpPsod.zip) (560.3 KB)

---

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 9, 2019, 2:52am UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/7 "2019-10-09T02:52:49Z")

</div>

hello @jerryfaust i got running, it shows no error i use MapWinGIS-only-v5.0.1.0-Win32…sorry that was my bad… gonna try it in my marker…thank you soo much for your time

---

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 9, 2019, 1:43pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/8 "2019-10-09T13:43:29Z")

</div>

hello @jerryfaust, i got it running, i have three marker when i hover to the first one it works but for the other two all i got is x=0 and y=0 please help  
this is my Code  
 ![getXY](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/e859e9f72fe571f157d4cb7c128703aa81e068d3.png)  
I’ve been wondering if its possible to add attribute to marker ???  
…thank n advance

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [October 9, 2019, 5:55pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/9 "2019-10-09T17:55:25Z")

</div>

I think the problem is in the following line:

```
sf.get_Shape(e.shapeIndex).get_XY(0, ref x, ref y);

```

You correctly use `e.shapeIndex` to get the shape, but the point within the shape will always be at index 0.

Jerry.

---

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 10, 2019, 1:06am UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/10 "2019-10-10T01:06:59Z")

</div>

Thank you @jerryfaust ,I really appreciate your attention. I got it running,  
i was wondering can i add attribute to my marker, if yes can you give an exzample or link ,  
i just want to add date  
 ![LoadMarker](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/da26ef9063f7b992b84327047ac2132d2c21d785.png)  
…thanks in advance

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [October 10, 2019, 4:05am UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/11 "2019-10-10T04:05:57Z")

</div>

You would use the [EditAddField](https://www.mapwindow.org/documentation/mapwingis4.9/group __shapefile__ table.html#ga158f17d91bd1ffc32332fd64df224be5) call. And you need to wrap it in the sf.StartEditingTable and sf.StopEditingTable calls.

---

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 10, 2019, 5:08am UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/12 "2019-10-10T05:08:44Z")

</div>

@jerryfaust… thank you

---

<div class="post-metadata">

**Author:** ![SandMan88](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@SandMan88](https://mapwindow.discourse.group/u/SandMan88)\
**Post date:** [October 10, 2019, 7:20am UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/13 "2019-10-10T07:20:05Z")

</div>

hello @jerryfaust ,I really appreciate your time and attention, i got it running…a million thanks

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [October 14, 2019, 4:00pm UTC](https://mapwindow.discourse.group/t/is-there-a-way-to-click-marker/277/14 "2019-10-14T16:00:03Z")

</div>

This topic was automatically closed after 5 days. New replies are no longer allowed.
