Hi,
I have import some data from a txt file and i display them on the map with shadedcircles. I would like to know if it is possible to get the parameters of a shadedcircle (lat, lon, color, and others) when i click or dblclick on it ?
This is a discussion on Get Lat/Lon of ShadedCircle within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I have import some data from a txt file and i display them on the map with shadedcircles. I ...
Hi,
I have import some data from a txt file and i display them on the map with shadedcircles. I would like to know if it is possible to get the parameters of a shadedcircle (lat, lon, color, and others) when i click or dblclick on it ?
Hi,
You can put an event handler in SelectionChange. If you select the circle it will fire. There you can check out what it selected and calculate the position, radius etc...
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
Hi, thanks for your response.
I have used the "CalcPos" function from Gilles Kohl, there is a problem. I explain:
I used the code below:
I use Loc2 to verify the lat/long calculation, putting a pushpin. Normally the pushpin should be on my shadedcircle but it doesn't. I have the impression that the pushpin is installed at the near point of my selected shadedcircle !!Code:Private Sub AxMappointControl1_SelectionChange Dim Selection As MapPoint.Location Loc = oMap.Selection CalcPos(oMap, Loc, Lat, Lon) Altitude = oMap.Altitude Loc2 = oMap.GetLocation(lat, lon, Altitude) oPushPin = oMap.AddPushpin(Loc2, "Point route") oPushPin.Symbol = 82 EndSub
However, when i select a point on the map like a city, the pushpin is putting exactly on the selection.
Hi,
I use same code to find the center of a drawed circle. Just verifyed again by placing a pushpin on the point if the circle gets selected, and it is placed right in hte center of it. Can you eventually try the same code with a normal circle to see if the shading has something to do with it ?
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
Hi,
I think there is a problem getting the actually selected point on the map. I t seems that i always get the same coordonnates ! (CalcPos always returns the same lat / lon
It seems you are right. The selection doesn't seem to be made. If i display data with pushpin it is the same problem !Code:Dim oPushPin As MapPoint.Pushpin Dim Loc, Loc2 As MapPoint.Location Dim lat, lon, Altitude As Double Loc = oMap.Location CalcPos(oMap, Loc, lat, lon) Altitude = oMap.Altitude Loc2 = oMap.GetLocation(lat, lon, Altitude) oPushPin = oMap.AddPushpin(Loc2, "Point route") oPushPin.Symbol = 82
How can i get the selected location ?
Rorgmanche
Hi,
Before we continue, can you check if you have Altitude to a low value ? I always set it to 1 to be sure to have accurate results. But I'm so uses to it that I do this always, even en situations where it is probably not needed. Please try first.
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
Hi,
Your code seems ok to me. This is how I did the test:
If this event handler is installed and I dcaw a circle the immediatly pushpin is diplayed and it is exacly in the center point of the circle.Code:private void MP_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e) { Map map = MP.ActiveMap; Shape s = map.Selection as Shape; if (s != null) { double lat, lon; Location loc = s.Location; pos.CalcPos(loc, out lat, out lon); map.AddPushpin(loc, ""); }
the CalcPos is also based on the same articlle. How large is the deviation you get ? Can you also try to do it very zoomed in and on a whell lknown latitude / longitude to see of your calcPos function does not do a rounding error or so ?
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
Indeed Altitude is not = 1.
hi,
I have put the following line code in the "SelectionChange" routine (the first instruction):
but it is always the same. However, when i select any point on a route the routine is ok. I think it is not possible to select a shaddedcircle... I am desperate.Code:oMap.Altitude = 1
thanks for your reply,
Rorgmanche
There are currently 1 users browsing this thread. (0 members and 1 guests)