3namespace Bitrix\Location\Source\Osm;
5use Bitrix\Location\Entity\Location;
6use Bitrix\Location\Geometry\Converter\Manager;
7use Bitrix\Location\Geometry\Type\Point;
8use Bitrix\Location\Infrastructure\Service\CustomFieldsService;
9use Bitrix\Location\Repository\Location\Capability\IFindByCoords;
10use Bitrix\Location\Repository\Location\Capability\IFindByExternalId;
11use Bitrix\Location\Repository\Location\Capability\ISupportAutocomplete;
12use Bitrix\Location\Repository\Location\IRepository;
13use Bitrix\Location\Repository\Location\ISource;
14use Bitrix\Location\Source\BaseRepository;
15use Bitrix\Location\Source\Osm\Api\Api;
16use Bitrix\Location\Source\Osm\Converters\Factory;
58 if (
$sourceCode !== self::$sourceCode || is_null($osmType) || is_null($osmId))
63 $details = $this->api->details(
65 'osm_type' => $osmType,
67 'addressdetails' => 1,
68 'accept-language' => $this->osmSource->convertLang($languageId),
72 $location = Factory::make($details)->convert(
78 && isset($details[
'centroid'])
81 $centroid = Manager::makeConverter(Manager::FORMAT_ARRAY)->read($details[
'centroid']);
83 if ($centroid instanceof
Point)
86 if ($customFieldsScenario)
88 $customFieldsScenario->adjustLocation(
$location);
103 $reverse = $this->api->reverse(
108 'addressdetails' => 0,
109 'accept-language' => $this->osmSource->convertLang($languageId),
115 isset($reverse[
'osm_type'])
116 && isset($reverse[
'osm_id'])
145 $result = $this->api->autocomplete([
147 'lang' => $this->osmSource->convertLang(
$params[
'lang']),
148 'lat' =>
$params[
'lat'] ??
null,
149 'lon' =>
$params[
'lon'] ??
null,
155 && is_array(
$result[
'features'])
160 if (!isset($feature[
'geometry']))
165 $geometry = Manager::makeConverter(Manager::FORMAT_ARRAY)->read($feature[
'geometry']);
166 if (!$geometry instanceof
Point)
172 if (!$customFieldsScenario)
176 $customFieldsScenario->adjustAutocompleteItem(
$result[
'features'][
$key][
'properties']);
188 return self::$sourceCode;
static buildExternalId(string $osmType, int $osmId)
static getOsmIdByExternalId(string $externalId)
static getOsmTypeByExternalId(string $externalId)
static getShortNodeTypeCode(string $longNodeTypeCode)
findByCoords(float $lat, float $lng, int $zoom, string $languageId)
findByExternalId(string $externalId, string $sourceCode, string $languageId)
__construct(Api $api, OsmSource $osmSource)
autocomplete(array $params)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(empty($signedUserToken)) $key
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']