Field | Data type |
ID | int |
Name | varchar (30) |
Address | text |
yandex_lat | varchar (20) |
yandex_lon | varchar (20) |
LAT | varchar (20) |
LON | varchar (20) |
<?php // XML function get_XML($adress){ $xml = simplexml_load_file('https://geocode-maps.yandex.ru/1.x/?geocode='.$adress); return $xml; } // $adr = '. , . , . 52 '; $name_adr = ''; $urlXML = 'https://geocode-maps.yandex.ru/1.x/?geocode='.$adr; // XML $array = get_XML($adr); // $pos = $array->GeoObjectCollection->featureMember['0']->GeoObject->Point->pos; echo "<b>pos</b>: $pos \n"; // , $upperCorner = $array->GeoObjectCollection->featureMember['0']->GeoObject->boundedBy->Envelope->upperCorner; echo "<b>upperCorner</b>: $upperCorner \n"; // , $lowerCorner = $array->GeoObjectCollection->featureMember['0']->GeoObject->boundedBy->Envelope->lowerCorner; echo "<b>lowerCorner</b>: $lowerCorner \n"; // explode $posArr = explode(" ",$pos); $posLeft = explode(".",$posArr[0]); $posRight = explode(".",$posArr[1]); $upperCornerArr = explode(" ",$upperCorner); $upperCornerLeft = explode(".",$upperCornerArr[0]); $upperCornerRight = explode(".",$upperCornerArr[1]); $lowerCornerArr = explode(" ",$lowerCorner); $lowerCornerLeft = explode(".",$lowerCornerArr[0]); $lowerCornerRight = explode(".",$lowerCornerArr[1]); $urlMap = "https://maps.yandex.ru/?text=".$posRight[0].'.'.$posRight[1].$upperCornerRight[0].$upperCornerRight[1].' '.$posLeft[0].'.'.$posLeft[1].$upperCornerLeft[0].$upperCornerLeft[1]; /* LAT - RIGHT LON - LEFT */ $yandex_lat = $posRight[0].'.'.$posRight[1].$upperCornerRight[0].$upperCornerRight[1]; $yandex_lon = $posLeft[0].'.'.$posLeft[1].$upperCornerLeft[0].$upperCornerLeft[1]; $LON = $posLeft[0].'.'.$posLeft[1].$lowerCornerLeft[0].$lowerCornerLeft[1]; $LAT = $posRight[0].'.'.$posRight[1].$lowerCornerRight[0].$lowerCornerRight[1]; $TEXT = $name_adr; ?>
<script type="text/javascript"> function slideTopic(comments,titleTopic) { $(comments).slideToggle(250); if ($(titleTopic).attr('title')==' ') $(titleTopic).attr('title',' '); else $(titleTopic).attr('title',' '); }; </script>
Source: https://habr.com/ru/post/275021/
All Articles