Skip to content

Commit

Permalink
fix chopped buildig in manhattan
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Feb 12, 2013
1 parent 894adbc commit afacfe9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 83 deletions.
2 changes: 1 addition & 1 deletion index_dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#coordinates_3_ObenRechts { position: absolute; top:1em; right:1em; }
-->
</style>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="min/jquery.min.js"></script>
<script>
function wmaMessageHub(e) {
e = e.originalEvent;
Expand Down
2 changes: 1 addition & 1 deletion labellayout.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<title>Map Label Overlap Reduction</title>
<script type="text/javascript" src="jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="min/jquery.min.js"></script>
<link href="wikiminiatlas.css" rel="stylesheet" type="text/css" />
<style>
#canvas {
Expand Down
48 changes: 8 additions & 40 deletions tiles/jsontile.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
if( $a !== 'purge' ) {
if( file_exists( $tfile ) ) {
header("Cache-Control: public, max-age=3600");
// TODO parse json and check timestamp (or check file time)
readfile( $tfile );
exit;
}
Expand Down Expand Up @@ -78,43 +79,20 @@ function beginsWith($str, $sub) {
//transform( ST_GeomFromText('POLYGON(($llx $ury, $urx $ury, $urx $lly, $llx $lly, $llx $ury))', 4326 ), 900913 )
$table = array(
array('planet_polygon','building IS NULL AND not exist(hstore(tags),\'building:part\') AND',$intersect),
array('planet_line','',$intersect)
array('planet_line','building IS NULL AND not exist(hstore(tags),\'building:part\') AND',$intersect)
);

/*
$table = array(
array( "(SELECT way, waterway, \"natural\" from planet_polygon where ( waterway in ('riverbank','dock') ) or ( \"natural\" in ('water','bay','wetland','wood', 'grassland','fell') ) ) as foo",'',$intersect,array('waterway','natural')),
array("(SELECT way, landuse,leisure from planet_polygon where landuse in ('military','railway','commercial','industrial','residential','retail','basin','salt_pond','orchard','cemetary','meadow','village_green','forrest','recreation_ground') or leisure in ('dog_park','garden','park','pitch','stadium') ) as foo",'',$intersect,array('landuse','leisure')),
array( "(SELECT way,waterway from planet_line where waterway in ('canal','river','stream')) as foo",'',$intersect,array('waterway')),
array( "(SELECT way,route from planet_line where route in ('ferry')) as foo",'',$intersect,array('route')),
array( "(SELECT way,railway from planet_line where railway in ('rail','preserved')) as foo",'',$intersect,array('railway')),
array( "(SELECT way,highway from planet_line where highway in ('track','path','residential','tertiary','tertiary_link','unclassified','service')) as foo",'',$intersect,array('highway')),
array( "(SELECT way,highway from planet_line where highway in ('primary','primary_link','secondary','secondary_link','motorway','motorway_link','trunk','trunk_link')) as foo",'',$intersect,array('highway'))
);
$table = array(
array( "(SELECT * from planet_polygon where ( waterway in ('riverbank','dock') ) or ( \"natural\" in ('water','bay','wetland','wood', 'grassland','fell') ) ) as foo",'',$intersect),
array( "(SELECT * from planet_polygon where landuse in ('military','railway','commercial','industrial','residential','retail','basin','salt_pond','orchard','cemetary','meadow','village_green','forrest','recreation_ground') or leisure in ('dog_park','garden','park','pitch','stadium') ) as foo",'',$intersect),
array( "(SELECT * from planet_line where waterway in ('canal','river','stream')) as foo",'',$intersect),
array( "(SELECT * from planet_line where route in ('ferry')) as foo",'',$intersect),
array( "(SELECT * from planet_line where railway in ('rail','preserved')) as foo",'',$intersect),
array( "(SELECT * from planet_line where highway in ('track','path')) as foo",'',$intersect),
array( "(SELECT * from planet_line where highway in ('residential','tertiary','tertiary_link','unclassified','service')) as foo",'',$intersect),
array( "(SELECT * from planet_line where highway in ('primary','primary_link','secondary','secondary_link')) as foo",'',$intersect),
array( "(SELECT * from planet_roads where highway in ('motorway','motorway_link','trunk','trunk_link')) as foo",'',$intersect)
);
*/

// also return buildings for large zoom levels
if( $z>=14 ) $table[] = array('planet_polygon','(building IS NOT NULL OR exist(hstore(tags),\'building:part\')) AND','way',$tags);
if( $z>=14 ) {
$table[] = array('planet_polygon','(building IS NOT NULL OR exist(hstore(tags),\'building:part\')) AND','way');
$table[] = array('planet_line','(building IS NOT NULL OR exist(hstore(tags),\'building:part\')) AND','way');
}

$geo = array();
$tagfound = array();
$idx = array();
for( $i=0; $i<count($table); $i++ ) {
// build query for the cropped data without buildings
//$taglist = '"'.implode($table[$i][3],'", "').'"';
//$tagnum = count($table[$i][3]);
$query = "
select
ST_AsGeoJSON( transform(".$table[$i][2].",4326), 9 ),
Expand All @@ -125,19 +103,9 @@ function beginsWith($str, $sub) {
ST_IsValid(way) AND way && SetSRID('BOX3D($mllx $mlly, $murx $mury)'::box3d,900913);
";

// way && SetSRID('BOX3D($llx $lly, $urx $ury)'::box3d,4326);
// way && SetSRID('BOX3D($mllx $mlly, $murx $mury)'::box3d,900913);
/*
ST_Intersects
way,
transform( ST_GeomFromText('POLYGON(($llx $ury, $urx $ury, $urx $lly, $llx $lly, $llx $ury))', 4326 ), 900913 )
);
*/

// debug
if( $a === 'query' ) {
echo $query;
exit;
echo $query,"\n\n";
}

// perform query
Expand Down Expand Up @@ -232,7 +200,7 @@ function beginsWith($str, $sub) {
}

//$s = json_encode( array( "data" => $geo, "x" => $x, "y" => $y, "z" => $z, "f" => $tagfound, "v" => 2, "idx" => $idx, "bbox" => "$mllx $mlly, $murx $mury" ) );
$s = json_encode( array( "data" => $geo, "x" => $x, "y" => $y, "z" => $z, "f" => $tagfound, "v" => 3, "idx" => $idx, "t" => time() ) );
$s = json_encode( array( "data" => $geo, "x" => $x, "y" => $y, "z" => $z, "f" => $tagfound, "v" => 4, "idx" => $idx, "t" => time() ) );

// do not cache purge action
if( $a !== 'purge' ) {
Expand Down
47 changes: 7 additions & 40 deletions tiles/jsontile_dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,43 +79,20 @@ function beginsWith($str, $sub) {
//transform( ST_GeomFromText('POLYGON(($llx $ury, $urx $ury, $urx $lly, $llx $lly, $llx $ury))', 4326 ), 900913 )
$table = array(
array('planet_polygon','building IS NULL AND not exist(hstore(tags),\'building:part\') AND',$intersect),
array('planet_line','',$intersect)
array('planet_line','building IS NULL AND not exist(hstore(tags),\'building:part\') AND',$intersect)
);

/*
$table = array(
array( "(SELECT way, waterway, \"natural\" from planet_polygon where ( waterway in ('riverbank','dock') ) or ( \"natural\" in ('water','bay','wetland','wood', 'grassland','fell') ) ) as foo",'',$intersect,array('waterway','natural')),
array("(SELECT way, landuse,leisure from planet_polygon where landuse in ('military','railway','commercial','industrial','residential','retail','basin','salt_pond','orchard','cemetary','meadow','village_green','forrest','recreation_ground') or leisure in ('dog_park','garden','park','pitch','stadium') ) as foo",'',$intersect,array('landuse','leisure')),
array( "(SELECT way,waterway from planet_line where waterway in ('canal','river','stream')) as foo",'',$intersect,array('waterway')),
array( "(SELECT way,route from planet_line where route in ('ferry')) as foo",'',$intersect,array('route')),
array( "(SELECT way,railway from planet_line where railway in ('rail','preserved')) as foo",'',$intersect,array('railway')),
array( "(SELECT way,highway from planet_line where highway in ('track','path','residential','tertiary','tertiary_link','unclassified','service')) as foo",'',$intersect,array('highway')),
array( "(SELECT way,highway from planet_line where highway in ('primary','primary_link','secondary','secondary_link','motorway','motorway_link','trunk','trunk_link')) as foo",'',$intersect,array('highway'))
);
$table = array(
array( "(SELECT * from planet_polygon where ( waterway in ('riverbank','dock') ) or ( \"natural\" in ('water','bay','wetland','wood', 'grassland','fell') ) ) as foo",'',$intersect),
array( "(SELECT * from planet_polygon where landuse in ('military','railway','commercial','industrial','residential','retail','basin','salt_pond','orchard','cemetary','meadow','village_green','forrest','recreation_ground') or leisure in ('dog_park','garden','park','pitch','stadium') ) as foo",'',$intersect),
array( "(SELECT * from planet_line where waterway in ('canal','river','stream')) as foo",'',$intersect),
array( "(SELECT * from planet_line where route in ('ferry')) as foo",'',$intersect),
array( "(SELECT * from planet_line where railway in ('rail','preserved')) as foo",'',$intersect),
array( "(SELECT * from planet_line where highway in ('track','path')) as foo",'',$intersect),
array( "(SELECT * from planet_line where highway in ('residential','tertiary','tertiary_link','unclassified','service')) as foo",'',$intersect),
array( "(SELECT * from planet_line where highway in ('primary','primary_link','secondary','secondary_link')) as foo",'',$intersect),
array( "(SELECT * from planet_roads where highway in ('motorway','motorway_link','trunk','trunk_link')) as foo",'',$intersect)
);
*/

// also return buildings for large zoom levels
if( $z>=14 ) $table[] = array('planet_polygon','(building IS NOT NULL OR exist(hstore(tags),\'building:part\')) AND','way',$tags);
if( $z>=14 ) {
$table[] = array('planet_polygon','(building IS NOT NULL OR exist(hstore(tags),\'building:part\')) AND','way');
$table[] = array('planet_line','(building IS NOT NULL OR exist(hstore(tags),\'building:part\')) AND','way');
}

$geo = array();
$tagfound = array();
$idx = array();
for( $i=0; $i<count($table); $i++ ) {
// build query for the cropped data without buildings
//$taglist = '"'.implode($table[$i][3],'", "').'"';
//$tagnum = count($table[$i][3]);
$query = "
select
ST_AsGeoJSON( transform(".$table[$i][2].",4326), 9 ),
Expand All @@ -126,19 +103,9 @@ function beginsWith($str, $sub) {
ST_IsValid(way) AND way && SetSRID('BOX3D($mllx $mlly, $murx $mury)'::box3d,900913);
";

// way && SetSRID('BOX3D($llx $lly, $urx $ury)'::box3d,4326);
// way && SetSRID('BOX3D($mllx $mlly, $murx $mury)'::box3d,900913);
/*
ST_Intersects
way,
transform( ST_GeomFromText('POLYGON(($llx $ury, $urx $ury, $urx $lly, $llx $lly, $llx $ury))', 4326 ), 900913 )
);
*/

// debug
if( $a === 'query' ) {
echo $query;
exit;
echo $query,"\n\n";
}

// perform query
Expand Down Expand Up @@ -233,7 +200,7 @@ function beginsWith($str, $sub) {
}

//$s = json_encode( array( "data" => $geo, "x" => $x, "y" => $y, "z" => $z, "f" => $tagfound, "v" => 2, "idx" => $idx, "bbox" => "$mllx $mlly, $murx $mury" ) );
$s = json_encode( array( "data" => $geo, "x" => $x, "y" => $y, "z" => $z, "f" => $tagfound, "v" => 3, "idx" => $idx, "t" => time(), "bbox" => "$mllx $mlly, $murx $mury" ) );
$s = json_encode( array( "data" => $geo, "x" => $x, "y" => $y, "z" => $z, "f" => $tagfound, "v" => 4, "idx" => $idx, "t" => time() ) );

// do not cache purge action
if( $a !== 'purge' ) {
Expand Down
5 changes: 4 additions & 1 deletion wikiminiatlas_i18n.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1809,6 +1809,9 @@ var strings =
ilo:'Kutien ti pannakaituon'
},
dyk: {
en: ['Due to a toolserver problem various map-styles are temporarily unavailable.']
},
/* dyk: {
de: ['Halte Strg oder ⌘ und positioniere den Mauspfeil auf einen Link, um eine Artikelzusammenfassung anzuzeigen.',
'Druecke "o" oder oeffne die Einstellungen um eine Einblendung zum Groessenvergleich zu aktivieren.',
'Jetzt mit <a href="#" onclick="wmaNews[0]()">Mondkarte</a>!',
Expand Down Expand Up @@ -1837,7 +1840,7 @@ var strings =
'探索<a href="#" onclick="wmaNews[0]()">月球</a>!',
'WikiMiniAtlas新功能: <a href="#" onclick="wmaNews[1]()">3D-建筑</a>!',
'WikiMiniAtlas is now resizable. Just move the mouse in the bottom left corner!']
},
},*/
other: {
ar: 'آخرون',
ca: 'altres',
Expand Down

0 comments on commit afacfe9

Please sign in to comment.