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
Next revision
Previous revision
Next revisionBoth sides next revision
project:bioosm:start [2018/06/07 23:21] – [K cemu to je] sumie-dhproject:bioosm:start [2018/07/15 14:35] – Added links to wikipedia; plaintext log sachy
Line 97: Line 97:
  
 ==== parse_tellico.sh ==== ==== parse_tellico.sh ====
-<code bash>+<code bash parse_tellico.sh>
 #!/bin/bash #!/bin/bash
 # Parse Tellico database to BioOSM index.htm # Parse Tellico database to BioOSM index.htm
Line 103: Line 103:
 # Print result to stdout # Print result to stdout
 # #
-# Generate minis in simg folder 
 # find ./ -type f -exec mogrify -verbose -layers Dispose -resize 128\>x128\> -quality 100% {} + # find ./ -type f -exec mogrify -verbose -layers Dispose -resize 128\>x128\> -quality 100% {} +
 # #
 +# // vectorLayer.removeFeatures(atol)
 +# // map.removeLayer(vectorLayer)
 # #
 # #
Line 112: Line 113:
 #   ./det/ID.htm details of each and every entry #   ./det/ID.htm details of each and every entry
 # #
 +
 +ICON_animalia="animalia.png"
 +ICON_bacteria="bacteria.png"
 +ICON_fungi="fungi.png"
 +ICON_chromista="chromista.png"
 +ICON_plantae="plantae.svg"
 +ICON_plostenkoid="plostenkoid.png"
 +ICON_protista="protista.png"
 +ICON_biohazard="biohazard.svg"
 +
 +# Return icon by Regnum
 +function geticon () {
 + case "$1" in
 + "Animalia")
 + echo "$ICON_animalia";;
 + "Bacteria")
 + echo "$ICON_bacteria";;
 + "Fungi")
 + echo "$ICON_fungi";;
 + "Chromista")
 + echo "$ICON_chromista";;
 + "Plantae")
 + echo "$ICON_plantae";;
 + "Protista")
 + echo "$ICON_protista";;
 + *)
 + echo "$ICON_biohazard";;
 + esac
 +}
 +
  
 rm -rfv "./det/*" rm -rfv "./det/*"
Line 128: Line 159:
 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>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 ' <script src="./OpenLayers.js"></script>' echo ' <script src="./OpenLayers.js"></script>'
 echo '</head>' echo '</head>'
  
 echo "<body>" echo "<body>"
- echo "<h1 id='title'>BioOSM - armis biologica in tuis vicinia</h1>"+ echo "<div style='position:absolute;top:0;right:0;margin:1em'><b><a href='./plainlog.htm'>Plaintext log</a></b></div>" 
 + echo "<h1 id='title'>BioOSM - arma biologica in tuis vicinia</h1>"
  
  # Generate select  # Generate select
Line 189: Line 222:
 ox="" # Old X ox="" # Old X
 oy="" # Old Y oy="" # Old Y
 +datelog="" # Entries sorted by date for plaintext log
 +
  
 while IFS='' read -r radek || [[ -n "$radek" ]]; do while IFS='' read -r radek || [[ -n "$radek" ]]; do
Line 197: Line 232:
  kdex=$(echo "$kde" | grep -oPe '[0-9]{2}\.[0-9]{1,10}$')  kdex=$(echo "$kde" | grep -oPe '[0-9]{2}\.[0-9]{1,10}$')
  kdey=$(echo "$kde" | grep -oPe '^[0-9]{2}\.[0-9]{1,10}')  kdey=$(echo "$kde" | grep -oPe '^[0-9]{2}\.[0-9]{1,10}')
- kdy=$(echo "$radek" | grep -oe ' <taken-date>.*</taken-date> ' | sed -E 's/( )*<(\/)?taken-date>( )*//g')+ kdy=$(echo "$radek" | grep -oe ' <taken-date>.*</taken-date> ' | sed -E 's/( )*<(\/)?taken-date>( )*//g' | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]{4})/\3-\2-\1/g' | sed -E 's/-([0-9])-/-0\1-/g' | sed -E 's/-([0-9])$/-0\1/g')
  skop_typ=$(echo "$radek" | grep -oe ' <new-field-1>.*</new-field-1> ' | sed -E 's/( )*<(\/)?new-field-1>( )*//g')  skop_typ=$(echo "$radek" | grep -oe ' <new-field-1>.*</new-field-1> ' | sed -E 's/( )*<(\/)?new-field-1>( )*//g')
  skop=$(echo "$radek" | grep -oe ' <microscope>.*</microscope> ' | sed -E 's/( )*<(\/)?microscope>( )*//g')  skop=$(echo "$radek" | grep -oe ' <microscope>.*</microscope> ' | sed -E 's/( )*<(\/)?microscope>( )*//g')
Line 235: Line 270:
  detpg="$detpg</head><body>"  detpg="$detpg</head><body>"
  detpg="$detpg<table class='dettbl'><tr>"  detpg="$detpg<table class='dettbl'><tr>"
- detpg="$detpg<td><h1>$co</h1>"+ detpg="$detpg<td><h1>$co (<a href='https://en.wikipedia.org/wiki/$co' target='_blank'>wiki</a>)</h1>"
  if [[ "$imp" != "" ]]; then  if [[ "$imp" != "" ]]; then
- detpg="$detpg<b>Imperium:</b> $imp<br>"+ detpg="$detpg<b>Imperium:</b> <a href='https://en.wikipedia.org/wiki/$imp' target='_blank'>$imp</a><br>"
  fi  fi
  if [[ "$reg" != "" ]]; then  if [[ "$reg" != "" ]]; then
- detpg="$detpg<b>Regnum:</b> $reg<br>"+ detpg="$detpg<b>Regnum:</b> <a href='https://en.wikipedia.org/wiki/$reg' target='_blank'>$reg</a><br>"
  fi  fi
  if [[ "$phy" != "" ]]; then  if [[ "$phy" != "" ]]; then
- detpg="$detpg<b>Phylum:</b> $phy<br>"+ detpg="$detpg<b>Phylum:</b> <a href='https://en.wikipedia.org/wiki/$phy' target='_blank'>$phy</a><br>"
  fi  fi
  if [[ "$cla" != "" ]]; then  if [[ "$cla" != "" ]]; then
- detpg="$detpg<b>Classis:</b> $cla<br>"+ detpg="$detpg<b>Classis:</b> <a href='https://en.wikipedia.org/wiki/$cla' target='_blank'>$cla</a><br>"
  fi  fi
  if [[ "$ord" != "" ]]; then  if [[ "$ord" != "" ]]; then
- detpg="$detpg<b>Ordo:</b> $ord<br>"+ detpg="$detpg<b>Ordo:</b> <a href='https://en.wikipedia.org/wiki/$ord' target='_blank'>$ord</a><br>"
  fi  fi
  if [[ "$fam" != "" ]]; then  if [[ "$fam" != "" ]]; then
- detpg="$detpg<b>Familia:</b> $fam<br>"+ detpg="$detpg<b>Familia:</b> <a href='https://en.wikipedia.org/wiki/$fam' target='_blank'>$fam</a><br>"
  fi  fi
  if [[ "$gen" != "" ]]; then  if [[ "$gen" != "" ]]; then
- detpg="$detpg<b>Genus:</b> $gen<br>"+ detpg="$detpg<b>Genus:</b> <a href='https://en.wikipedia.org/wiki/$gen' target='_blank'>$gen</a><br>"
  fi  fi
  if [[ "$spe" != "" ]]; then  if [[ "$spe" != "" ]]; then
Line 285: Line 320:
  detpg="$detpg<b>Video:</b> <a href=\"$vid\" target=\"_blank\">$vid</a><br>"  detpg="$detpg<b>Video:</b> <a href=\"$vid\" target=\"_blank\">$vid</a><br>"
  fi  fi
- detpg="$detpg</td><td>"+ detpg="$detpg</td><td style='min-width:66%'>"
  if [[ "$obr" != "" ]]; then  if [[ "$obr" != "" ]]; then
  detpg="$detpg<a href=\"../img/$obr\"><img src=\"../img/$obr\" alt=\"$co\" class='detimg'></a>"  detpg="$detpg<a href=\"../img/$obr\"><img src=\"../img/$obr\" alt=\"$co\" class='detimg'></a>"
Line 299: Line 334:
  detpg="$detpg</body></html>"  detpg="$detpg</body></html>"
  echo "$detpg" > "./det/$detid.htm"  echo "$detpg" > "./det/$detid.htm"
 +
 + # Plain log of entries
 + datelog="$datelog $kdy $kde <a href='./det/$detid.htm' target='_blank'>$co</a><br>\n"
  
  # Pokracujem v hadovi  # Pokracujem v hadovi
Line 310: Line 348:
  fi  fi
  spoj="$spoj<td>$co<br>$kdy</td>"  spoj="$spoj<td>$co<br>$kdy</td>"
 + spoj="$spoj<!-- $reg -->" # Metadata
  spoj="$spoj</tr>"  spoj="$spoj</tr>"
  ox="$kdex"  ox="$kdex"
Line 320: Line 359:
  # Predchozi pozice jen 1 zaznam?  # Predchozi pozice jen 1 zaznam?
  if [[ "$sam" != "" ]]; then  if [[ "$sam" != "" ]]; then
- echo "var n$i = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point($ox,$oy).transform(epsg4326,projectTo),{description:'"$sam"'},{externalGraphic:'./$3',graphicHeight:24,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-12});"+ samicon=$(geticon $(echo "$sam" | grep -oPe "<b>Regnum:</b> <[^>]*>[a-zA-Z0-9]*" | grep -oPe "[a-zA-Z0-9]*$")) 
 + # >&2 echo "$samicon" 
 + 
 + echo "var n$i = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point($ox,$oy).transform(epsg4326,projectTo),{description:'"$sam"'},{externalGraphic:'./$samicon',graphicHeight:24,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-12});"
  echo "$2.addFeatures(n$i);"  echo "$2.addFeatures(n$i);"
  spoj=""  spoj=""
Line 327: Line 369:
  # Predchozi pozice vic zaznamu?  # Predchozi pozice vic zaznamu?
  if [[ "$spoj" != "" ]]; then  if [[ "$spoj" != "" ]]; then
- echo "var n$i = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point($ox,$oy).transform(epsg4326,projectTo),{description:'<table class=\"hadtbl\">"$spoj"</table>'},{externalGraphic:'./$3',graphicHeight:24,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-12});"+ muchicons=$(echo "$spoj" | grep -oPe "<!-- [a-zA-Z0-9]* -->" | grep -oPe "[a-zA-Z0-9]*" | sort | uniq | wc -l) 
 + #>&2 echo "*** $muchicons" 
 + if [[ "$muchicons" == "1" ]]; then 
 + spojicon=$(geticon $(echo "$spoj" | grep -oPe "<!-- [a-zA-Z0-9]* -->" | grep -oPe "[a-zA-Z0-9]*" | sort | uniq)) 
 + #>&2 echo "*** $spojicon" 
 + else 
 + spojicon="$ICON_biohazard" 
 + fi 
 + echo "var n$i = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point($ox,$oy).transform(epsg4326,projectTo),{description:'<table class=\"hadtbl\">"$spoj"</table>'},{externalGraphic:'./$spojicon',graphicHeight:24,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-12});"
     echo "$2.addFeatures(n$i);"     echo "$2.addFeatures(n$i);"
  spoj=""  spoj=""
Line 341: Line 391:
  fi  fi
  spoj="$spoj<td>$co<br>$kdy</td>"  spoj="$spoj<td>$co<br>$kdy</td>"
 + spoj="$spoj<!-- $reg -->" # Metadata pyco
  spoj="$spoj</tr>"  spoj="$spoj</tr>"
  
  sam="<a href=\"./det/$detid.htm\" target=\"_blank\"><img src=\"./simg/$obr\" alt=\"$co\" class=\"buttimg\"></a>"  sam="<a href=\"./det/$detid.htm\" target=\"_blank\"><img src=\"./simg/$obr\" alt=\"$co\" class=\"buttimg\"></a>"
- sam="$sam<br><span class=\"butttext\"><b>Qualis:</b> $co<br>"+ sam="$sam<br><span class=\"butttext\">
 + sam="$sam<b>Qualis:</b> <a href=\"https://en.wikipedia.org/wiki/$co\" target=\"_blank\">$co</a><br>"
  if [[ "$imp" != "" ]]; then  if [[ "$imp" != "" ]]; then
- sam="$sam<b>Imperium:</b> $imp<br>"+ sam="$sam<b>Imperium:</b> <a href=\"https://en.wikipedia.org/wiki/$imp\" target=\"_blank\">$imp</a><br>"
  fi  fi
  if [[ "$reg" != "" ]]; then  if [[ "$reg" != "" ]]; then
- sam="$sam<b>Regnum:</b> $reg<br>"+ sam="$sam<b>Regnum:</b> <a href=\"https://en.wikipedia.org/wiki/$reg\" target=\"_blank\">$reg</a><br>"
  fi  fi
  if [[ "$phy" != "" ]]; then  if [[ "$phy" != "" ]]; then
- sam="$sam<b>Phylum:</b> $phy<br>"+ sam="$sam<b>Phylum:</b> <a href=\"https://en.wikipedia.org/wiki/$phy\" target=\"_blank\">$phy</a><br>"
  fi  fi
  if [[ "$cla" != "" ]]; then  if [[ "$cla" != "" ]]; then
- sam="$sam<b>Classis:</b> $cla<br>"+ sam="$sam<b>Classis:</b> <a href=\"https://en.wikipedia.org/wiki/$cla\" target=\"_blank\">$cla</a><br>"
  fi  fi
  if [[ "$ord" != "" ]]; then  if [[ "$ord" != "" ]]; then
- sam="$sam<b>Ordo:</b> $ord<br>"+ sam="$sam<b>Ordo:</b> <a href=\"https://en.wikipedia.org/wiki/$ord\" target=\"_blank\">$ord</a><br>"
  fi  fi
  if [[ "$fam" != "" ]]; then  if [[ "$fam" != "" ]]; then
- sam="$sam<b>Familia:</b> $fam<br>"+ sam="$sam<b>Familia:</b> <a href=\"https://en.wikipedia.org/wiki/$fam\" target=\"_blank\">$fam</a><br>"
  fi  fi
  if [[ "$gen" != "" ]]; then  if [[ "$gen" != "" ]]; then
- sam="$sam<b>Genus:</b> $gen<br>"+ sam="$sam<b>Genus:</b> <a href=\"https://en.wikipedia.org/wiki/$gen\" target=\"_blank\">$gen</a><br>"
  fi  fi
  if [[ "$spe" != "" ]]; then  if [[ "$spe" != "" ]]; then
Line 393: Line 445:
  sam="$sam</span>"  sam="$sam</span>"
  
- #>&2 echo "$sam" 
  >&2 echo "$co $obs"  >&2 echo "$co $obs"
  
Line 410: Line 461:
 # Do not forget to print last line when WHILE ends! # Do not forget to print last line when WHILE ends!
 if [[ "$sam" = "" ]]; then if [[ "$sam" = "" ]]; then
 + muchicons=$(echo "$spoj" | grep -oPe "<!-- [a-zA-Z0-9]* -->" | grep -oPe "[a-zA-Z0-9]*" | sort | uniq | wc -l)
 + if [[ "$muchicons" == "1" ]]; then
 + samicon=$(geticon $(echo "$spoj" | grep -oPe "<!-- [a-zA-Z0-9]* -->" | grep -oPe "[a-zA-Z0-9]*" | sort | uniq))
 + else
 + samicon="$ICON_biohazard"
 + fi
  sam="<table style=\"hadtbl\">$spoj</table>"  sam="<table style=\"hadtbl\">$spoj</table>"
 +else
 + samicon=$(geticon $(echo "$sam" | grep -oPe "<b>Regnum:</b> [a-zA-Z0-9]*" | grep -oPe "[a-zA-Z0-9]*$"))
 fi fi
-echo "var n$i = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point($kdex,$kdey).transform(epsg4326,projectTo),{description:'"$sam"'},{externalGraphic:'./$3',graphicHeight:24,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-12});"+echo "var n$i = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point($kdex,$kdey).transform(epsg4326,projectTo),{description:'"$sam"'},{externalGraphic:'./$samicon',graphicHeight:24,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-12});"
 echo "$2.addFeatures(n$i);" echo "$2.addFeatures(n$i);"
  
Line 418: Line 477:
  
 echo "var ALL = new OpenLayers.Layer.Vector('Overlay',{attribution:'<a href=\"http://brmlab.cz\">Brmlab</a>'});" echo "var ALL = new OpenLayers.Layer.Vector('Overlay',{attribution:'<a href=\"http://brmlab.cz\">Brmlab</a>'});"
-spagety "$praseTC" "ALL" "biohazard.svg"+spagety "$praseTC" "ALL" "$ICON_biohazard"
 echo "map.addLayer(ALL);" echo "map.addLayer(ALL);"
 +
 +# Create plaintext log JUST AFTER "spagety ALL"
 +dateloghtm="<html><head>"
 +dateloghtm="$dateloghtm<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>"
 +dateloghtm="$dateloghtm<link rel='stylesheet' href='./style.css' type='text/css'>"
 +dateloghtm="$dateloghtm<title>Brmlab - BioOSM plaintext log</title>"
 +dateloghtm="$dateloghtm</head><body>"
 +datelogsort=$(echo -e "$datelog" | sort -r | uniq)
 +dateloghtm="$dateloghtm $datelogsort"
 +dateloghtm="$dateloghtm</body></html>"
 +echo "$dateloghtm" > "./plainlog.htm"
  
 echo "var laycon = [vectorLayer,ALL];" # Layer controls JS array echo "var laycon = [vectorLayer,ALL];" # Layer controls JS array
Line 425: Line 495:
  echo "var $spag = new OpenLayers.Layer.Vector('Overlay',{attribution:'<a href=\"http://brmlab.cz\">Brmlab</a>'});"  echo "var $spag = new OpenLayers.Layer.Vector('Overlay',{attribution:'<a href=\"http://brmlab.cz\">Brmlab</a>'});"
  spg=$(echo "$praseTC" | grep "<new-field-4>$spag</new-field-4>")  spg=$(echo "$praseTC" | grep "<new-field-4>$spag</new-field-4>")
- case "$spag" in + icon=$(geticon "$spag")
- "Animalia") +
- icon="animalia.png";; +
- "Bacteria"+
- icon="bacteria.png";; +
- "Fungi"+
- icon="fungi.png";; +
- "Chromista"+
- icon="chromista.png";; +
- "Plantae"+
- icon="plantae.svg";; +
- "Protista"+
- icon="protista.png";; +
- *) +
- icon="biohazard.svg";; +
- esac +
  spagety "$spg" "$spag" "$icon"  spagety "$spg" "$spag" "$icon"
  echo "laycon.push($spag);"  echo "laycon.push($spag);"
Line 449: Line 503:
 spg=$(echo "$praseTC" | grep "<phylum>Platyhelminthes</phylum>") spg=$(echo "$praseTC" | grep "<phylum>Platyhelminthes</phylum>")
 echo "var Platyhelminthes = new OpenLayers.Layer.Vector('Overlay',{attribution:'<a href=\"http://brmlab.cz\">Brmlab</a>'});" echo "var Platyhelminthes = new OpenLayers.Layer.Vector('Overlay',{attribution:'<a href=\"http://brmlab.cz\">Brmlab</a>'});"
-spagety "$spg" "Platyhelminthes" "plostenkoid.png"+spagety "$spg" "Platyhelminthes" "$ICON_plostenkoid"
 echo "laycon.push(Platyhelminthes)" echo "laycon.push(Platyhelminthes)"
  
project/bioosm/start.txt · Last modified: 2023/09/21 12:15 by sachy