Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 9 of 9

Get Lat/Lon of ShadedCircle

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 ...

  1. #1
    rorgmanche is offline Junior Member White Belt
    Join Date
    Aug 2005
    Posts
    8

    Get Lat/Lon of ShadedCircle

    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 ?

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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...

  3. #3
    rorgmanche is offline Junior Member White Belt
    Join Date
    Aug 2005
    Posts
    8
    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:
    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
    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 !!
    However, when i select a point on the map like a city, the pushpin is putting exactly on the selection.

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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 ?

  5. #5
    rorgmanche is offline Junior Member White Belt
    Join Date
    Aug 2005
    Posts
    8
    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
    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
    It seems you are right. The selection doesn't seem to be made. If i display data with pushpin it is the same problem !
    How can i get the selected location ?

    Rorgmanche

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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.

  7. #7
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Your code seems ok to me. This is how I did the test:

    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, "");
                }
    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.

    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 ?

  8. #8
    rorgmanche is offline Junior Member White Belt
    Join Date
    Aug 2005
    Posts
    8
    Indeed Altitude is not = 1.

  9. #9
    rorgmanche is offline Junior Member White Belt
    Join Date
    Aug 2005
    Posts
    8
    hi,

    I have put the following line code in the "SelectionChange" routine (the first instruction):
    Code:
    oMap.Altitude = 1
    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.

    thanks for your reply,

    Rorgmanche

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96