| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628 |
- <?php
- // Office of Coast Service
- // http://www.nauticalcharts.noaa.gov/hsd/wrecks_and_obstructions.html
- // download and transform 3 datasets -> AWOIS Wreck, AWOIS Obstructions, ENC Wrecks to SPOI data model
- ?>
- <!DOCTYPE html>
- <html lang="cs" dir="ltr">
- <head>
- <title>Office of Coast Survey data to RDF</title>
- <meta charset="utf-8">
- <meta name="robots" content="index,follow">
- <meta name="author" content="Jáchym Kellar">
- <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge"> -->
- <style>
- body{
- margin-top: 80px;
- text-align: center;
- }
- .start{
- font-size: 28px;
- text-decoration: none;
- letter-spacing: 1px;
- }
- a{
- text-decoration: none;
- }
- a:hover{
- text-decoration: underline;
- }
- .pozn{
- font-size: 13px;
- }
- h4{
- margin-bottom: 5px;
- }
- </style>
- </head>
- <body>
- <h2>The Office of Coast Survey → SPOI data model</h2>
-
- <h4>The Office of Coast Survey: <a href="http://www.nauticalcharts.noaa.gov/hsd/wrecks_and_obstructions.html" target="_blank">http://www.nauticalcharts.noaa.gov/hsd/wrecks_and_obstructions.html</a></h4>
- <h4>SPOI: <a href="http://sdi4apps.eu/spoi/" target="_blank">http://sdi4apps.eu/spoi</a></h4>
-
- <br><br>
- <h4>AWOIS Wrecks</h4>
- <a href="officeOfCoastSurvey.php?transform=start_awois_wrecks" class="start">Start</a>
- <br><span class="pozn">(this may take a while)</span><br><br>
-
- <h4>ENC Wrecks</h4>
- <a href="officeOfCoastSurvey.php?transform=start_enc_wrecks" class="start">Start</a>
- <br><span class="pozn">(this may take a while)</span><br><br>
-
- <h4>AWOIS Obstructions</h4>
- <a href="officeOfCoastSurvey.php?transform=start_awois_obstructions" class="start">Start</a>
- <br><span class="pozn">(this may take a while)</span><br><br>
- <?php
- if (IsSet($_GET['transform'])){
- $status=$_GET['transform'];
- if($status == "start_awois_wrecks"){
- awois_wrecks();
- }
- if($status == "start_enc_wrecks"){
- enc_wrecks();
- }
- if($status == "start_awois_obstructions"){
- awois_obstructions();
- }
- }
- ?>
- </body>
- </html>
- <?php
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ENC WRECKS
- function enc_wrecks(){
- file_put_contents("ENC_Wrecks.kml", fopen("http://wrecks.nauticalcharts.noaa.gov/downloads/ENC_Wrecks.kml", 'r'));
- echo "<br><br>ENC Wrecks<br>";
-
- // filesize of downloaded archive
- $filesize = filesize("ENC_Wrecks.kml");
- echo "Kml file size: ".format_size($filesize)."<br>";
-
- $contents = file_get_contents('ENC_Wrecks.kml');
-
- // create new rdf file
- $soubor = fopen("ENC_Wrecks.rdf", "w");
-
- // write head of rdf
- fwrite($soubor, '<?xml version="1.0" encoding="utf-8"?');
- fwrite($soubor, ">\r\n");
- fwrite($soubor, '<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:dcterms="http://purl.org/dc/terms/1.1/"
- xmlns:foaf="http://xmlns.com/foaf/0.1/"
- xmlns:geos="http://www.opengis.net/ont/geosparql#"
- xmlns:owl="http://www.w3.org/2002/07/owl#"
- xmlns:poi="http://www.openvoc.eu/poi#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:sf="http://www.opengis.net/ont/sf#"
- xmlns:skos="http://www.w3.org/2004/02/skos/core#">
- ');
-
- // read xml
- $xml = new SimpleXMLElement($contents);
- $value = $xml->Document->Folder->Placemark;
-
- // memory usage
- echo 'Memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB<br>";
-
- $long;
- $lat;
- $label;
- $source = "ENCW";
-
- foreach($value as $coord) {
-
- $feature_type = "";
- $name = $coord -> name;
- $watlev = "";
- $depth = "";
- $chart = "";
-
- $value2 = $coord->ExtendedData->SchemaData->SimpleData;
- foreach($value2 as $coord2) {
- if($coord2['name'] == "feature_type"){
- $label = $coord2;
- }
- if($coord2['name'] == "latdec"){
- $lat = $coord2;
- }
- if($coord2['name'] == "londec"){
- $long = $coord2;
- }
- if($coord2['name'] == "watlev"){
- $watlev = $coord2;
- }
- if($coord2['name'] == "depth"){
- $depth = $coord2;
- }
- if($coord2['name'] == "chart"){
- $chart = $coord2;
- }
- if($coord2['name'] == "feature_type"){
- $feature_type = $coord2;
- }
- }
-
- if(substr($label, 0, 6) == "Wrecks"){
- $label = substr($label, 7);
- $label = 'Wreck '.$label;
- }
-
- fwrite($soubor, ' <rdf:Description rdf:about="http://www.sdi4apps.eu/poi/#'.$source.''.$name.'">');
- fwrite($soubor, "\r\n");
-
- if($feature_type != ""){
- fwrite($soubor, ' <rdfs:label xml:lang="en">'.$label.'</rdfs:label>');
- fwrite($soubor, "\r\n");
- }
- else{
- fwrite($soubor, ' <rdfs:label xml:lang="en">Wrecks</rdfs:label>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <geos:asWKT rdf:datatype="http://www.openlinksw.com/schemas/virtrdf#Geometry">POINT('.$long.' '.$lat.')</geos:asWKT>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <poi:class rdf:resource="http://gis.zcu.cz/SPOI/Ontology#outdoor"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <geos:sfWithin rdf:resource="http://dbpedia.org/resource/United_States"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <geos:sfWithin rdf:resource="http://www.geonames.org/6252001"/>');
- fwrite($soubor, "\r\n");
-
- if($depth != ""){
- fwrite($soubor, ' <rdfs:comment xml:lang="en">Depth: '.$depth.' m</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
-
- if($watlev != ""){
- fwrite($soubor, ' <rdfs:comment xml:lang="en">Water Level Effect: '.$watlev.'</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
-
- if($chart != ""){
- fwrite($soubor, ' <rdfs:comment xml:lang="en">Chart: '.$chart.'</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <dc:identifier rdf:resource="http://www.sdi4apps.eu/poi/#'.$source.''.$name.'"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <dc:publisher>SPOI (http://sdi4apps.eu/spoi)</dc:publisher>');
- fwrite($soubor, "\r\n");
-
- if($feature_type != ""){
- fwrite($soubor, ' <dc:title xml:lang="en">'.$label.'</dc:title>');
- fwrite($soubor, "\r\n");
- }
- else{
- fwrite($soubor, ' <dc:title xml:lang="en">Wrecks</dc:title>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <dc:rights rdf:resource="http://opendatacommons.org/licenses/odbl/1.0/"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <dc:source rdf:resource="http://www.nauticalcharts.noaa.gov/"/> ');
- fwrite($soubor, "\r\n");
-
- $date = getdate();
- fwrite($soubor, ' <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">'.$date['year']."-".$date['mon']."-".$date['mday'].'</dcterms:created>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' </rdf:Description>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, "</rdf:RDF>");
- fclose($soubor);
-
- // delete downloaded kml
- unlink('ENC_Wrecks.kml');
-
- // link to download rdf
- echo '<a href="ENC_Wrecks.rdf" target="_blank">Download RDF file</a>';
-
- // filesize of rdf
- $filesize = filesize("ENC_Wrecks.rdf");
- echo " (".format_size($filesize).")<br>";
- }
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////// AWOIS Wrecks
- function awois_wrecks(){
- file_put_contents("AWOIS_Wrecks.kml", fopen("http://wrecks.nauticalcharts.noaa.gov/downloads/AWOIS_Wrecks.kml", 'r'));
- echo "<br><br>AWOIS Wrecks<br>";
-
- // filesize of downloaded archive
- $filesize = filesize("AWOIS_Wrecks.kml");
- echo "Kml file size: ".format_size($filesize)."<br>";
-
-
- $contents = file_get_contents('AWOIS_Wrecks.kml');
-
- // create rdf
- $soubor = fopen("AWOIS_Wrecks.rdf", "w");
-
- // write head of rdf
- fwrite($soubor, '<?xml version="1.0" encoding="utf-8"?');
- fwrite($soubor, ">\r\n");
- fwrite($soubor, '<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:dcterms="http://purl.org/dc/terms/1.1/"
- xmlns:foaf="http://xmlns.com/foaf/0.1/"
- xmlns:geos="http://www.opengis.net/ont/geosparql#"
- xmlns:owl="http://www.w3.org/2002/07/owl#"
- xmlns:poi="http://www.openvoc.eu/poi#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:sf="http://www.opengis.net/ont/sf#"
- xmlns:skos="http://www.w3.org/2004/02/skos/core#">
- ');
-
- // read xml
- $xml = new SimpleXMLElement($contents);
- $value = $xml->Document->Folder->Placemark;
-
- // memory usage
- echo 'Memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB<br>";
-
- $long;
- $lat;
- $label;
- $source = "AWOISW";
-
- foreach($value as $coord) {
-
- $vesslterm = "";
- $depth = "";
- $yearsunk = "";
- $feature_type = "";
- $name= $coord->name;
- $value2 = $coord->description;
- $unit = "";
- $vessltermexist = true;
-
- $DOM = new DOMDocument;
- @ $DOM->loadHTML($value2);
-
- $items = $DOM->getElementsByTagName('td');
-
- $vesslterm = $items->item(1)->nodeValue;
- $feature_type = $items->item(2)->nodeValue;
- $lat = $items->item(3)->nodeValue;
- $long = $items->item(4)->nodeValue;
- $depth = $items->item(6)->nodeValue;
- $unit = $items->item(7)->nodeValue;
- $yearsunk = $items->item(8)->nodeValue;
- $wreck = true;
-
- fwrite($soubor, ' <rdf:Description rdf:about="http://www.sdi4apps.eu/poi/#'.$source.''.$name.'">');
- fwrite($soubor, "\r\n");
-
-
- if($vesslterm == "UNKNOWN" OR $vesslterm == ""){
- $vessltermexist = false;
- if($feature_type != "Not Charted"){
- $wreck = false;
- fwrite($soubor, ' <rdfs:label xml:lang="en">'.$feature_type.'</rdfs:label>');
- fwrite($soubor, "\r\n");
- }
- else{
- $wreck = false;
- fwrite($soubor, ' <rdfs:label xml:lang="en">Wreck</rdfs:label>');
- fwrite($soubor, "\r\n");
- }
- }
- else{
- fwrite($soubor, ' <rdfs:label xml:lang="en">'.$vesslterm.'</rdfs:label>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <geos:asWKT rdf:datatype="http://www.openlinksw.com/schemas/virtrdf#Geometry">POINT('.$long.' '.$lat.')</geos:asWKT>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <poi:class rdf:resource="http://gis.zcu.cz/SPOI/Ontology#outdoor"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <geos:sfWithin rdf:resource="http://dbpedia.org/resource/United_States"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <geos:sfWithin rdf:resource="http://www.geonames.org/6252001"/>');
- fwrite($soubor, "\r\n");
-
- if($wreck == false){
-
- }
- else if($feature_type != "Not Charted" AND $feature_type != "" AND $wreck == true){
- fwrite($soubor, ' <rdfs:comment xml:lang="en">'.$feature_type.'</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- else{
- fwrite($soubor, ' <rdfs:comment xml:lang="en">Wreck</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
-
- if($depth != ""){
- fwrite($soubor, ' <rdfs:comment xml:lang="en">Depth: '.$depth.' ');
- if($unit != ""){
- if($unit == "Feet and tenths"){
- fwrite($soubor, 'ft</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- else if($unit == "Meters and tenths"){
- fwrite($soubor, 'm</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- else if($unit == "Fathoms and tenths"){
- fwrite($soubor, 'fathoms</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- else{
- fwrite($soubor, $unit.'</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- }
- else{
- fwrite($soubor, 'm</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- }
-
- if($yearsunk != ""){
- fwrite($soubor, ' <rdfs:comment xml:lang="en">Year Sunk: '.$yearsunk.'</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <dc:identifier rdf:resource="http://www.sdi4apps.eu/poi/#'.$source.''.$name.'"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <dc:publisher>SPOI (http://sdi4apps.eu/spoi)</dc:publisher>');
- fwrite($soubor, "\r\n");
-
-
- if($vesslterm == "UNKNOWN" OR $vesslterm == ""){
- $vessltermexist = false;
- if($feature_type != "Not Charted"){
- fwrite($soubor, ' <dc:title xml:lang="en">'.$feature_type.'</dc:title>');
- fwrite($soubor, "\r\n");
- }
- else{
- fwrite($soubor, ' <dc:title xml:lang="en">Wreck</dc:title>');
- fwrite($soubor, "\r\n");
- }
- }
- else{
- fwrite($soubor, ' <dc:title xml:lang="en">'.$vesslterm.'</dc:title>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <dc:rights rdf:resource="http://opendatacommons.org/licenses/odbl/1.0/"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <dc:source rdf:resource="http://www.nauticalcharts.noaa.gov/"/> ');
- fwrite($soubor, "\r\n");
-
- $date = getdate();
- fwrite($soubor, ' <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">'.$date['year']."-".$date['mon']."-".$date['mday'].'</dcterms:created>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' </rdf:Description>');
- fwrite($soubor, "\r\n");
-
- }
-
- fwrite($soubor, "</rdf:RDF>");
- fclose($soubor);
-
- // delete downloaded kml
- unlink('AWOIS_Wrecks.kml');
-
- // link to download rdf
- echo '<a href="AWOIS_Wrecks.rdf" target="_blank">Download RDF file</a>';
-
- // filesize of rdf
- $filesize = filesize("AWOIS_Wrecks.rdf");
- echo " (".format_size($filesize).")<br>";
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////// AWOIS Obstructions
- function awois_obstructions(){
- file_put_contents("AWOIS_Obscructions.kml", fopen("http://wrecks.nauticalcharts.noaa.gov/downloads/AWOIS_Obstructions.kml", 'r'));
- echo "<br><br>AWOIS Obscructions<br>";
-
- // filesize of downloaded archive
- $filesize = filesize("AWOIS_Obscructions.kml");
- echo "Kml file size: ".format_size($filesize)."<br>";
-
-
- $contents = file_get_contents('AWOIS_Obscructions.kml');
-
- // create rdf file
- $soubor = fopen("AWOIS_Obscructions.rdf", "w");
-
- // write head of rdf
- fwrite($soubor, '<?xml version="1.0" encoding="utf-8"?');
- fwrite($soubor, ">\r\n");
- fwrite($soubor, '<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:dcterms="http://purl.org/dc/terms/1.1/"
- xmlns:foaf="http://xmlns.com/foaf/0.1/"
- xmlns:geos="http://www.opengis.net/ont/geosparql#"
- xmlns:owl="http://www.w3.org/2002/07/owl#"
- xmlns:poi="http://www.openvoc.eu/poi#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:sf="http://www.opengis.net/ont/sf#"
- xmlns:skos="http://www.w3.org/2004/02/skos/core#">
- ');
-
- // read xml
- $xml = new SimpleXMLElement($contents);
- $value = $xml->Document->Folder->Placemark;
- echo 'Memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB<br>";
-
- $long;
- $lat;
- $label;
- $source = "AWOISO";
-
- foreach($value as $coord) {
-
-
- $depth = "";
- $yearsunk = "";
- $feature_type = "";
- $name= $coord->name;
- $value2 = $coord->description;
- $unit = "";
-
- $DOM = new DOMDocument;
- @ $DOM->loadHTML($value2);
-
-
- $items = $DOM->getElementsByTagName('td');
-
- $vesslterm = $items->item(1)->nodeValue;
- $feature_type = $items->item(2)->nodeValue;
- $lat = $items->item(3)->nodeValue;
- $long = $items->item(4)->nodeValue;
- $depth = $items->item(6)->nodeValue;
- $unit = $items->item(7)->nodeValue;
- $yearsunk = $items->item(8)->nodeValue;
-
-
- fwrite($soubor, ' <rdf:Description rdf:about="http://www.sdi4apps.eu/poi/#'.$source.''.$name.'">');
- fwrite($soubor, "\r\n");
-
-
- if($feature_type != "Not Charted" AND $feature_type != ""){
- fwrite($soubor, ' <rdfs:label xml:lang="en">'.$feature_type.'</rdfs:label>');
- fwrite($soubor, "\r\n");
- }
- else{
- fwrite($soubor, ' <rdfs:label xml:lang="en">Obstruction</rdfs:label>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <geos:asWKT rdf:datatype="http://www.openlinksw.com/schemas/virtrdf#Geometry">POINT('.$long.' '.$lat.')</geos:asWKT>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <poi:class rdf:resource="http://gis.zcu.cz/SPOI/Ontology#outdoor"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <geos:sfWithin rdf:resource="http://dbpedia.org/resource/United_States"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <geos:sfWithin rdf:resource="http://www.geonames.org/6252001"/>');
- fwrite($soubor, "\r\n");
-
-
- if($depth != ""){
- fwrite($soubor, ' <rdfs:comment xml:lang="en">Depth: '.$depth.' ');
- if($unit != ""){
- if($unit == "Feet and tenths"){
- fwrite($soubor, 'ft</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- else if($unit == "Meters and tenths"){
- fwrite($soubor, 'm</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- else if($unit == "Fathoms and tenths"){
- fwrite($soubor, 'fathoms</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- else{
- fwrite($soubor, $unit.'</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- }
- else{
- fwrite($soubor, 'm</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
- }
-
- if($yearsunk != ""){
- fwrite($soubor, ' <rdfs:comment xml:lang="en">Year Sunk: '.$yearsunk.'</rdfs:comment>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <dc:identifier rdf:resource="http://www.sdi4apps.eu/poi/#'.$source.''.$name.'"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <dc:publisher>SPOI (http://sdi4apps.eu/spoi)</dc:publisher>');
- fwrite($soubor, "\r\n");
-
-
- if($feature_type != "Not Charted" AND $feature_type != ""){
- fwrite($soubor, ' <dc:title xml:lang="en">'.$feature_type.'</dc:title>');
- fwrite($soubor, "\r\n");
- }
- else{
- fwrite($soubor, ' <dc:title xml:lang="en">Obstruction</dc:title>');
- fwrite($soubor, "\r\n");
- }
-
- fwrite($soubor, ' <dc:rights rdf:resource="http://opendatacommons.org/licenses/odbl/1.0/"/>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' <dc:source rdf:resource="http://www.nauticalcharts.noaa.gov/"/> ');
- fwrite($soubor, "\r\n");
-
- $date = getdate();
- fwrite($soubor, ' <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#date">'.$date['year']."-".$date['mon']."-".$date['mday'].'</dcterms:created>');
- fwrite($soubor, "\r\n");
-
- fwrite($soubor, ' </rdf:Description>');
- fwrite($soubor, "\r\n");
-
- }
-
- fwrite($soubor, "</rdf:RDF>");
- fclose($soubor);
-
- // delete downloaded kml
- unlink('AWOIS_Obscructions.kml');
-
- // link to download rdf
- echo '<a href="AWOIS_Obscructions.rdf" target="_blank">Download RDF file</a>';
-
- // filesize of rdf
- $filesize = filesize("AWOIS_Obscructions.rdf");
- echo " (".format_size($filesize).")<br>";
- }
- // filesize function
- function format_size($size) {
- $sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
- if ($size == 0) { return('n/a'); } else {
- return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $sizes[$i]); }
- }
- ?>
|