mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 05:44:06 +00:00
Include the centre point on the details page
This commit is contained in:
@@ -46,18 +46,31 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
var feature = freader.read('<?php echo $aPointDetails['outlinestring'];?>');
|
var feature = freader.read('<?php echo $aPointDetails['outlinestring'];?>');
|
||||||
|
var featureCentre = freader.read('POINT(<?php echo $aPointDetails['lon'];?> <?php echo $aPointDetails['lat'];?>)');
|
||||||
if (feature) {
|
if (feature) {
|
||||||
map.zoomToExtent(feature.geometry.getBounds());
|
map.zoomToExtent(feature.geometry.getBounds());
|
||||||
|
|
||||||
feature.style = {
|
feature.style = {
|
||||||
strokeColor: "#75ADFF",
|
strokeColor: "#75ADFF",
|
||||||
fillColor: "#F0F7FF",
|
fillColor: "#F0F7FF",
|
||||||
strokeWidth: <?php echo ($aPointDetails['isarea']=='t'?'2':'5');?>,
|
strokeWidth: <?php echo ($aPointDetails['isarea']=='t'?'2':'5');?>,
|
||||||
strokeOpacity: 0.75,
|
strokeOpacity: 0.75,
|
||||||
fillOpacity: 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]);
|
vectorLayer.addFeatures([feature]);
|
||||||
|
<?php } ?>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -84,6 +97,7 @@
|
|||||||
echo ' <div>Rank: <span class="rankaddress">'.$aPointDetails['rank_search_label'].'</span></div>';
|
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>';
|
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>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':'')));
|
$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 ($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'])
|
if ($aPointDetails['wikipedia'])
|
||||||
|
|||||||
@@ -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 = "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 .= " 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_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 .= " 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 .= " 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 .= " from placex where place_id = $iPlaceID";
|
||||||
|
|||||||
Reference in New Issue
Block a user