Browse Source

add first version of touris=information checks

tkas 2 years ago
parent
commit
9d5f043c24
2 changed files with 31 additions and 1 deletions
  1. 30 0
      gp/index.php
  2. 1 1
      update.sh

+ 30 - 0
gp/index.php

@@ -250,6 +250,7 @@ iframe#hiddenIframe {
   (<a href="./?ok">OK</a>, <a href="./?bad">noref+noimg</a>,
   <a href="./?cor">noref+img</a>, <a href="./?img">unused img</a>)
 </li>
+<li><a href="./?tourism">Show</a> strange tourism=information without information=*</li>
 <li><a href="./?get.gpx">Download GPX</a> with guideposts without correct photos $gpx_time</li>
 <li><a href="./?get.json">Download JSON</a> with guideposts without correct photos $json_time</li>
 <li><a href="stats.php">Show guideposts</a> statistics</li>
@@ -566,6 +567,35 @@ if(isset($_GET['analyse-run'])){ //{{{
   fclose($lck);
 } // }}}
 
+if(isset($_GET['tourism'])){ //{{{
+  $lck = fopen($lock_file, 'w+') or die ('Cannot create lock file');
+  if (!flock($lck, LOCK_EX | LOCK_NB)){
+    echo "A: some operation on GP allready running";
+    return;
+  }
+
+  echo "<table>";
+  echo '<tr><th width="7%">node ID</th><th width="11%">node coord</th><th width="12%">node ref</th><th>images</th></tr>'."\n";
+
+  $query="SELECT id, ST_AsText(geom) AS geom, tags->'ref' AS ref, tags->'name' AS name, tags->'information' AS information FROM nodes WHERE tags @> '\"tourism\"=>\"information\"'::hstore ORDER BY id";
+  $res = pg_query($query);
+  while ($data = pg_fetch_object($res)) {
+    $geom = preg_replace('/POINT\(([-0-9.]{1,8})[0-9]* ([-0-9.]{1,8})[0-9]*\)/', '$2 $1', $data->geom);
+
+    if($data->information == '') echo '<tr>'
+      .'<td><a href="http://openstreetmap.org/node/'.$data->id.'">'.$data->id.'</a></td>'
+      .'<td><a target="hiddenIframe" href="http://127.0.0.1:8111/load_object?objects=n'.$data->id.'">'.$geom.'</a></td><td>'.$data->ref.'</td>'
+      .'<td>'.$data->name.'</td>'
+      ."</tr>\n";
+  }
+  pg_free_result($res);
+  
+  echo "</table>";
+
+  flock($lck, LOCK_UN);
+  fclose($lck);
+} // }}}
+
 //show all OSM nodes
 if(isset($_GET['all'])){ //{{{
   $gp_class['ok']=0;

+ 1 - 1
update.sh

@@ -60,7 +60,7 @@ elif [ "$ret" != "0" ]; then
 else
 	echo Updated dump downloaded. [$ret] >> $LOGFILE
 fi
-$OSMFILTER $NEXT_DUMP --keep-ways="highway=" --keep="operator=cz:KČT information=guidepost" --out-o5m > $NEXT_FILTERED_DUMP
+$OSMFILTER $NEXT_DUMP --keep-ways="highway=" --keep="operator=cz:KČT information=guidepost tourism=information" --out-o5m > $NEXT_FILTERED_DUMP
 ret=$?
 echo `date` >> $LOGFILE
 if [ "$ret" != "0" ]; then