View Single Post
Old 02-08-2006   #13 (permalink)
Dutch
Humourless EuroMod.
 
Dutch's Avatar
 
Join Date: Mar 2004
Location: City of Mermaids, Denmark
Posts: 6,819
Quote:
Originally Posted by Scruge
Dutch, that's damn slick.

After I get my desk cleared of my back log of projects I'd like to see how you did the 3ds.
Not my work.. See the info in the script. I just made some minor changes and bugfixes so far.
The polygons aren't that hard to figure out.
Collate the gps-point data for each BSSID, and use them to make the boundaries of the polygon.
Code:
/*******************
* parse .gps file and build gps coordinates index
********************/
foreach($gps->{'gps-point'} as $value)
{
$coordinates[(string) $value['bssid']][] = array((string) $value['lon'], (string) $value['lat']);
}
Then make the polygon :
Code:
/*******************
* assemble polygon placemark
********************/

if($network['channel'] != '0') //we don't display networks with no height
{

$poly .= "<Placemark>\n<name><![CDATA[";
if(empty($network['SSID'])) $poly .= "no ssid";
else $poly .= $network['SSID'];
echo "SSID:".$network['SSID']." BSSID:".$network['BSSID']."\n";
$poly .= "]]></name>\n<visibility>0</visibility>\n<open>0</open>\n";
$poly .= "<Style>\n\t<LineStyle>\n\t<width>1.5</width></LineStyle>\n\t<PolyStyle>";

if($xml->{'wireless-network'}[$key]['wep'] == 'true') //set color 
$poly .= "<color>8f00ff00</color>\n"; //green, closed
elseif($meta[$key]['cloaked'] == 'true')
$poly .= "<color>7dff0000</color>\n"; //blue, cloaked
else
$poly .= "<color>7d00ff00</color>\n"; //red, open

$poly .= "</PolyStyle>\n</Style>\n<Polygon>\n<extrude>1</extrude>\n<tessellate>0</tessellate>\n";
$poly .= "<altitudeMode>relativeToGround</altitudeMode>\n<outerBoundaryIs>\n<LinearRing>\n<extrude>0</extrude>";
$poly .= "<tessellate>0</tessellate>\n<altitudeMode>clampToGround</altitudeMode>\n<coordinates>";

$poly_alt = $network['channel']*10;

foreach($coordinates[$network['BSSID']] as $index => $gpoints)
{
if($gpoints[0] != $coordinates[$network['BSSID']][$index-1][0]
&& $gpoints[1] != $coordinates[$network['BSSID']][$index-1][1]) //remove duplicates
$poly .= $gpoints[0].", ".$gpoints[1].", ".$poly_alt." ";
}

$poly .= $coordinates[$network['BSSID']][0][0].", ".$coordinates[$network['BSSID']][0][1].", ".$poly_alt." "; //finish polygon at first coordinate
$poly .= "</coordinates>\n</LinearRing>\n</outerBoundaryIs>\n</Polygon>\n</Placemark>";

}
} //end foreach
and finally output it to the kml file
Code:
//output 3D visualized polygons
$kml_final .= "<Folder>\n<name>3D visualized view</name><open>0</open>\n";
$kml_final .= $poly;
$kml_final .= "</Folder>\n";
Converting the above snippets of code to the language of your choice shouldn't be to hard, albeit I'm not so sure dBase 7.5 has the constructs for easy looping and temporary arrays.


Dutch
__________________
All your answers are belong to Google. SEARCH DAMMIT!
Warning. Warning.
Low C8H10N4O2 level detected. Operator halted....

Last edited by Dutch : 02-08-2006 at 09:01 PM.
Dutch is offline   Reply With Quote