<?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');
<?php
header("content-type: text/xml; charset=UTF-8");
- header("Access-Control-Allow-Origin: *");
echo "<";
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
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)
{
echo "</$sKey>";
}
echo "</addressparts>";
- }
+ }
}
-
+
echo "</reversegeocode>";
});
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>
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'])
<?php
+ header("content-type: application/json; charset=UTF-8");
+
$aFilteredPlaces = array();
foreach($aSearchResults as $iResNum => $aPointDetails)
{
<?php
header("content-type: text/xml; charset=UTF-8");
- header("Access-Control-Allow-Origin: *");
echo "<";
echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
-Subproject commit efe87e2740349bdda46dfc44f7806b9f6bc40a3d
+Subproject commit 3586caa0936e052ec14a7172769df4b3b4da2d08
}
// Website settings
+ @define('CONST_NoAccessControl', true);
@define('CONST_BlockedIPs', '');
@define('CONST_IPBanFile', CONST_BasePath.'/settings/ip_blocks');
@define('CONST_WhitelistedIPs', '');
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
$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";
$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)
{