FIX поиск по координатам
This commit is contained in:
parent
98ccd3c334
commit
3f236c837c
|
|
@ -476,6 +476,14 @@ class JsonController extends Controller
|
||||||
if (!empty($out)) {
|
if (!empty($out)) {
|
||||||
$obj = simplexml_load_string($out);
|
$obj = simplexml_load_string($out);
|
||||||
|
|
||||||
|
if (isset($obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->Point)) {
|
||||||
|
$coords = explode(' ', (string) $obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->Point->pos);
|
||||||
|
$lat = $coords[1];
|
||||||
|
$lng = $coords[0];
|
||||||
|
$name = "Координаты N°" . $lat . ' E°' . $lng;
|
||||||
|
$results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true");
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->found)) {
|
if (isset($obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->found)) {
|
||||||
$count = (int) $obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->found;
|
$count = (int) $obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->found;
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
|
|
@ -486,12 +494,6 @@ class JsonController extends Controller
|
||||||
$lng = $coords[0];
|
$lng = $coords[0];
|
||||||
$results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true");
|
$results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true");
|
||||||
}
|
}
|
||||||
} else if (isset($obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->Point)) {
|
|
||||||
$coords = explode(' ', (string) $obj->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->Point->pos);
|
|
||||||
$lat = $coords[1];
|
|
||||||
$lng = $coords[0];
|
|
||||||
$name = "Координаты N°" . $lat . ' E°' . $lng;
|
|
||||||
$results[] = array('value' => $name, 'data' => "/?lat=$lat&lng=$lng&zoom=13&marker=true");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,9 @@ function suggestKeyPress(key)
|
||||||
if ( $('div.hover','#suggestContainer').length > 0 ) {
|
if ( $('div.hover','#suggestContainer').length > 0 ) {
|
||||||
link = $('a', $('div.hover','#suggestContainer')).attr('href');
|
link = $('a', $('div.hover','#suggestContainer')).attr('href');
|
||||||
window.location.href = link;
|
window.location.href = link;
|
||||||
|
} else if ( $('div','#suggestContainer').length > 0 ) {
|
||||||
|
link = $('a', $('div','#suggestContainer')).attr('href');
|
||||||
|
window.location.href = link;
|
||||||
} else {
|
} else {
|
||||||
searchAdderess();
|
searchAdderess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue