Changement pour la carte google
This commit is contained in:
parent
9b6faac530
commit
3dea181b3f
@ -438,7 +438,7 @@ class IdentiteController extends Zend_Controller_Action
|
||||
$ws = new WsScores();
|
||||
$infos = $ws->getEtablissementsGeo($siren, $actif, $position, $nbAffichage);
|
||||
Zend_Registry::get('firebug')->info($infos);
|
||||
if ($infos === false) $this->_forward('soap', 'error');
|
||||
if ($infos === false) $this->forward('soap', 'error');
|
||||
|
||||
$etabs = $infos->result->item;
|
||||
|
||||
@ -506,6 +506,7 @@ class IdentiteController extends Zend_Controller_Action
|
||||
}
|
||||
Zend_Registry::get('firebug')->info($marks);
|
||||
}
|
||||
$this->view->source = 'google';
|
||||
$this->view->assign('marks', json_encode($marks));
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
<div id="carte" style="width:100%;height:500px">Préparation de la carte ...</div>
|
||||
|
||||
<?php if ($this->source == 'google') {?>
|
||||
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
||||
<script type="text/javascript">
|
||||
<?php echo 'var marks = '.$this->marks.';'?>
|
||||
@ -40,42 +42,6 @@ function createMarker(m) {
|
||||
});
|
||||
// --- Extend map by adding marker
|
||||
zoneMarker.extend(marker.getPosition());
|
||||
|
||||
// --- Geocode
|
||||
if (m.gps.lat && m.gps.lon) {
|
||||
// --- Do nothing
|
||||
} else {
|
||||
var locations = [];
|
||||
locations.push(m.location);
|
||||
// --- Create an ElevationService
|
||||
var elevator = new google.maps.ElevationService();
|
||||
// Create a LocationElevationRequest object using the array's one value
|
||||
var positionalRequest = {
|
||||
'locations': locations
|
||||
}
|
||||
// Initiate the location request
|
||||
elevator.getElevationForLocations(positionalRequest, function(results, status) {
|
||||
if (status == google.maps.ElevationStatus.OK) {
|
||||
if (results[0]) {
|
||||
var alt = results[0].elevation;
|
||||
if (results[0].elevation<-500) {
|
||||
alt = 0;
|
||||
}
|
||||
if (results[0].resolution>500) {
|
||||
alt = 0;
|
||||
}
|
||||
$.post('/saisie/geocode', {
|
||||
siret: m.siret,
|
||||
lat: m.locationLat,
|
||||
lng: m.locationLng,
|
||||
alt: alt,
|
||||
address: m.locationAddress,
|
||||
precis: m.locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --- Load Google Map
|
||||
@ -117,6 +83,41 @@ $(document).ready(function(){
|
||||
marks[i].locationLng = results[0].geometry.location.lng();
|
||||
marks[i].locationType = results[0].geometry.location_type;
|
||||
marks[i].locationAddress = results[0].formatted_address
|
||||
|
||||
// --- Altitude
|
||||
var alt = 0;
|
||||
var locations = [];
|
||||
locations.push(marks[i].location);
|
||||
// --- Create an ElevationService
|
||||
var elevator = new google.maps.ElevationService();
|
||||
// Create a LocationElevationRequest object using the array's one value
|
||||
var positionalRequest = {
|
||||
'locations': locations
|
||||
}
|
||||
// Initiate the location request
|
||||
elevator.getElevationForLocations(positionalRequest, function(results, status) {
|
||||
if (status == google.maps.ElevationStatus.OK) {
|
||||
if (results[0]) {
|
||||
var alt = results[0].elevation;
|
||||
if (results[0].elevation<-500) {
|
||||
alt = 0;
|
||||
}
|
||||
if (results[0].resolution>500) {
|
||||
alt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// --- Send to webservice
|
||||
$.post('/saisie/geocode', {
|
||||
siret: marks[i].siret,
|
||||
lat: marks[i].locationLat,
|
||||
lng: marks[i].locationLng,
|
||||
alt: alt,
|
||||
address: marks[i].locationAddress,
|
||||
precis: marks[i].locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
markDone++;
|
||||
@ -125,4 +126,5 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
<?php }?>
|
Loading…
Reference in New Issue
Block a user