]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 17 Dec 2012 22:07:03 +0000 (23:07 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 17 Dec 2012 22:07:03 +0000 (23:07 +0100)
Conflicts:
lib/init-website.php
settings/settings.php

lib/init-website.php
lib/template/address-xml.php
lib/template/details-html.php
lib/template/search-json.php
lib/template/search-xml.php
osm2pgsql
settings/settings.php
sql/partitions.src.sql
website/details.php
website/reverse.php

index ce046eaa6b752ef8d9bb41e4ef1e8025b5fc000a..eb275af290e8b15b8aa791eddbd3bc72eb859613 100644 (file)
@@ -1,4 +1,16 @@
 <?php
-    require_once('init.php');
+       require_once('init.php');
+
+       if (CONST_NoAccessControl)
+       {
+               header("Access-Control-Allow-Origin: *");
+               header("Access-Control-Allow-Methods: OPTIONS,GET");
+               if (!empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
+               {
+                       header("Access-Control-Allow-Headers: ".$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']);
+               }
+       }
+       if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') exit;
+
 
     header('Content-type: text/html; charset=utf-8');
index fcd90b85e63cc6b9ea55c2accde01763244bebfa..9989bb31aa0a515ffe508f3aef4a68be5563ee59 100644 (file)
@@ -1,6 +1,5 @@
 <?php
        header("content-type: text/xml; charset=UTF-8");
-       header("Access-Control-Allow-Origin: *");
 
        echo "<";
        echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
@@ -29,7 +28,7 @@
                if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
                echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
 
-        if ($bShowAddressDetails) {
+               if ($bShowAddressDetails) {
                        echo "<addressparts>";
                        foreach($aAddress as $sKey => $sValue)
                        {
@@ -39,7 +38,7 @@
                                echo "</$sKey>";
                        }
                        echo "</addressparts>";
-        }
+               }
        }
-       
+
        echo "</reversegeocode>";
index e2799539c896cfbc89d424d48d6382f879dec705..b56f3989a5fb30ce4df0feff3d91491b4bd2f238 100644 (file)
                        });
 
                        var feature = freader.read('<?php echo $aPointDetails['outlinestring'];?>');
+                       var featureCentre = freader.read('POINT(<?php echo $aPointDetails['lon'];?> <?php echo $aPointDetails['lat'];?>)');
                        if (feature) {
                                map.zoomToExtent(feature.geometry.getBounds());
-
                                feature.style = {
                                        strokeColor: "#75ADFF",
                                        fillColor: "#F0F7FF",
                                        strokeWidth: <?php echo ($aPointDetails['isarea']=='t'?'2':'5');?>,
                                        strokeOpacity: 0.75,
                                        fillOpacity: 0.75,
-                                       pointRadius: 100
+                                       pointRadius: 50
+                               };
+
+<?php if ($aPointDetails['isarea']=='t') {?>
+                               featureCentre.style = {
+                                       strokeColor: "#008800",
+                                       fillColor: "#338833",
+                                       strokeWidth: <?php echo ($aPointDetails['isarea']=='t'?'2':'5');?>,
+                                       strokeOpacity: 0.75,
+                                       fillOpacity: 0.75,
+                                       pointRadius: 8
                                };
+                               vectorLayer.addFeatures([feature,featureCentre]);
+<?php } else { ?>
                                vectorLayer.addFeatures([feature]);
+<?php } ?>
                        }
                }
        </script>
@@ -84,6 +97,7 @@
        echo ' <div>Rank: <span class="rankaddress">'.$aPointDetails['rank_search_label'].'</span></div>';
        if ($aPointDetails['calculated_importance']) echo ' <div>Importance: <span class="rankaddress">'.$aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)').'</span></div>';
        echo ' <div>Coverage: <span class="area">'.($aPointDetails['isarea']=='t'?'Polygon':'Point').'</span></div>';
+       echo ' <div>Centre Point: <span class="area">'.$aPointDetails['lat'].','.$aPointDetails['lon'].'</span></div>';
        $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
        if ($sOSMType) echo ' <div>OSM: <span class="osm">'.$sOSMType.' <a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aPointDetails['osm_id'].'">'.$aPointDetails['osm_id'].'</a></span></div>';
        if ($aPointDetails['wikipedia'])
index 45272d3540dc822511148b3bd1b5bcfb6ef80075..4b3b279d77362c2b9dec8d4ff4a6d411587f82bc 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+       header("content-type: application/json; charset=UTF-8");
+
        $aFilteredPlaces = array();
        foreach($aSearchResults as $iResNum => $aPointDetails)
        {
index fa6b14a37af693515b52473f071822fdb8172d78..aa029d2bb142bcd9fc4b16660e512c4f63063c85 100644 (file)
@@ -1,6 +1,5 @@
 <?php
        header("content-type: text/xml; charset=UTF-8");
-       header("Access-Control-Allow-Origin: *");
 
        echo "<";
        echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
index efe87e2740349bdda46dfc44f7806b9f6bc40a3d..3586caa0936e052ec14a7172769df4b3b4da2d08 160000 (submodule)
--- a/osm2pgsql
+++ b/osm2pgsql
@@ -1 +1 @@
-Subproject commit efe87e2740349bdda46dfc44f7806b9f6bc40a3d
+Subproject commit 3586caa0936e052ec14a7172769df4b3b4da2d08
index 5cc368eca4d1b8f3768ad1fc42c45dac31dd17af..5231692fa04a2b9a27d14ca010aad7bc59053814 100644 (file)
@@ -37,6 +37,7 @@
        }
 
        // Website settings
+       @define('CONST_NoAccessControl', true);
        @define('CONST_BlockedIPs', '');
        @define('CONST_IPBanFile', CONST_BasePath.'/settings/ip_blocks');
        @define('CONST_WhitelistedIPs', '');
index 3fb7962c4e5d3a62bb0d6ca8e6b641ed10aeb2a0..ab5b116302b6918364eb7ce05c66f6a61671f8b8 100644 (file)
@@ -178,7 +178,7 @@ BEGIN
           ST_Distance(centroid, point) as distance, null as isguess
           FROM search_name_-partition-
           WHERE name_vector @> ARRAY[isin_token]
-          AND ST_DWithin(centroid, point, 0.01) 
+          AND ST_DWithin(centroid, point, 0.03)
           AND search_rank between 22 and 27
       ORDER BY distance ASC limit 1
     LOOP
index 124b0f902cd9d3de58f95562c9e252058b2df790..8c838d46bfc4fe7157660f5c144c649c7d187c47 100755 (executable)
@@ -63,6 +63,8 @@
        $sSQL = "select place_id, osm_type, osm_id, class, type, name, admin_level, housenumber, street, isin, postcode, country_code, importance, wikipedia,";
        $sSQL .= " to_char(indexed_date, 'YYYY-MM-DD HH24:MI') as indexed_date, parent_place_id, rank_address, rank_search, get_searchrank_label(rank_search) as rank_search_label, get_name_by_language(name,$sLanguagePrefArraySQL) as localname, ";
        $sSQL .= " ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ";
+//     $sSQL .= " ST_Area(geometry::geography) as area, ";
+       $sSQL .= " ST_y(centroid) as lat, ST_x(centroid) as lon,";
        $sSQL .= " case when importance = 0 OR importance IS NULL then 0.75-(rank_search::float/40) else importance end as calculated_importance, ";
        $sSQL .= " ST_AsText(CASE WHEN ST_NPoints(geometry) > 5000 THEN ST_SimplifyPreserveTopology(geometry, 0.0001) ELSE geometry END) as outlinestring";
        $sSQL .= " from placex where place_id = $iPlaceID";
index 2c62948fbb7a20d1d89612ee28ba0a52b266a5cc..95889fc4ad15956c036006044871cc6ef3d175d3 100755 (executable)
                $sSQL .= " get_name_by_language(name, ARRAY['ref']) as ref,";
                $sSQL .= " st_y(st_centroid(geometry)) as lat, st_x(st_centroid(geometry)) as lon";
                $sSQL .= " from placex where place_id = $iPlaceID ";
-//var_dump($sSQL);
+
                $aPlace = $oDB->getRow($sSQL);
+//var_dump($sSQL, $aPlace); exit;
 
                if ($bShowAddressDetails)
                {