MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Get new Lat & Lon from speed

This is a discussion on Get new Lat & Lon from speed within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Well its more like a dummy simulator which keeps on updating new location of latitude & longitude from the previous ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  #11 (permalink)  
Old 05-14-2008
Member
Yellow Belt
 
Join Date: Mar 2008
Posts: 37
Re: Get new Lat & Lon from speed

Well its more like a dummy simulator which keeps on updating new location of latitude & longitude from the previous inserted lat & lon by the user(as I already told you in this case i am not using any hardware or any txt file). Its just looking like data comes from original GPS and it act as dummy simulator.I tried for it but cant able to get how I can do it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12 (permalink)  
Old 05-14-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,378
Blog Entries: 1
Re: Get new Lat & Lon from speed

How far have you gotten or do you need help to start the code?

Where are you stuck?

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13 (permalink)  
Old 05-14-2008
Member
Yellow Belt
 
Join Date: Mar 2008
Posts: 37
Re: Get new Lat & Lon from speed

I need some idea how I can start to do it.
Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14 (permalink)  
Old 05-14-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,378
Blog Entries: 1
Re: Get new Lat & Lon from speed

I think the easiest way to get started with MapPoint programming is automating it through Excel VBA... there are some tutorials here:

Working With Excel and MapPoint - MP2K Magazine

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15 (permalink)  
Old 05-14-2008
Member
Yellow Belt
 
Join Date: Mar 2008
Posts: 37
Re: Get new Lat & Lon from speed

I am working on my project from the last month using C# and interfacing with mappoint. I know basics. Just want to know any idea as I don't know how to get new lat, lon from calculation by inserting lat,lon & speed. Please give me hint.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16 (permalink)  
Old 05-14-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,378
Blog Entries: 1
Re: Get new Lat & Lon from speed

OK given roughly:
one degree of longitude is 50 miles or 80 km
one degree of latitude is 65 miles or 105 km

Starting position Lat: +40.00 Lon: -90.00
Say you are going 30 miles per hour due north
You want the new lat/lon after a five second interval

Five seconds is 0.00139 of an hour, so in five seconds you would have traveled 0.0417 miles.

This is equivalent to 0.0642 degrees latitude, so the new position is Lat: +40.0642 Lon: -90.00

If you're going at an angle you have to use a little trig (Pythagorean theorem), but it's still simple math.

Where it could be tricky is if you need the point to stay on the road network.. then I think you may be able to leverage routing functionality in MapPoint and interpolate to get a five second interval.

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17 (permalink)  
Old 05-14-2008
Member
Yellow Belt
 
Join Date: Mar 2008
Posts: 37
Re: Get new Lat & Lon from speed

Thank you very much Eric. Now i got how i can code by looping which keep on locating new position after 5 sec. Just one thing more about the direction how can I continuously update direction on map after some seconds, suppose input from user be Lat:N & Lon:S.
Thanks once again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18 (permalink)  
Old 05-16-2008
Member
Yellow Belt
 
Join Date: Mar 2008
Posts: 37
Re: Get new Lat & Lon from speed

Hello,
Any body help me to get out of this problem. I need to have an infinite loop that executes every X seconds and show me next position. In other words, a timed / delayed loop. When I use timer it keeps on showing me present position of Lat & Lon which I inserted, not showing me the calculated next values. I tired alot but my application got stuck when i use
Code:
for(;;)
while(true)
while(0==0)
Mine code is
Code:

public double Speed()
        {
            if (speed.Text == null || speed.Text.Length <= 0)
                return 0;
            double knots = Convert.ToDouble(speed.Text);

            //Return KMPH
            return knots * 1.852;
        } 
        
        public double Distance()
        {
            ////speed=distance/time.....so distance=speed*time
            double time = 0.001388;               /////(5 sec time interval)5/3600=0.001388hr
            double distance = time * Speed();   //////////////////km/hr           
            return distance;
        }
        
      
        public double DoLatitude()
        {
            ////1 Degree of Latitude    =   110.6Km,68.703miles
            double onedegreelat = Distance() * 110.6;
            return onedegreelat;
        }
        public double DoLongitude()
        {
            ////1 Degree of Longitude   =  111.3Km*cos(Latitude),69.172miles*cos(Latitude) 
            double onedegreelon = Distance() * 111.3 * Math.Cos(Convert.ToDouble(latitude.Text));
            return onedegreelon;
        } 
       
        public double Lat()
        {
            double remlat = 0;
            remlat = remlat + DoLatitude();
            //remlat = "";
            return remlat;
        }
        public double Lon()
        {
            double remlon = 0;
            remlon = remlon + DoLongitude();
            return remlon;

        }
 while (0 == 0)
            {
               
      textbox1.text= Lat().ToString();

      textbox2.text= Lon().ToString();
            }
 

I want my fn of Lat() & Lon() should be act as new calculated values so that my pushpin will move continuously.
Hope to hear from u guys.
thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #19 (permalink)  
Old 05-17-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
Re: Get new Lat & Lon from speed

Hi,

you always return the same value. You have to place remLat and remLong as private members of the class instead of declaring them on the stack with always the same value (0).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #20 (permalink)  
Old 05-18-2008
Member
Yellow Belt
 
Join Date: Mar 2008
Posts: 37
Re: Get new Lat & Lon from speed

Hello Wilfried,
thank you for yours reply. Actually I am designing dummy simulator which will get data from one application and send to another application. For application one I am giving lat & lon and want to get map in second application. For doing as you said it works fine. It is updating new position on application second but my first application still getting hang up. I don't know about it. I tried on Google for this problem and found treads can solve this problem as it works fine in GUI for unlimited looping. But I don't know how I can use it in my application.
Code:
 private void timer1_Tick(object sender, EventArgs e)
        {
            double remlat = 0;
            double remlon = 0;
            while (true)
            {
                remlat = remlat + DoLatitude();
                remlon = remlon + DoLongitude();

                double retValLat = remlat + Convert.ToDouble(latitude.Text);
                double retValLon = remlon + Convert.ToDouble(longitude.Text);

                string NMEA = "$GPGGA" + "," + "UTCTime" + "," + (retValLat.ToString()) + "," + Pole1.Text + "," + (retValLon.ToString()) + "," + Pole2.Text;
                byte[] nmea = System.Text.Encoding.ASCII.GetBytes(NMEA);
                if (clientSocket != null)
                { clientSocket.Send(nmea); }
                //timer1.Interval=(9000);
                Thread.Sleep(10000);
                //return remlat;

                Console.WriteLine(nmea);
            }
Regards.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
lat, lon, speed


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/get-new-lat-lon-speed-7671.html

Posted By For Type Date
Formatting Coordinates with DmsFormat - MapPoint Articles - MP2K Magazine This thread Refback 05-14-2008 09:29 AM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
How do I speed up this code? RichardD MapPoint 2006/2009 Discussion 5 11-18-2005 10:55 AM
Open Map Speed Yazzy MapPoint 2006/2009 Discussion 1 06-27-2005 10:52 AM
Speed of the service sbedin MapPoint Web Service and Virtual Earth 0 12-21-2004 10:13 AM
Excel VBA or VB6 For Speed DavidP MapPoint 2006/2009 Discussion 3 08-14-2004 05:50 PM
Speed Print out Anonymous MapPoint 2006/2009 Discussion 0 12-26-2003 04:54 AM


All times are GMT -5. The time now is 07:02 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Ski Holiday Packages
Choose from a selection of ski holiday packages from the top travel brands. Holiday Hypermarket makes it easy to search and browse great value ski holidays.

Flights to Spain
Find cheap flights to Spain on Travel Counsellors. A personal Travel Counsellor can help you plan flights and find accommodation in Spain.

Thailand Holiday
A Thailand Holiday has much to offer with historic culture, lively arts, beautiful beaches, a good nightlife, friendly and hospitable people and one of the best cuisines in the world.

Holidays to Barbados
Holidays to Barbados have so much to offer. Enjoy the beauty of this Caribbean island for less by booking your holiday through us.

Cheap Holidays
Hunting for cheap holidays? Well save time by booking online with ulookubook.com and you can even check out our top tips to help you hunt down a bargain holiday.

Air Travel
Interested in air travel? Search and compare millions of holidays, flights and hotels with our help at Travel.co.uk

Cheap Holidays in Florida
Legendary weather! Visit On The Beach for info on cheap holidays in Florida.


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