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
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Check out if GPS pos is on a Route

This is a discussion on Check out if GPS pos is on a Route within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello there! First thank you for this great forum, i searched through it but couldn't find exactly what i am ...

  1. #1
    kristijan is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    7

    Check out if GPS pos is on a Route

    Hello there!

    First thank you for this great forum, i searched through it but couldn't find exactly what i am looking for.

    I have a problem, i don't exactly know how to solve.
    I have a route going from A to B.
    I get an GPS coordinate.
    How do i check if the GPS position is on the Route between A and B ?

    Thank you for any suggestions !

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

    The only way to know this is to draw a polygon around the route. The poligon has to be wider than the route because there could be traffic deviations.

  3. #3
    kristijan is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    7

    mhm

    thank you for your response.
    this sounds very difficult. I think i don't quite understand, how do i draw the polygon ? Am i able to move along the route, which is calculatet and displayed in Mappoint. Do i draw the polygon then in mappoint ?



    Might there be any hope that in mappoint 2006 this would be better ?

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

    Sorry that I was so unclear. First let mappoint calculate the route for the vehicle. Then you can draw a polygon around the route. For each point in the polygon you draw you have to save the coordinates. This you can do in a beforeClick event handler.

    To actual see if each GPS position of the car is within the polygon has nothing to do with mappoint anymore. Your program has to calculate it. It can be done following way:

    Reduce the polygon to a triangle by replacing 2 successive sides by 1 new side, then calculate if the residual riangle contains the point. If not then calculate on the next triangle etc...

    Not very easy done but not a big problem tough.

  5. #5
    calv1ns's Avatar
    calv1ns is offline Member Green Belt
    Join Date
    Mar 2005
    Posts
    91

    Hey Wil

    Hey Wil

    I'm not getting what you mean too... do you have a bit of code or pseudo code that gives us a better idea... It seems your solution is brilliant but I'm not sure the majority of us are understanding it.

    Ciao,
    Calv1ns

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

    I guess you right. If I read my explanation then I dont understeand eahter

    This it is difficult because I dont know all the naming of figures etc. I try to make some drawings to explain what I mean, because even with some pseudocode it will be difficult, and it is really not so difficult, I have done sutch things several times.

    I'll keep in touch

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

    Whell I made a little drawing to explain what I mean. See http://www.mestdagh.biz/mp/polygon.gif

    The top drawing is the polygon where the vehicle is maybe in or maybe not. How to check this simple. See second drawing.

    we connect 2 sides (starting at random place), eg the red one, and by connecting we only have a triangle. Since we have not a matematical figure it is mutch more simple to calculate if vehicle is in it or not. If it is not in then we connect next point, the green one, if not in then the blue, etc...

    if we are at the end then we have red alert: vehicle is not where it should be.

    Is this more clear ?

    Maybe this is stuff for a little article, but then better explaned and with some code samples

  8. #8
    calv1ns's Avatar
    calv1ns is offline Member Green Belt
    Join Date
    Mar 2005
    Posts
    91
    HI Wil

    Sorry I missed your response on this item. Must of slipped through somehow.

    It appears the link to the gif file is no longer available?

    So Yes likey more clear - but No I didn't get a chance to look at it...

    Can you verfify the link?

    Thanks,
    Ciao,
    Calv1ns

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

  10. #10
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60
    Another approach to point-in-polygon calculations is outlined in Sedgwick's "Algorithms" (I see this is now a multi-volume work: I only have the 1 volume edition).

    Basically, you project a 'ray' from your point to inifinity. Count the number of times it crosses the polygon edge. If this is odd, then the point must be in the polygon. If it is even, then the point must be outside the polygon.
    I've implemented it for cartesian coordinates, and the maths becomes pretty simple if your ray is parallel to one of the axes.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sanity Check Please......Pushpin help
    By EdB in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 02-22-2005, 08:44 AM
  2. Is there way to check if you're on a road
    By Omair in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-05-2005, 07:56 AM
  3. need to check accuracy of MP2004
    By jaharris67 in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-16-2004, 12:28 AM
  4. GPS position check
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 14
    Last Post: 01-19-2004, 02:00 AM
  5. How to check if an address is valid?
    By amanuel in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 08-29-2002, 10:42 PM

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