Hi!

 

Another suggestion would be to use two tables.  One for "latest" known
position and one for "historical" position.

When you receive vehicle information, you update the "latest" table (or
insert if it is the first entry for a given vehicle) and you insert into
the "historical" one.  Thus, if you want to display the current vehicle
position, you don't have to bother about filtering, you have all what
you need, one row per vehicle, in the "latest" table.  On the other
hand, when you want to playback a vehicle route for let's say the
previous day, you can use the "historical" table.

 

Pierre

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kenneth
Skovhede, GEOGRAF A/S
Sent: June 17, 2008 05:59
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] Vehicle Tracking

 

So you want to display only the most recent vehicle positions?

You can do that with a filter on the layer.
I suspect you have a datastructure like:
x double
y double
vehicleid integer
timestamp datetime

You should have a filter like: "timestamp = (select top 1 timestamp from
table where vehicleid = id)".
How this filter should look, depends on your database.
I suspect you will have a hard time figuring this out (if it is even
possible) directly in MapGuide.
I would advise you to add a column that indicates that this is the most
recent entry:
mostrecent integer

then you can update the database upon arival of requests:
update table set mostrecent = 0 where vehicleid=id
and insert
insert into table (x,y,vehicleid,timestamp,mostrecent) values
(x,y,id,now(),1)

This will allow you to have a filter like this in your layer:
"mostrecent = 1"




Regards, Kenneth Skovhede, GEOGRAF A/S



Vishaal skrev: 

Hi Kenneth,
 
i am successful in displaying the points on a button click all at once.
what
i want is that on the button click my points should get displayed one by
one
as per the data and only the latest point should be visible. i am not
able
to this part. can you help me with some code example?
 
thanks.
 
 
Kenneth Skovhede, GEOGRAF A/S wrote:
  

        If you only have to consider the current position of vehicles,
you can 
        easily use a database.
        Just add an x,y columns, and perhaps speed and other data to a
table.
        Then make a service that accepts coordinates from vehicles, and
update 
        the correct row in the database.
         
        In MapGuide, make a layer that reads the x,y points, and perhaps
color 
        code according to speed.
        You can then get away with refreshing the map periodically.
         
        If you can read in the direction, you could throw in a rotation
on a 
        symbol in the layer.
         
        Regards, Kenneth Skovhede, GEOGRAF A/S
         
         
         
        Vishaal skrev:
            

                Hi List,
                 
                i want to develop a vehicle tracking system using MGOS
1.2 and Visual
                Studio
                2005. if any one can guide me about how to start for the
application,
                then
                it will be very helpful to me. thanks for all your
support.
                  
                      

        _______________________________________________
        mapguide-users mailing list
        mapguide-users@lists.osgeo.org
        http://lists.osgeo.org/mailman/listinfo/mapguide-users
         
         
            

 
  
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to