Re: [Flightgear-devel] Re : Maritime traffic

2011-12-18 Thread Adrian Musceac
On Saturday, December 17, 2011 23:19:16 Stuart Buchanan wrote:
 Great work Adrian,
 
 I had something similar working in January - I think I posted
 something to this list. My system used an AI scenario to
 create a number of ships, and then used a perl script to
 query www.marinetraffic.com using the current lon/lat and
 write to the property tree the lon/lat speed and heading of
 all the ships in a given radius. The difficult thing I found was
  that the AIS information wasn't sampled frequently enough.
 
 Let me know if you'd like the scripts and XML I wrote, and I'll
 dig them out for you.
 
 To be honest, I was never very happy with my implementation -
 it was a bit of a hack. I'd be very interested to hear about the details
 of yours, and I'm sure you've thought of something much better!
 
 The ideal might be to push the shipping data onto the MP network,
 but the amount of shipping data would swamp our current MP aircraft
 numbers :)
 
 -Stuart

Hi Stuart,
I didn't know about you attempt. Your method is probably more advanced, since 
I'm just using static data, placing models with a Nasal script executed in the 
debug console. I'm not sure if dynamic traffic could be done properly, but 
maybe storing at least two points for each ship at any time and moving it 
between them at the speed reported through AIS may be a solution. Though, I'm 
don't know how useful people would find this, and how much of a performance 
hit it would be.

Anyway, I'm attaching the Nasal script I used. The data is just a text file, 
containing the type of vessel, position, speed and course. I can send that to 
you too, if you want, but it's too large to send to the list.

Cheers,
Adrian

var lat = getprop('/position/latitude-deg');
var lon = getprop('/position/longitude-deg');
var lat_max = lat + 0.5;
var lat_min = lat - 0.5;
var lon_max = lon + 0.5;
var lon_min = lon - 0.5;

var path = getprop(/sim/fg-root) ~ /Nasal/aisdata2.txt;
print( path);
var file = io.readfile(path);
var file_lines = [[]];
var current_word = ;
for (var i = 0; i  size(file); i += 1)
{
var char = substr(file, i, 1);
if (char == , or char == \n)
{
append(file_lines[size(file_lines) - 1], current_word);
current_word = ;
if (char == \n) append(file_lines, []);
}
else
{
current_word ~= char;
}
}


foreach(var line; file_lines)
{
var model = ;
if(line[0]==1)
{
model = Models/Maritime/Civilian/MediumFerry.xml;
}
if(line[0]==2)
{
model = Models/Maritime/Civilian/ContainerShip.xml;
}
if(line[0]==3)
{
model = Models/Maritime/Civilian/CruiseShip.xml;
}
if(line[0]==4)
{
model = Models/Maritime/Civilian/Tanker_sailing.xml;
}
if(line[0]==5)
{
model = Models/Maritime/Civilian/Trawler.xml;
}
if(line[0]==6)
{
model = Models/Maritime/Civilian/SailBoatUnderSail.xml;
}
if(line[0]==7)
{
model = Models/Maritime/Civilian/LargeTrawler.xml;
}
if(line[0]==0)
{
model = Models/Maritime/Misc/MarkerBuoy.xml;
}
#var heading = rand() * 360;
var lat_ok =0;
var lon_ok =0;
var height =0;
if(line[3]==0)
{
height=-1;
}
#print(line[0]);
if( (line[2] = lat_max) and (line[2] = lat_min)) 
{
lat_ok =1;
}
if( (line[1] = lon_max) and (line[1] = lon_min)) 
{
lon_ok =1;
}
if(lat_ok ==1 and lon_ok==1)
{
#print(line[0]);
geo.put_model(model, line[2], line[1], 0, line[4]);
}
}
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Re : Maritime traffic

2011-12-17 Thread Stuart Buchanan
On Fri, Dec 16, 2011 at 2:34 PM, Adrian Musceac  wrote:
 On Friday, December 16, 2011 14:57:24 Olivier wrote:
 Type's already done (sort of), but the foam I have no clue how to get rid of
 it other than a different model.
 Some images near Amsterdam harbour:
 http://i.imgur.com/gNBqS.jpg
 http://i.imgur.com/7Gpyj.jpg
 http://i.imgur.com/gxN5L.jpg
 http://i.imgur.com/StpuV.jpg
 Crowded, I'd say.

 Cheers,
 Adrian

Great work Adrian,

I had something similar working in January - I think I posted
something to this list. My system used an AI scenario to
create a number of ships, and then used a perl script to
query www.marinetraffic.com using the current lon/lat and
write to the property tree the lon/lat speed and heading of
all the ships in a given radius. The difficult thing I found was
 that the AIS information wasn't sampled frequently enough.

Let me know if you'd like the scripts and XML I wrote, and I'll
dig them out for you.

To be honest, I was never very happy with my implementation -
it was a bit of a hack. I'd be very interested to hear about the details
of yours, and I'm sure you've thought of something much better!

The ideal might be to push the shipping data onto the MP network,
but the amount of shipping data would swamp our current MP aircraft
numbers :)

-Stuart

--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] Re : Maritime traffic

2011-12-16 Thread Olivier
Hi,

That's a nice start! Are you grabbing data from: 
http://www.marinetraffic.com/ais/ ?

In fact, depending on the data format, you may obtain the speed  the type of 
the ship with AIS.
So if speed=0, you should use a ship without wakes (eg ship in a harbour, and 
display a type
depending on the type returned by AIS (cargo, tug, sailing, ...).

Oliver
--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Re : Maritime traffic

2011-12-16 Thread Adrian Musceac
On Friday, December 16, 2011 14:57:24 Olivier wrote:
 Hi,
 
 That's a nice start! Are you grabbing data from:
 http://www.marinetraffic.com/ais/ ?

Yes. aprs.fi also has a good feed, although more oriented towards ham radio 
APRS.
AisHub has very detailed NMEA data, but they require you to send a feed before 
accessing raw data, and I don't live in a coastal area.

 In fact, depending on the data format, you may obtain the speed  the type
 of the ship with AIS. So if speed=0, you should use a ship without wakes
 (eg ship in a harbour, and display a type depending on the type returned
 by AIS (cargo, tug, sailing, ...).

Type's already done (sort of), but the foam I have no clue how to get rid of 
it other than a different model.
Some images near Amsterdam harbour:
http://i.imgur.com/gNBqS.jpg
http://i.imgur.com/7Gpyj.jpg
http://i.imgur.com/gxN5L.jpg
http://i.imgur.com/StpuV.jpg
Crowded, I'd say.

Cheers,
Adrian


--
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel