User Tools

Site Tools


project:bioosm:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
project:bioosm:start [2023/05/28 14:58] – make it compatible with Centos 7 sachyproject:bioosm:start [2023/09/21 12:15] (current) – render terminal/html escapes sachy
Line 105: Line 105:
 # Parse Tellico database to BioOSM index.htm # Parse Tellico database to BioOSM index.htm
 # $1 = tellico .tc file # $1 = tellico .tc file
-# Print result to /json/*.json+# $2 = "" terminal stderr (default) 
 +#    = "html" html marked stderr (for web bioosm) 
 +
 +# Print result to /jsonrss/*.json 
 +
 +# find ./ -type f -name '*.jpg' -newermt "2023-09-03" -exec mogrify -verbose -layers Dispose -resize 1600\>x1600\> -quality 90% {} + 
 +# echo "14.7345 48.7145" | gdallocationinfo -wgs84 ./cesko_big.tiff 
 +# gdal_translate -of GTiff -a_srs WGS84 -a_ullr 11.6863 50.9745 19.9876 48.3729 ./source.tif ./result.tif 
 +# https://data.geus.dk/egdi/#baslay=baseMapGEUS&extent=3953440,2399890,4757540,2763830&layers=igme5000 
 + 
 +#bnds=new OpenLayers.Bounds(11.6863000,48.3729000 ,19.9876000,50.9745000); 
 +#var geoimg = new OpenLayers.Layer.Image("geo","https://brmlab.s0c4.net/bioosm/eusr5000_600dpi_cesko.png", bnds,bnds.getSize(),{numZoomLevels: 20,isBaseLayer:false}); 
 +#map.addLayer(geoimg); 
 + 
 + 
 +
 +# <iframe width="500" height="500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=14.978000%2C49.990000%2C15.022000%2C50.010000&amp;layer=mapnik&amp;marker=50.000000%2C15.000000"></iframe> 
 +# // vectorLayer.removeFeatures(atol) 
 +# // map.removeLayer(vectorLayer) 
 +#
 # #
 # Creates: # Creates:
Line 141: Line 160:
 rss+=$'<pubDate></pubDate>\n' rss+=$'<pubDate></pubDate>\n'
 rss+=$'<ttl>86400</ttl>\n' rss+=$'<ttl>86400</ttl>\n'
 +
 +errhtml="$2"
  
 # paticka (co, rok, odkaz) # paticka (co, rok, odkaz)
 function obioosm () { function obioosm () {
- r="<div id='obioosm'><p>Welcome to BioOSM! This site is owned and maintained by members of the <a href='https://brmlab.cz' target='_blank'>hackerspace brmlab</a>. See our wiki page for further <a href='https://brmlab.cz/project/bioosm/start' target='_blank'>details</a><br>License: <a href='https://creativecommons.org/licenses/by-nc-nd/4.0/' target='_blank'>CC BY-NC-ND</a>. In case you have any questions, suggestions, please let us know at bioosm<span id='zavinacvmejlu'></span>s0c4.net.</p><p>To cite any material (including images) in your publication, please use following format: <br><i>Plskova K, Sacha M, brmlab. BioOSM"+ r="<div id='obioosm'><p>Welcome to BioOSM! This site is owned and maintained by members of the <a href='https://brmlab.cz' target='_blank'>hackerspace brmlab</a>. See our wiki page for further <a href='https://brmlab.cz/project/bioosm/start' target='_blank'>details</a><br>License: <a href='https://creativecommons.org/licenses/by-nc-nd/4.0/' target='_blank'>CC BY-NC-ND</a>. In case you have any questions, suggestions, please let us know at bioosm<span id='zavinacvmejlu'></span>s0c4.net.</p><p>To cite any material (including images) in your publication, please use following format: <br><i>PlskovaK., SachaM., brmlab. BioOSM"
  if [[ "$1" != "" ]]; then  if [[ "$1" != "" ]]; then
  r+=" - $1"  r+=" - $1"
Line 161: Line 182:
  r+="</i></p></div>"  r+="</i></p></div>"
  echo "$r"  echo "$r"
 +}
 +
 +# HTML fajl per project
 +function genhtml() {
 + o=$(obioosm "$1" "" "" | sed -e 's/\//\\\//g') # make "\/" from "/" so sed below is OK
 + h=$(cat "./__BIOVZOR__.htm" | sed -e "s/__BIOVZOR_TIT__/$1/g" | sed -e "s/__BIOVZOR_CPRT__/$o/g" | sed -e "s/__BIOVZOR_J__/$1/g")
 + echo "$h" > "./jsonrss/$1.htm"
 + echo "*** $1 done ***"
 } }
  
Line 227: Line 256:
 # $3 = icon of the points # $3 = icon of the points
 function spagety () { function spagety () {
 +
 + if [[ "$errhtml" == "" ]]; then
 + >&2 echo "===== $2 ====="
 + else
 + >&2 echo "<h2>$2</h2>"
 + fi
  
  bylo="" # Minula pozice  bylo="" # Minula pozice
Line 308: Line 343:
  lid=$(echo "$radek" | sed -E 's/^.*<localityid>(.*)<\/localityid>.*$/\1/g;t;d')  lid=$(echo "$radek" | sed -E 's/^.*<localityid>(.*)<\/localityid>.*$/\1/g;t;d')
  
-  #>&2 echo "$co - $har - $den - $dur - $lor - $lrl - $lov - $elv" +# if [[ "$errhtml" == "" ]]; then 
-  #continue;+# >&2 echo "$co - $har - $den - $dur - $lor - $lrl - $lov - $elv" 
 +# else 
 +# >&2 echo "<span class='nok'>$co - $har - $den - $dur - $lor - $lrl - $lov - $elv</span><br>" 
 +# fi 
 +# continue;
  
  detid=$(echo "brmlab$co$obr$kde$kdy" | md5sum | grep -oe '[a-zA-Z0-9]*')  detid=$(echo "brmlab$co$obr$kde$kdy" | md5sum | grep -oe '[a-zA-Z0-9]*')
  
  if [[ "$kdex" = "" ]]; then  if [[ "$kdex" = "" ]]; then
- >&2 echo -e "\033[31m $lid KDEX '$kde' '$co' \033[0m" + if [[ "$errhtml" == "" ]]; then 
- >&2 echo -e "\033[31m $lid RADEK '$radek' \033[0m" + >&2 echo -e "\033[31m $lid KDEX '$kde' '$co' \033[0m" 
- continue;+ >&2 echo -e "\033[31m $lid RADEK '$radek' \033[0m" 
 + else 
 + >&2 echo "<span class='nok'>$lid KDEX '$kde' '$co'</span><br>" 
 + >&2 echo "<span class='nok'><pre>$radek</pre></span>" 
 + fi
  fi  fi
 +
  zkurvenetellico=$(echo "$obr" | grep -oe '\.[a-zA-Z]*$')  zkurvenetellico=$(echo "$obr" | grep -oe '\.[a-zA-Z]*$')
  odkurvenyobr=$(echo "$obr" | sed -e 's/%23/#/g')  odkurvenyobr=$(echo "$obr" | sed -e 's/%23/#/g')
Line 323: Line 367:
  if [[ ! -f "./img/$odkurvenyobr" ]]; then  if [[ ! -f "./img/$odkurvenyobr" ]]; then
  if [[ "$gen" != "negative" ]]; then  if [[ "$gen" != "negative" ]]; then
- >&2 echo -e "\033[31m $lid OBR $odkurvenyobr $co\033[0m"+ if [[ "$errhtml" == "" ]]; then 
 + >&2 echo -e "\033[31m $lid OBR $odkurvenyobr $co\033[0m" 
 + else 
 + >&2 echo "<span class='nok'>$lid OBR $odkurvenyobr $co</span>" 
 + fi
  continue;  continue;
  fi  fi
Line 575: Line 623:
  datelog+="$kdy $kde <a href='./det/$detid.htm' target='_blank'>$co</a><br>\n"  datelog+="$kdy $kde <a href='./det/$detid.htm' target='_blank'>$co</a><br>\n"
  
- >&2 echo -e "\033[32m$lid $co $obs\033[0m"+ if [[ "$errhtml" == "" ]]; then 
 + >&2 echo -e "\033[32m$lid $co $obs\033[0m" 
 + else 
 + >&2 echo "<span class='ok'>$lid $co $obs</span>" 
 + fi
  
  ox="$kdex"  ox="$kdex"
Line 599: Line 651:
 kingdoms=$(unzip -p "$1" tellico.xml | sed -E 's/^.*<new-field-4>(.*)<\/new-field-4>.*$/\1/g;t;d' | sort | uniq) kingdoms=$(unzip -p "$1" tellico.xml | sed -E 's/^.*<new-field-4>(.*)<\/new-field-4>.*$/\1/g;t;d' | sort | uniq)
  
-echo '<!DOCTYPE html>' +#echo '<!DOCTYPE html>' 
-echo '<html>' +#echo '<html>' 
-echo '<head>' +#echo '<head>' 
-echo ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' +#echo ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' 
-echo ' <title>brmlab - BioOSM</title>' +#echo ' <title>brmlab - BioOSM</title>' 
-echo ' <link rel="stylesheet" href="./style.css" type="text/css">' +#echo ' <link rel="stylesheet" href="./style.css" type="text/css">' 
-echo ' <link rel="favicon" href="./'$ICON_biohazard'">' +#echo ' <link rel="favicon" href="./'$ICON_biohazard'">' 
-echo ' <script src="./OpenLayers.js"></script>' +#echo ' <script src="./OpenLayers.js"></script>' 
-echo '</head>' +#echo '</head>' 
-echo '<body>' +#echo '<body>' 
-# Generate select +## Generate select 
-echo "<div id='plainlog'><b><a href='./bioosm.rss'>RSS feed</a><br><a href='./plainlog.htm'>Quick news log</a></b></div>" +#echo "<div id='plainlog'><b><a href='./bioosm.rss'>RSS feed</a><br><a href='./plainlog.htm'>Quick news log</a></b></div>" 
-#echo "<h1 id='title'>BioOSM - arma biologica in tuis vicinia</h1>" +##echo "<h1 id='title'>BioOSM - arma biologica in tuis vicinia</h1>" 
-echo "<h1 id='title'>BioOSM - creatures around us</h1>" +#echo "<h1 id='title'>BioOSM - creatures around us</h1>" 
- +# 
-ksel="<select id='reg' onChange='genphy()'>" +#ksel="<select id='reg' onChange='genphy()'>" 
-ksel="$ksel<option value='ALL' selected>ALL</option>" +#ksel="$ksel<option value='ALL' selected>ALL</option>" 
-while IFS='' read -r king || [[ -n "$king" ]]; do +#while IFS='' read -r king || [[ -n "$king" ]]; do 
- ksel="$ksel<option value='"$king"'>$king</option>" +# ksel="$ksel<option value='"$king"'>$king</option>" 
-done <<< $(echo "$kingdoms"+#done <<< $(echo "$kingdoms"
-ksel="$ksel</select>" +#ksel="$ksel</select>" 
-echo "Kingdom: $ksel " +#echo "Kingdom: $ksel " 
-echo "Phylum: <select id='phy' onChange='gencla()'><option>ALL</option></select>+#echo "Phylum: <select id='phy' onChange='gencla()'><option>ALL</option></select>
-echo "Class: <select id='cla' onChange='genord()'><option>ALL</option></select>+#echo "Class: <select id='cla' onChange='genord()'><option>ALL</option></select>
-echo "Order: <select id='ord' onChange='genfam()'><option>ALL</option></select>+#echo "Order: <select id='ord' onChange='genfam()'><option>ALL</option></select>
-echo "Family: <select id='fam' onChange='gengen()'><option>ALL</option></select>+#echo "Family: <select id='fam' onChange='gengen()'><option>ALL</option></select>
-echo "Genus: <select id='gen' onChange='genspe()'><option>ALL</option></select>" +#echo "Genus: <select id='gen' onChange='genspe()'><option>ALL</option></select>" 
-echo "Species: <select id='spe' onChange='armageddon()'><option>ALL</option></select>" +#echo "Species: <select id='spe' onChange='armageddon()'><option>ALL</option></select>" 
- +# 
-echo "<br><input type='button' value='Platyhelminthes' onClick='plostenkoidy()'>" +#echo "<br><input type='button' value='Platyhelminthes' onClick='plostenkoidy()'>" 
-echo "<label><input type='checkbox' id='studchecker' onChange='studdrv()'>Springs</label>" +#echo "<label><input type='checkbox' id='studchecker' onChange='studdrv()'>Springs</label>" 
-#echo "<input type='button' value='Bugs' onClick='buggy()'>" +##echo "<input type='button' value='Bugs' onClick='buggy()'>" 
-echo "<form style='display:inline;margin-left:5em'><input type='text' length=10 id='srch'><input type='submit' value='&#x1F50D;' onClick='limit();return false;'></form>" +#echo "<form style='display:inline;margin-left:5em'><input type='text' length=10 id='srch'><input type='submit' value='&#x1F50D;' onClick='limit();return false;'></form>" 
-echo "<br><br><div id='map' class='smallmap'></div>" +#echo "<br><br><div id='map' class='smallmap'></div>" 
-echo $(obioosm "" "" ""+#echo $(obioosm "" "" ""
-echo "</body>" +#echo "</body>" 
- +# 
-echo "<script>" +#echo "<script>" 
-echo 'document.getElementById("zavinacvmejlu").innerHTML="@";' +#echo 'document.getElementById("zavinacvmejlu").innerHTML="@";' 
-echo 'map = new OpenLayers.Map("map");' +#echo 'map = new OpenLayers.Map("map");' 
-echo 'map.addLayer(new OpenLayers.Layer.OSM());' +#echo 'map.addLayer(new OpenLayers.Layer.OSM());' 
-echo 'epsg4326 =  new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection' +#echo 'epsg4326 =  new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection' 
-echo 'projectTo = map.getProjectionObject(); //The map projection (Spherical Mercator)' +#echo 'projectTo = map.getProjectionObject(); //The map projection (Spherical Mercator)' 
-echo 'var lonLat = new OpenLayers.LonLat(15.478, 49.817).transform(epsg4326, projectTo);' +#echo 'var lonLat = new OpenLayers.LonLat(15.478, 49.817).transform(epsg4326, projectTo);' 
-echo 'var zoom=8;' +#echo 'var zoom=8;' 
-echo 'map.setCenter (lonLat, zoom);' +#echo 'map.setCenter (lonLat, zoom);' 
- +# 
-echo 'var vectorLayer = new OpenLayers.Layer.Vector("Overlay",{attribution:"<a href=\"http://brmlab.cz\">Brmlab</a>"});' +#echo 'var vectorLayer = new OpenLayers.Layer.Vector("Overlay",{attribution:"<a href=\"http://brmlab.cz\">Brmlab</a>"});' 
- +# 
-echo '// Define markers as "features" of the vector layer:' +#echo '// Define markers as "features" of the vector layer:' 
- +# 
-echo 'var atol = new OpenLayers.Feature.Vector(' +#echo 'var atol = new OpenLayers.Feature.Vector(' 
-echo ' new OpenLayers.Geometry.Point(14.41876, 50.10554).transform(epsg4326, projectTo),' +#echo ' new OpenLayers.Geometry.Point(14.41876, 50.10554).transform(epsg4326, projectTo),' 
-echo ' {description:"Atomovy atol Brmkini"} ,' +#echo ' {description:"Atomovy atol Brmkini"} ,' 
-echo ' {externalGraphic: "./biohazard.svg", graphicHeight:8, graphicWidth:8, graphicXOffset:-4, graphicYOffset:-4},' +#echo ' {externalGraphic: "./biohazard.svg", graphicHeight:8, graphicWidth:8, graphicXOffset:-4, graphicYOffset:-4},' 
-echo ');' +#echo ');' 
-echo 'vectorLayer.addFeatures(atol);' +#echo 'vectorLayer.addFeatures(atol);' 
-# Sem prijdou dalsi staticke ficury +## Sem prijdou dalsi staticke ficury 
-echo "map.addLayer(vectorLayer);" +#echo "map.addLayer(vectorLayer);" 
 +#
  
  
Line 680: Line 732:
  vepr=$(echo "$praseTC" | grep -E "<strcit-do-mapy>(yep)|(negative)|(nope)</strcit-do-mapy>" | grep -E "<grant>$grnt(_additional)?</grant>")  vepr=$(echo "$praseTC" | grep -E "<strcit-do-mapy>(yep)|(negative)|(nope)</strcit-do-mapy>" | grep -E "<grant>$grnt(_additional)?</grant>")
  spagety "$vepr" "$grnt" "$ICON_biohazard"  spagety "$vepr" "$grnt" "$ICON_biohazard"
 + genhtml "$grnt"
 done <<< $(echo "$granty") done <<< $(echo "$granty")
  
-#echo -e "$json{}]}" +#if [[ "$errhtml" == "html" ]]; then 
-echo '</script>' + >&2 echo "*** DONE ***" 
-echo '<script src="./bioosm.js"></script>' # Must be after JSON +#fi 
-echo "</html>"+ 
 + 
 +##echo -e "$json{}]}" 
 +#echo '</script>' 
 +#echo '<script src="./bioosm.js"></script>' # Must be after JSON 
 +#echo "</html>"
  
 # Create plaintext log # Create plaintext log
Line 725: Line 783:
  // Display ONLY platyhelminthes if reguired  // Display ONLY platyhelminthes if reguired
  pus=document.URL.match(/platyhelminthes=understone/);  pus=document.URL.match(/platyhelminthes=understone/);
 + console.log(pus);
  if(pus)  if(pus)
  plostenkoidy();  plostenkoidy();
Line 732: Line 791:
  }  }
  }  }
- request.open("GET",url,true);+ request.open("GET","./"+ubermaster+".json",true); // defined in html
  request.send();  request.send();
 } }
-wat=document.URL.match(/(index.htm)|(bioosm\/$)/); + 
-if(wat) +getJSONbioosm();
- getJSONbioosm();+
  
 var stud=JSON.parse('{}'); var stud=JSON.parse('{}');
Line 768: Line 826:
 var ICON_studanka="studanka.png" var ICON_studanka="studanka.png"
 var ICON_negative="negative.png" var ICON_negative="negative.png"
- 
-function getJSONcsop21() 
-{ 
- url="./CSOP_122123.json"; 
- var request; 
- if(window.XMLHttpRequest) 
- request=new XMLHttpRequest(); 
- else 
- request=new ActiveXObject("Microsoft.XMLHTTP"); 
- request.onreadystatechange=function() 
- { 
- if(request.readyState==4) 
- { 
- window.blob=JSON.parse(request.responseText); 
- window.arma=blob.arma; 
- armageddon() 
- } 
- } 
- request.open("GET",url,true); 
- request.send(); 
-} 
-function getJSONcsop22() 
-{ 
- url="./CSOP_122210.json"; 
- var request; 
- if(window.XMLHttpRequest) 
- request=new XMLHttpRequest(); 
- else 
- request=new ActiveXObject("Microsoft.XMLHTTP"); 
- request.onreadystatechange=function() 
- { 
- if(request.readyState==4) 
- { 
- window.blob=JSON.parse(request.responseText); 
- window.arma=blob.arma; 
- armageddon() 
- } 
- } 
- request.open("GET",url,true); 
- request.send(); 
-} 
-function getJSONexfissgtig() 
-{ 
- url="./none_exfiss_gtig.json"; 
- var request; 
- if(window.XMLHttpRequest) 
- request=new XMLHttpRequest(); 
- else 
- request=new ActiveXObject("Microsoft.XMLHTTP"); 
- request.onreadystatechange=function() 
- { 
- if(request.readyState==4) 
- { 
- window.blob=JSON.parse(request.responseText); 
- window.arma=blob.arma; 
- armageddon() 
- } 
- } 
- request.open("GET",url,true); 
- request.send(); 
-} 
- 
-function getJSONempb22() 
-{ 
- url="./EPMB2022.json"; // jo preklep kurva 
- var request; 
- if(window.XMLHttpRequest) 
- request=new XMLHttpRequest(); 
- else 
- request=new ActiveXObject("Microsoft.XMLHTTP"); 
- request.onreadystatechange=function() 
- { 
- if(request.readyState==4) 
- { 
- window.blob=JSON.parse(request.responseText); 
- window.arma=blob.arma; 
- armageddon() 
- } 
- } 
- request.open("GET",url,true); 
- request.send(); 
-} 
- 
-function getJSONparas() 
-{ 
- url="./parasitology.json"; // jo preklep kurva 
- var request; 
- if(window.XMLHttpRequest) 
- request=new XMLHttpRequest(); 
- else 
- request=new ActiveXObject("Microsoft.XMLHTTP"); 
- request.onreadystatechange=function() 
- { 
- if(request.readyState==4) 
- { 
- window.blob=JSON.parse(request.responseText); 
- window.arma=blob.arma; 
- armageddon() 
- } 
- } 
- request.open("GET",url,true); 
- request.send(); 
-} 
  
  
Line 1120: Line 1075:
 function armageddon() function armageddon()
 { {
 + console.log("a "+window.arma.length);
  var speval=document.getElementById("spe").value  var speval=document.getElementById("spe").value
  var genval=document.getElementById("gen").value  var genval=document.getElementById("gen").value
project/bioosm/start.txt · Last modified: 2023/09/21 12:15 by sachy