<?php

namespace App\Console\Commands;

use SoapFault;
use SoapClient;
use Illuminate\Console\Command;
use Carbon\Carbon;
use Hekmatinasser\Verta\Verta;
use App\Models\RoadObserved;
use App\Models\EdarateShahri;
use App\Models\Province;
use App\Models\City;

class RoadObservationProblems extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'webservice:roadobserved';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'get road observed problems from 141 (samaneh sawaneh)';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $url = "https://riws.rmto.ir/WebServices/NRPTrafficStatus.asmx?wsdl";
        try {
            $soap_client = new SoapClient($url);
            $result = $soap_client->Get_RoadObservedProblems_Current(array('strUserName' => 'vaytelrop', 'strPassword' => 'VaYtelROP*2024'));
        } catch (SoapFault $e) {
            echo $e->getMessage();
            $msg = 'rms: error in get road observation webservice babe!!!!'."\n";
            $msg .= $e->getMessage();
            // self::sms_sender('09398586633', $msg);
            // self::sms_sender('09367487107', $msg);
            return 0;
        }
        $result = serialize($result);
        // return $result;
        $x = strpos($result, '<Document');
        $y = strpos($result, '</Document');
        $q = intval($y) - intval($x) + 18;
        if ($x  !== false and $y !== false) {
            $final_data = substr($result, $x, $q);
            $xml = simplexml_load_string($final_data);

            $rmsProvinceId = [
                "26" => 1,
                "57" => 2,
                "91" => 3,
                "21" =>4,
                "18" => 5,
                //"83" => 6,
                "83" =>7,
                "95" => 8,
                "11" => 9,
                "77" => 10,
                "33" => 11,
                "31" => 12,
                "32" => 13,
                "36" => 14,
                "67" => 15,
                //"26" => 16,
                "87" => 17,
                "61" => 18,
                "41" => 19,
                "15" => 20,
                "14" => 21,
                "73" => 22,
                "45" => 23,
                //"26" => 24,
                "71" => 25,
                "85" => 26,
                "97" => 27,
                "54" => 28,
                //"26" => 29,
                "81" => 30,
                "16" => 31,
                "51" => 32,
                "64" => 33,
                "75" => 34,
                "93" => 35,
            ];

            $rmsCityId = [
                1 => [
                   "OnvarID" => 1,
                   "CityName" => "گمیشان",
                   "ProvinceID" => "97",
                   "InvarID" => 353
                ],
                2 => [
                   "OnvarID" => 2,
                   "CityName" => "آق قلا",
                   "ProvinceID" => "97",
                   "InvarID" => 13
                ],
                3 => [
                   "OnvarID" => 3,
                   "CityName" => "رامیان",
                   "ProvinceID" => "97",
                   "InvarID" => 194
                ],
                4 => [
                   "OnvarID" => 4,
                   "CityName" => "آزادشهر",
                   "ProvinceID" => "97",
                   "InvarID" => 8
                ],
                5 => [
                   "OnvarID" => 5,
                   "CityName" => "مینو دشت",
                   "ProvinceID" => "97",
                   "InvarID" => 401
                ],
                6 => [
                   "OnvarID" => 6,
                   "CityName" => "گالیكش",
                   "ProvinceID" => "97",
                   "InvarID" => 343
                ],
                7 => [
                   "OnvarID" => 7,
                   "CityName" => "علی آباد",
                   "ProvinceID" => "97",
                   "InvarID" => 282
                ],
                8 => [
                   "OnvarID" => 8,
                   "CityName" => "گرگان",
                   "ProvinceID" => "97",
                   "InvarID" => 347
                ],
                9 => [
                   "OnvarID" => 9,
                   "CityName" => "كردكوی",
                   "ProvinceID" => "97",
                   "InvarID" => 324
                ],
                10 => [
                   "OnvarID" => 10,
                   "CityName" => "بندرگز",
                   "ProvinceID" => "97",
                   "InvarID" => 80
                ],
                11 => [
                   "OnvarID" => 11,
                   "CityName" => "تركمن",
                   "ProvinceID" => "97",
                   "InvarID" => 112
                ],
                12 => [
                   "OnvarID" => 12,
                   "CityName" => "گنبدكاووس",
                   "ProvinceID" => "97",
                   "InvarID" => 356
                ],
                13 => [
                   "OnvarID" => 13,
                   "CityName" => "كلاله",
                   "ProvinceID" => "97",
                   "InvarID" => 329
                ],
                14 => [
                   "OnvarID" => 14,
                   "CityName" => "مراوه تپه",
                   "ProvinceID" => "97",
                   "InvarID" => 374
                ],
                15 => [
                   "OnvarID" => 15,
                   "CityName" => "آستارا",
                   "ProvinceID" => "54",
                   "InvarID" => 9
                ],
                16 => [
                   "OnvarID" => 16,
                   "CityName" => "طوالش",
                   "ProvinceID" => "54",
                   "InvarID" => 278
                ],
                17 => [
                   "OnvarID" => 17,
                   "CityName" => "رضوانشهر",
                   "ProvinceID" => "54",
                   "InvarID" => 201
                ],
                18 => [
                   "OnvarID" => 18,
                   "CityName" => "ماسال",
                   "ProvinceID" => "54",
                   "InvarID" => 366
                ],
                19 => [
                   "OnvarID" => 19,
                   "CityName" => "بندر انزلی",
                   "ProvinceID" => "54",
                   "InvarID" => 76
                ],
                20 => [
                   "OnvarID" => 20,
                   "CityName" => "صومعه سرا",
                   "ProvinceID" => "54",
                   "InvarID" => 274
                ],
                21 => [
                   "OnvarID" => 21,
                   "CityName" => "فومن",
                   "ProvinceID" => "54",
                   "InvarID" => 300
                ],
                22 => [
                   "OnvarID" => 22,
                   "CityName" => "شفت",
                   "ProvinceID" => "54",
                   "InvarID" => 260
                ],
                23 => [
                   "OnvarID" => 23,
                   "CityName" => "املش",
                   "ProvinceID" => "54",
                   "InvarID" => 40
                ],
                24 => [
                   "OnvarID" => 24,
                   "CityName" => "رودسر",
                   "ProvinceID" => "54",
                   "InvarID" => 207
                ],
                25 => [
                   "OnvarID" => 25,
                   "CityName" => "آستانه اشرفیه",
                   "ProvinceID" => "54",
                   "InvarID" => 10
                ],
                26 => [
                   "OnvarID" => 26,
                   "CityName" => "لاهیجان",
                   "ProvinceID" => "54",
                   "InvarID" => 361
                ],
                27 => [
                   "OnvarID" => 27,
                   "CityName" => "رشت",
                   "ProvinceID" => "54",
                   "InvarID" => 199
                ],
                28 => [
                   "OnvarID" => 28,
                   "CityName" => "سیاهكل",
                   "ProvinceID" => "54",
                   "InvarID" => 248
                ],
                29 => [
                   "OnvarID" => 29,
                   "CityName" => "لنگرود",
                   "ProvinceID" => "54",
                   "InvarID" => 365
                ],
                30 => [
                   "OnvarID" => 30,
                   "CityName" => "رودبار",
                   "ProvinceID" => "54",
                   "InvarID" => 205
                ],
                31 => [
                   "OnvarID" => 31,
                   "CityName" => "آباده",
                   "ProvinceID" => "41",
                   "InvarID" => 2
                ],
                32 => [
                   "OnvarID" => 32,
                   "CityName" => "ممسنی",
                   "ProvinceID" => "41",
                   "InvarID" => 385
                ],
                33 => [
                   "OnvarID" => 33,
                   "CityName" => "سپیدان",
                   "ProvinceID" => "41",
                   "InvarID" => 225
                ],
                34 => [
                   "OnvarID" => 34,
                   "CityName" => "رستم",
                   "ProvinceID" => "41",
                   "InvarID" => 198
                ],
                35 => [
                   "OnvarID" => 35,
                   "CityName" => "پاسارگاد",
                   "ProvinceID" => "41",
                   "InvarID" => 99
                ],
                36 => [
                   "OnvarID" => 36,
                   "CityName" => "بوانات",
                   "ProvinceID" => "41",
                   "InvarID" => 89
                ],
                37 => [
                   "OnvarID" => 37,
                   "CityName" => "خرم بید",
                   "ProvinceID" => "41",
                   "InvarID" => 149
                ],
                38 => [
                   "OnvarID" => 38,
                   "CityName" => "اقلید",
                   "ProvinceID" => "41",
                   "InvarID" => 37
                ],
                39 => [
                   "OnvarID" => 39,
                   "CityName" => "كازرون",
                   "ProvinceID" => "41",
                   "InvarID" => 318
                ],
                40 => [
                   "OnvarID" => 40,
                   "CityName" => "سروستان",
                   "ProvinceID" => "41",
                   "InvarID" => 237
                ],
                41 => [
                   "OnvarID" => 41,
                   "CityName" => "كوار",
                   "ProvinceID" => "41",
                   "InvarID" => 337
                ],
                42 => [
                   "OnvarID" => 42,
                   "CityName" => "خرامه",
                   "ProvinceID" => "41",
                   "InvarID" => 147
                ],
                43 => [
                   "OnvarID" => 43,
                   "CityName" => "شیراز",
                   "ProvinceID" => "41",
                   "InvarID" => 270
                ],
                44 => [
                   "OnvarID" => 44,
                   "CityName" => "مرودشت",
                   "ProvinceID" => "41",
                   "InvarID" => 376
                ],
                45 => [
                   "OnvarID" => 45,
                   "CityName" => "ارسنجان",
                   "ProvinceID" => "41",
                   "InvarID" => 25
                ],
                46 => [
                   "OnvarID" => 46,
                   "CityName" => "نی ریز",
                   "ProvinceID" => "41",
                   "InvarID" => 414
                ],
                47 => [
                   "OnvarID" => 47,
                   "CityName" => "فراشبند",
                   "ProvinceID" => "41",
                   "InvarID" => 288
                ],
                48 => [
                   "OnvarID" => 48,
                   "CityName" => "جهرم",
                   "ProvinceID" => "41",
                   "InvarID" => 127
                ],
                49 => [
                   "OnvarID" => 49,
                   "CityName" => "قیر و كارزین",
                   "ProvinceID" => "41",
                   "InvarID" => 316
                ],
                50 => [
                   "OnvarID" => 50,
                   "CityName" => "فیروز آباد",
                   "ProvinceID" => "41",
                   "InvarID" => 301
                ],
                51 => [
                   "OnvarID" => 51,
                   "CityName" => "داراب",
                   "ProvinceID" => "41",
                   "InvarID" => 165
                ],
                52 => [
                   "OnvarID" => 52,
                   "CityName" => "زرین دشت",
                   "ProvinceID" => "41",
                   "InvarID" => 216
                ],
                53 => [
                   "OnvarID" => 53,
                   "CityName" => "مهر",
                   "ProvinceID" => "41",
                   "InvarID" => 3
                ],
                54 => [
                   "OnvarID" => 54,
                   "CityName" => "خنج",
                   "ProvinceID" => "41",
                   "InvarID" => 390
                ],
                55 => [
                   "OnvarID" => 55,
                   "CityName" => "لامرد",
                   "ProvinceID" => "41",
                   "InvarID" => 360
                ],
                56 => [
                   "OnvarID" => 56,
                   "CityName" => "گراش",
                   "ProvinceID" => "41",
                   "InvarID" => 346
                ],
                57 => [
                   "OnvarID" => 57,
                   "CityName" => "لارستان",
                   "ProvinceID" => "41",
                   "InvarID" => 358
                ],
                58 => [
                   "OnvarID" => 58,
                   "CityName" => "فسا",
                   "ProvinceID" => "41",
                   "InvarID" => 296
                ],
                59 => [
                   "OnvarID" => 59,
                   "CityName" => "استهبان",
                   "ProvinceID" => "41",
                   "InvarID" => 28
                ],
                60 => [
                   "OnvarID" => 60,
                   "CityName" => "آران و بیدگل",
                   "ProvinceID" => "21",
                   "InvarID" => 7
                ],
                61 => [
                   "OnvarID" => 61,
                   "CityName" => "بوئین و میان دشت",
                   "ProvinceID" => "21",
                   "InvarID" => 88
                ],
                62 => [
                   "OnvarID" => 62,
                   "CityName" => "خوانسار",
                   "ProvinceID" => "21",
                   "InvarID" => 160
                ],
                63 => [
                   "OnvarID" => 63,
                   "CityName" => "گلپایگان",
                   "ProvinceID" => "21",
                   "InvarID" => 351
                ],
                64 => [
                   "OnvarID" => 64,
                   "CityName" => "اردستان",
                   "ProvinceID" => "21",
                   "InvarID" => 21
                ],
                65 => [
                   "OnvarID" => 65,
                   "CityName" => "كاشان",
                   "ProvinceID" => "21",
                   "InvarID" => 319
                ],
                66 => [
                   "OnvarID" => 66,
                   "CityName" => "خور و بیابانك",
                   "ProvinceID" => "21",
                   "InvarID" => 161
                ],
                67 => [
                   "OnvarID" => 67,
                   "CityName" => "چادگان",
                   "ProvinceID" => "21",
                   "InvarID" => 133
                ],
                68 => [
                   "OnvarID" => 68,
                   "CityName" => "فریدن",
                   "ProvinceID" => "21",
                   "InvarID" => 292
                ],
                69 => [
                   "OnvarID" => 69,
                   "CityName" => "فریدون شهر",
                   "ProvinceID" => "21",
                   "InvarID" => 293
                ],
                70 => [
                   "OnvarID" => 70,
                   "CityName" => "شهرضا",
                   "ProvinceID" => "21",
                   "InvarID" => 263
                ],
                71 => [
                   "OnvarID" => 71,
                   "CityName" => "مباركه",
                   "ProvinceID" => "21",
                   "InvarID" => 370
                ],
                72 => [
                   "OnvarID" => 72,
                   "CityName" => "لنجان",
                   "ProvinceID" => "21",
                   "InvarID" => 363
                ],
                73 => [
                   "OnvarID" => 73,
                   "CityName" => "اصفهان",
                   "ProvinceID" => "21",
                   "InvarID" => 36
                ],
                74 => [
                   "OnvarID" => 74,
                   "CityName" => "فلاورجان",
                   "ProvinceID" => "21",
                   "InvarID" => 297
                ],
                75 => [
                   "OnvarID" => 75,
                   "CityName" => "نجف آباد",
                   "ProvinceID" => "21",
                   "InvarID" => 403
                ],
                76 => [
                   "OnvarID" => 76,
                   "CityName" => "خمینی شهر",
                   "ProvinceID" => "21",
                   "InvarID" => 156
                ],
                77 => [
                   "OnvarID" => 77,
                   "CityName" => "تیران و كرون",
                   "ProvinceID" => "21",
                   "InvarID" => 120
                ],
                78 => [
                   "OnvarID" => 78,
                   "CityName" => "برخوار",
                   "ProvinceID" => "21",
                   "InvarID" => 64
                ],
                79 => [
                   "OnvarID" => 79,
                   "CityName" => "نائین",
                   "ProvinceID" => "21",
                   "InvarID" => 402
                ],
                80 => [
                   "OnvarID" => 80,
                   "CityName" => "سمیرم",
                   "ProvinceID" => "21",
                   "InvarID" => 243
                ],
                81 => [
                   "OnvarID" => 81,
                   "CityName" => "دهاقان",
                   "ProvinceID" => "21",
                   "InvarID" => 181
                ],
                82 => [
                   "OnvarID" => 82,
                   "CityName" => "نطنز",
                   "ProvinceID" => "21",
                   "InvarID" => 405
                ],
                83 => [
                   "OnvarID" => 83,
                   "CityName" => "شاهین شهر و میمه",
                   "ProvinceID" => "21",
                   "InvarID" => 258
                ],
                84 => [
                   "OnvarID" => 84,
                   "CityName" => "مراغه",
                   "ProvinceID" => "26",
                   "InvarID" => 373
                ],
                85 => [
                   "OnvarID" => 85,
                   "CityName" => "خدا آفرین",
                   "ProvinceID" => "26",
                   "InvarID" => 145
                ],
                86 => [
                   "OnvarID" => 86,
                   "CityName" => "جلفا",
                   "ProvinceID" => "26",
                   "InvarID" => 125
                ],
                87 => [
                   "OnvarID" => 87,
                   "CityName" => "شبستر",
                   "ProvinceID" => "26",
                   "InvarID" => 259
                ],
                88 => [
                   "OnvarID" => 88,
                   "CityName" => "مرند",
                   "ProvinceID" => "26",
                   "InvarID" => 375
                ],
                89 => [
                   "OnvarID" => 89,
                   "CityName" => "تبریز",
                   "ProvinceID" => "26",
                   "InvarID" => 109
                ],
                90 => [
                   "OnvarID" => 90,
                   "CityName" => "ورزقان",
                   "ProvinceID" => "26",
                   "InvarID" => 429
                ],
                91 => [
                   "OnvarID" => 91,
                   "CityName" => "اهر",
                   "ProvinceID" => "26",
                   "InvarID" => 45
                ],
                92 => [
                   "OnvarID" => 92,
                   "CityName" => "كلیبر",
                   "ProvinceID" => "26",
                   "InvarID" => 330
                ],
                93 => [
                   "OnvarID" => 93,
                   "CityName" => "اسكو",
                   "ProvinceID" => "26",
                   "InvarID" => 31
                ],
                94 => [
                   "OnvarID" => 94,
                   "CityName" => "آذرشهر",
                   "ProvinceID" => "26",
                   "InvarID" => 5
                ],
                95 => [
                   "OnvarID" => 95,
                   "CityName" => "عجب شیر",
                   "ProvinceID" => "26",
                   "InvarID" => 280
                ],
                96 => [
                   "OnvarID" => 96,
                   "CityName" => "بناب",
                   "ProvinceID" => "26",
                   "InvarID" => 75
                ],
                97 => [
                   "OnvarID" => 97,
                   "CityName" => "ملكان",
                   "ProvinceID" => "26",
                   "InvarID" => 383
                ],
                98 => [
                   "OnvarID" => 98,
                   "CityName" => "بستان آباد",
                   "ProvinceID" => "26",
                   "InvarID" => 69
                ],
                99 => [
                   "OnvarID" => 99,
                   "CityName" => "سراب",
                   "ProvinceID" => "26",
                   "InvarID" => 226
                ],
                100 => [
                   "OnvarID" => 100,
                   "CityName" => "هشترود",
                   "ProvinceID" => "26",
                   "InvarID" => 422
                ],
                101 => [
                   "OnvarID" => 101,
                   "CityName" => "میانه",
                   "ProvinceID" => "26",
                   "InvarID" => 397
                ],
                102 => [
                   "OnvarID" => 102,
                   "CityName" => "چاراویماق",
                   "ProvinceID" => "26",
                   "InvarID" => 134
                ],
                103 => [
                   "OnvarID" => 103,
                   "CityName" => "هریس",
                   "ProvinceID" => "26",
                   "InvarID" => 421
                ],
                104 => [
                   "OnvarID" => 104,
                   "CityName" => "هوراند",
                   "ProvinceID" => "26",
                   "InvarID" => 109
                ],
                105 => [
                   "OnvarID" => 105,
                   "CityName" => "كیار",
                   "ProvinceID" => "77",
                   "InvarID" => 342
                ],
                106 => [
                   "OnvarID" => 106,
                   "CityName" => "فارسان",
                   "ProvinceID" => "77",
                   "InvarID" => 284
                ],
                107 => [
                   "OnvarID" => 107,
                   "CityName" => "كوهرنگ",
                   "ProvinceID" => "77",
                   "InvarID" => 341
                ],
                108 => [
                   "OnvarID" => 108,
                   "CityName" => "لردگان",
                   "ProvinceID" => "77",
                   "InvarID" => 362
                ],
                109 => [
                   "OnvarID" => 109,
                   "CityName" => "اردل",
                   "ProvinceID" => "77",
                   "InvarID" => 23
                ],
                110 => [
                   "OnvarID" => 110,
                   "CityName" => "بروجن",
                   "ProvinceID" => "77",
                   "InvarID" => 68
                ],
                111 => [
                   "OnvarID" => 111,
                   "CityName" => "سامان",
                   "ProvinceID" => "77",
                   "InvarID" => 221
                ],
                112 => [
                   "OnvarID" => 112,
                   "CityName" => "بن",
                   "ProvinceID" => "77",
                   "InvarID" => 74
                ],
                113 => [
                   "OnvarID" => 113,
                   "CityName" => "شهركرد",
                   "ProvinceID" => "77",
                   "InvarID" => 264
                ],
                114 => [
                   "OnvarID" => 114,
                   "CityName" => "دیلم",
                   "ProvinceID" => "95",
                   "InvarID" => 187
                ],
                115 => [
                   "OnvarID" => 115,
                   "CityName" => "گناوه",
                   "ProvinceID" => "95",
                   "InvarID" => 395
                ],
                116 => [
                   "OnvarID" => 116,
                   "CityName" => "دشتستان",
                   "ProvinceID" => "95",
                   "InvarID" => 174
                ],
                117 => [
                   "OnvarID" => 117,
                   "CityName" => "دشتی",
                   "ProvinceID" => "95",
                   "InvarID" => 175
                ],
                118 => [
                   "OnvarID" => 118,
                   "CityName" => "بوشهر",
                   "ProvinceID" => "95",
                   "InvarID" => 90
                ],
                119 => [
                   "OnvarID" => 119,
                   "CityName" => "تنگستان",
                   "ProvinceID" => "95",
                   "InvarID" => 117
                ],
                120 => [
                   "OnvarID" => 120,
                   "CityName" => "دیر",
                   "ProvinceID" => "95",
                   "InvarID" => 186
                ],
                121 => [
                   "OnvarID" => 121,
                   "CityName" => "جم",
                   "ProvinceID" => "95",
                   "InvarID" => 126
                ],
                122 => [
                   "OnvarID" => 122,
                   "CityName" => "كنگان",
                   "ProvinceID" => "95",
                   "InvarID" => 333
                ],
                123 => [
                   "OnvarID" => 123,
                   "CityName" => "عسلویه",
                   "ProvinceID" => "95",
                   "InvarID" => 281
                ],
                124 => [
                   "OnvarID" => 124,
                   "CityName" => "مهران",
                   "ProvinceID" => "83",
                   "InvarID" => 391
                ],
                125 => [
                   "OnvarID" => 125,
                   "CityName" => "ایلام",
                   "ProvinceID" => "83",
                   "InvarID" => 50
                ],
                126 => [
                   "OnvarID" => 126,
                   "CityName" => "ایوان",
                   "ProvinceID" => "83",
                   "InvarID" => 51
                ],
                127 => [
                   "OnvarID" => 127,
                   "CityName" => "دره شهر",
                   "ProvinceID" => "83",
                   "InvarID" => 171
                ],
                128 => [
                   "OnvarID" => 128,
                   "CityName" => "ملكشاهی",
                   "ProvinceID" => "83",
                   "InvarID" => 384
                ],
                129 => [
                   "OnvarID" => 129,
                   "CityName" => "سیروان",
                   "ProvinceID" => "83",
                   "InvarID" => 251
                ],
                130 => [
                   "OnvarID" => 130,
                   "CityName" => "بدره",
                   "ProvinceID" => "83",
                   "InvarID" => 63
                ],
                131 => [
                   "OnvarID" => 131,
                   "CityName" => "چرداول",
                   "ProvinceID" => "71",
                   "InvarID" => 139
                ],
                132 => [
                   "OnvarID" => 132,
                   "CityName" => "دهلران",
                   "ProvinceID" => "83",
                   "InvarID" => 183
                ],
                133 => [
                   "OnvarID" => 133,
                   "CityName" => "آبدانان",
                   "ProvinceID" => "83",
                   "InvarID" => 3
                ],
                134 => [
                   "OnvarID" => 134,
                   "CityName" => "راور",
                   "ProvinceID" => "45",
                   "InvarID" => 195
                ],
                135 => [
                   "OnvarID" => 135,
                   "CityName" => "كوهبنان",
                   "ProvinceID" => "45",
                   "InvarID" => 339
                ],
                136 => [
                   "OnvarID" => 136,
                   "CityName" => "شهر بابك",
                   "ProvinceID" => "45",
                   "InvarID" => 262
                ],
                137 => [
                   "OnvarID" => 137,
                   "CityName" => "انار",
                   "ProvinceID" => "45",
                   "InvarID" => 42
                ],
                138 => [
                   "OnvarID" => 138,
                   "CityName" => "رفسنجان",
                   "ProvinceID" => "45",
                   "InvarID" => 202
                ],
                139 => [
                   "OnvarID" => 139,
                   "CityName" => "زرند",
                   "ProvinceID" => "45",
                   "InvarID" => 214
                ],
                140 => [
                   "OnvarID" => 140,
                   "CityName" => "كرمان",
                   "ProvinceID" => "45",
                   "InvarID" => 325
                ],
                141 => [
                   "OnvarID" => 141,
                   "CityName" => "رابر",
                   "ProvinceID" => "45",
                   "InvarID" => 189
                ],
                142 => [
                   "OnvarID" => 142,
                   "CityName" => "بافت",
                   "ProvinceID" => "45",
                   "InvarID" => 57
                ],
                143 => [
                   "OnvarID" => 143,
                   "CityName" => "سیرجان",
                   "ProvinceID" => "45",
                   "InvarID" => 250
                ],
                144 => [
                   "OnvarID" => 144,
                   "CityName" => "بردسیر",
                   "ProvinceID" => "45",
                   "InvarID" => 66
                ],
                145 => [
                   "OnvarID" => 145,
                   "CityName" => "ارزوئیه",
                   "ProvinceID" => "45",
                   "InvarID" => 24
                ],
                146 => [
                   "OnvarID" => 146,
                   "CityName" => "ریگان",
                   "ProvinceID" => "45",
                   "InvarID" => 210
                ],
                147 => [
                   "OnvarID" => 147,
                   "CityName" => "فهرج",
                   "ProvinceID" => "45",
                   "InvarID" => 299
                ],
                148 => [
                   "OnvarID" => 148,
                   "CityName" => "نرماشیر",
                   "ProvinceID" => "45",
                   "InvarID" => 404
                ],
                149 => [
                   "OnvarID" => 149,
                   "CityName" => "منوجان",
                   "ProvinceID" => "45",
                   "InvarID" => 386
                ],
                150 => [
                   "OnvarID" => 150,
                   "CityName" => "قلعه گنج",
                   "ProvinceID" => "45",
                   "InvarID" => 313
                ],
                151 => [
                   "OnvarID" => 151,
                   "CityName" => "كهنوج",
                   "ProvinceID" => "45",
                   "InvarID" => 336
                ],
                152 => [
                   "OnvarID" => 152,
                   "CityName" => "فاریاب",
                   "ProvinceID" => "45",
                   "InvarID" => 286
                ],
                153 => [
                   "OnvarID" => 153,
                   "CityName" => "رودبار جنوب",
                   "ProvinceID" => "45",
                   "InvarID" => 205
                ],
                154 => [
                   "OnvarID" => 154,
                   "CityName" => "عنبرآباد",
                   "ProvinceID" => "45",
                   "InvarID" => 283
                ],
                155 => [
                   "OnvarID" => 155,
                   "CityName" => "جیرفت",
                   "ProvinceID" => "45",
                   "InvarID" => 131
                ],
                156 => [
                   "OnvarID" => 156,
                   "CityName" => "بم",
                   "ProvinceID" => "45",
                   "InvarID" => 73
                ],
                157 => [
                   "OnvarID" => 157,
                   "CityName" => "گیلانغرب",
                   "ProvinceID" => "71",
                   "InvarID" => 357
                ],
                158 => [
                   "OnvarID" => 158,
                   "CityName" => "دالاهو",
                   "ProvinceID" => "71",
                   "InvarID" => 166
                ],
                159 => [
                   "OnvarID" => 159,
                   "CityName" => "قصر شیرین",
                   "ProvinceID" => "71",
                   "InvarID" => 311
                ],
                160 => [
                   "OnvarID" => 160,
                   "CityName" => "سر پل ذهاب",
                   "ProvinceID" => "71",
                   "InvarID" => 231
                ],
                161 => [
                   "OnvarID" => 161,
                   "CityName" => "ثلاث باباجانی",
                   "ProvinceID" => "71",
                   "InvarID" => 121
                ],
                162 => [
                   "OnvarID" => 162,
                   "CityName" => "جوانرود",
                   "ProvinceID" => "71",
                   "InvarID" => 128
                ],
                163 => [
                   "OnvarID" => 163,
                   "CityName" => "اسلام آباد غرب",
                   "ProvinceID" => "71",
                   "InvarID" => 32
                ],
                164 => [
                   "OnvarID" => 164,
                   "CityName" => "هرسین",
                   "ProvinceID" => "71",
                   "InvarID" => 420
                ],
                165 => [
                   "OnvarID" => 165,
                   "CityName" => "كنگاور",
                   "ProvinceID" => "71",
                   "InvarID" => 334
                ],
                166 => [
                   "OnvarID" => 166,
                   "CityName" => "روانسر",
                   "ProvinceID" => "71",
                   "InvarID" => 203
                ],
                167 => [
                   "OnvarID" => 167,
                   "CityName" => "سنقر",
                   "ProvinceID" => "71",
                   "InvarID" => 244
                ],
                168 => [
                   "OnvarID" => 168,
                   "CityName" => "صحنه",
                   "ProvinceID" => "71",
                   "InvarID" => 272
                ],
                169 => [
                   "OnvarID" => 169,
                   "CityName" => "پاوه",
                   "ProvinceID" => "71",
                   "InvarID" => 101
                ],
                170 => [
                   "OnvarID" => 170,
                   "CityName" => "كرمانشاه",
                   "ProvinceID" => "71",
                   "InvarID" => 326
                ],
                171 => [
                   "OnvarID" => 171,
                   "CityName" => "قوچان",
                   "ProvinceID" => "31",
                   "InvarID" => 315
                ],
                172 => [
                   "OnvarID" => 172,
                   "CityName" => "درگز",
                   "ProvinceID" => "31",
                   "InvarID" => 169
                ],
                173 => [
                   "OnvarID" => 173,
                   "CityName" => "داورزن",
                   "ProvinceID" => "31",
                   "InvarID" => 168
                ],
                174 => [
                   "OnvarID" => 174,
                   "CityName" => "سبزوار",
                   "ProvinceID" => "31",
                   "InvarID" => 224
                ],
                175 => [
                   "OnvarID" => 175,
                   "CityName" => "خوشاب",
                   "ProvinceID" => "31",
                   "InvarID" => 163
                ],
                176 => [
                   "OnvarID" => 176,
                   "CityName" => "جغتای",
                   "ProvinceID" => "31",
                   "InvarID" => 124
                ],
                177 => [
                   "OnvarID" => 177,
                   "CityName" => "جوین",
                   "ProvinceID" => "31",
                   "InvarID" => 130
                ],
                178 => [
                   "OnvarID" => 178,
                   "CityName" => "مشهد",
                   "ProvinceID" => "31",
                   "InvarID" => 380
                ],
                179 => [
                   "OnvarID" => 179,
                   "CityName" => "بینالود",
                   "ProvinceID" => "31",
                   "InvarID" => 96
                ],
                180 => [
                   "OnvarID" => 180,
                   "CityName" => "نیشابور",
                   "ProvinceID" => "31",
                   "InvarID" => 416
                ],
                181 => [
                   "OnvarID" => 181,
                   "CityName" => "فیروزه",
                   "ProvinceID" => "31",
                   "InvarID" => 303
                ],
                182 => [
                   "OnvarID" => 182,
                   "CityName" => "چناران",
                   "ProvinceID" => "31",
                   "InvarID" => 140
                ],
                183 => [
                   "OnvarID" => 183,
                   "CityName" => "كلات",
                   "ProvinceID" => "31",
                   "InvarID" => 327
                ],
                184 => [
                   "OnvarID" => 184,
                   "CityName" => "سرخس",
                   "ProvinceID" => "31",
                   "InvarID" => 232
                ],
                185 => [
                   "OnvarID" => 185,
                   "CityName" => "كاشمر",
                   "ProvinceID" => "31",
                   "InvarID" => 320
                ],
                186 => [
                   "OnvarID" => 186,
                   "CityName" => "خلیل آباد",
                   "ProvinceID" => "31",
                   "InvarID" => 153
                ],
                187 => [
                   "OnvarID" => 187,
                   "CityName" => "مه ولایت",
                   "ProvinceID" => "31",
                   "InvarID" => 387
                ],
                188 => [
                   "OnvarID" => 188,
                   "CityName" => "تربت حیدریه",
                   "ProvinceID" => "31",
                   "InvarID" => 111
                ],
                189 => [
                   "OnvarID" => 189,
                   "CityName" => "زاوه",
                   "ProvinceID" => "31",
                   "InvarID" => 213
                ],
                190 => [
                   "OnvarID" => 190,
                   "CityName" => "فریمان",
                   "ProvinceID" => "31",
                   "InvarID" => 295
                ],
                191 => [
                   "OnvarID" => 191,
                   "CityName" => "تربت جام",
                   "ProvinceID" => "31",
                   "InvarID" => 110
                ],
                192 => [
                   "OnvarID" => 192,
                   "CityName" => "بردسكن",
                   "ProvinceID" => "31",
                   "InvarID" => 65
                ],
                193 => [
                   "OnvarID" => 193,
                   "CityName" => "بجستان",
                   "ProvinceID" => "31",
                   "InvarID" => 61
                ],
                194 => [
                   "OnvarID" => 194,
                   "CityName" => "گناباد",
                   "ProvinceID" => "31",
                   "InvarID" => 354
                ],
                195 => [
                   "OnvarID" => 195,
                   "CityName" => "رشتخوار",
                   "ProvinceID" => "31",
                   "InvarID" => 200
                ],
                196 => [
                   "OnvarID" => 196,
                   "CityName" => "خواف",
                   "ProvinceID" => "31",
                   "InvarID" => 159
                ],
                197 => [
                   "OnvarID" => 197,
                   "CityName" => "تایباد",
                   "ProvinceID" => "31",
                   "InvarID" => 108
                ],
                198 => [
                   "OnvarID" => 198,
                   "CityName" => "باخرز",
                   "ProvinceID" => "31",
                   "InvarID" => 54
                ],
                199 => [
                   "OnvarID" => 199,
                   "CityName" => "فردوس",
                   "ProvinceID" => "33",
                   "InvarID" => 290
                ],
                200 => [
                   "OnvarID" => 200,
                   "CityName" => "طبس",
                   "ProvinceID" => "33",
                   "InvarID" => 277
                ],
                201 => [
                   "OnvarID" => 201,
                   "CityName" => "بشرویه",
                   "ProvinceID" => "33",
                   "InvarID" => 72
                ],
                202 => [
                   "OnvarID" => 202,
                   "CityName" => "سرایان",
                   "ProvinceID" => "33",
                   "InvarID" => 228
                ],
                203 => [
                   "OnvarID" => 203,
                   "CityName" => "قائنات",
                   "ProvinceID" => "33",
                   "InvarID" => 305
                ],
                204 => [
                   "OnvarID" => 204,
                   "CityName" => "زیركوه",
                   "ProvinceID" => "33",
                   "InvarID" => 219
                ],
                205 => [
                   "OnvarID" => 205,
                   "CityName" => "سربیشه",
                   "ProvinceID" => "33",
                   "InvarID" => 230
                ],
                206 => [
                   "OnvarID" => 206,
                   "CityName" => "خوسف",
                   "ProvinceID" => "33",
                   "InvarID" => 162
                ],
                207 => [
                   "OnvarID" => 207,
                   "CityName" => "بیرجند",
                   "ProvinceID" => "33",
                   "InvarID" => 94
                ],
                208 => [
                   "OnvarID" => 208,
                   "CityName" => "درمیان",
                   "ProvinceID" => "33",
                   "InvarID" => 170
                ],
                209 => [
                   "OnvarID" => 209,
                   "CityName" => "نهبندان",
                   "ProvinceID" => "33",
                   "InvarID" => 411
                ],
                210 => [
                   "OnvarID" => 210,
                   "CityName" => "شوشتر",
                   "ProvinceID" => "36",
                   "InvarID" => 268
                ],
                211 => [
                   "OnvarID" => 211,
                   "CityName" => "اندیكا",
                   "ProvinceID" => "36",
                   "InvarID" => 43
                ],
                212 => [
                   "OnvarID" => 212,
                   "CityName" => "لالی",
                   "ProvinceID" => "36",
                   "InvarID" => 359
                ],
                213 => [
                   "OnvarID" => 213,
                   "CityName" => "گتوند",
                   "ProvinceID" => "36",
                   "InvarID" => 344
                ],
                214 => [
                   "OnvarID" => 214,
                   "CityName" => "شوش",
                   "ProvinceID" => "36",
                   "InvarID" => 267
                ],
                215 => [
                   "OnvarID" => 215,
                   "CityName" => "اندیمشك",
                   "ProvinceID" => "36",
                   "InvarID" => 44
                ],
                216 => [
                   "OnvarID" => 216,
                   "CityName" => "دزفول",
                   "ProvinceID" => "36",
                   "InvarID" => 172
                ],
                217 => [
                   "OnvarID" => 217,
                   "CityName" => "كارون",
                   "ProvinceID" => "36",
                   "InvarID" => 317
                ],
                218 => [
                   "OnvarID" => 218,
                   "CityName" => "هویزه",
                   "ProvinceID" => "36",
                   "InvarID" => 426
                ],
                219 => [
                   "OnvarID" => 219,
                   "CityName" => "حمیدیه",
                   "ProvinceID" => "36",
                   "InvarID" => 142
                ],
                220 => [
                   "OnvarID" => 220,
                   "CityName" => "باوی",
                   "ProvinceID" => "36",
                   "InvarID" => 60
                ],
                221 => [
                   "OnvarID" => 221,
                   "CityName" => "دشت آزادگان",
                   "ProvinceID" => "36",
                   "InvarID" => 173
                ],
                222 => [
                   "OnvarID" => 222,
                   "CityName" => "مسجد سلیمان",
                   "ProvinceID" => "36",
                   "InvarID" => 378
                ],
                223 => [
                   "OnvarID" => 223,
                   "CityName" => "هفتگل",
                   "ProvinceID" => "36",
                   "InvarID" => 423
                ],
                224 => [
                   "OnvarID" => 224,
                   "CityName" => "رامهرمز",
                   "ProvinceID" => "36",
                   "InvarID" => 193
                ],
                225 => [
                   "OnvarID" => 225,
                   "CityName" => "باغ ملك",
                   "ProvinceID" => "36",
                   "InvarID" => 56
                ],
                226 => [
                   "OnvarID" => 226,
                   "CityName" => "ایذه",
                   "ProvinceID" => "36",
                   "InvarID" => 48
                ],
                227 => [
                   "OnvarID" => 227,
                   "CityName" => "شادگان",
                   "ProvinceID" => "36",
                   "InvarID" => 254
                ],
                228 => [
                   "OnvarID" => 228,
                   "CityName" => "رامشیر",
                   "ProvinceID" => "36",
                   "InvarID" => 192
                ],
                229 => [
                   "OnvarID" => 229,
                   "CityName" => "هندیجان",
                   "ProvinceID" => "36",
                   "InvarID" => 425
                ],
                230 => [
                   "OnvarID" => 230,
                   "CityName" => "بهبهان",
                   "ProvinceID" => "36",
                   "InvarID" => 84
                ],
                231 => [
                   "OnvarID" => 231,
                   "CityName" => "آغاجاری",
                   "ProvinceID" => "36",
                   "InvarID" => 12
                ],
                232 => [
                   "OnvarID" => 232,
                   "CityName" => "امیدیه",
                   "ProvinceID" => "36",
                   "InvarID" => 41
                ],
                233 => [
                   "OnvarID" => 233,
                   "CityName" => "آبادان",
                   "ProvinceID" => "36",
                   "InvarID" => 1
                ],
                234 => [
                   "OnvarID" => 234,
                   "CityName" => "خرمشهر",
                   "ProvinceID" => "36",
                   "InvarID" => 151
                ],
                235 => [
                   "OnvarID" => 235,
                   "CityName" => "اهواز",
                   "ProvinceID" => "36",
                   "InvarID" => 46
                ],
                236 => [
                   "OnvarID" => 236,
                   "CityName" => "بندر ماهشهر",
                   "ProvinceID" => "36",
                   "InvarID" => 78
                ],
                237 => [
                   "OnvarID" => 237,
                   "CityName" => "گچساران",
                   "ProvinceID" => "85",
                   "InvarID" => 345
                ],
                238 => [
                   "OnvarID" => 238,
                   "CityName" => "بهمئی",
                   "ProvinceID" => "85",
                   "InvarID" => 86
                ],
                239 => [
                   "OnvarID" => 239,
                   "CityName" => "كهگیلویه",
                   "ProvinceID" => "85",
                   "InvarID" => 335
                ],
                240 => [
                   "OnvarID" => 240,
                   "CityName" => "چرام",
                   "ProvinceID" => "85",
                   "InvarID" => 138
                ],
                241 => [
                   "OnvarID" => 241,
                   "CityName" => "لنده",
                   "ProvinceID" => "85",
                   "InvarID" => 364
                ],
                242 => [
                   "OnvarID" => 242,
                   "CityName" => "باشت",
                   "ProvinceID" => "85",
                   "InvarID" => 55
                ],
                243 => [
                   "OnvarID" => 243,
                   "CityName" => "بویراحمد",
                   "ProvinceID" => "85",
                   "InvarID" => 92
                ],
                244 => [
                   "OnvarID" => 244,
                   "CityName" => "دنا",
                   "ProvinceID" => "85",
                   "InvarID" => 180
                ],
                245 => [
                   "OnvarID" => 245,
                   "CityName" => "پارس آباد",
                   "ProvinceID" => "91",
                   "InvarID" => 97
                ],
                246 => [
                   "OnvarID" => 246,
                   "CityName" => "گرمی",
                   "ProvinceID" => "91",
                   "InvarID" => 350
                ],
                247 => [
                   "OnvarID" => 247,
                   "CityName" => "بیله سوار",
                   "ProvinceID" => "91",
                   "InvarID" => 95
                ],
                248 => [
                   "OnvarID" => 248,
                   "CityName" => "مشگین شهر",
                   "ProvinceID" => "91",
                   "InvarID" => 379
                ],
                249 => [
                   "OnvarID" => 249,
                   "CityName" => "نیر",
                   "ProvinceID" => "91",
                   "InvarID" => 415
                ],
                250 => [
                   "OnvarID" => 250,
                   "CityName" => "نمین",
                   "ProvinceID" => "91",
                   "InvarID" => 409
                ],
                251 => [
                   "OnvarID" => 251,
                   "CityName" => "اردبیل",
                   "ProvinceID" => "91",
                   "InvarID" => 20
                ],
                252 => [
                   "OnvarID" => 252,
                   "CityName" => "سرعین",
                   "ProvinceID" => "91",
                   "InvarID" => 235
                ],
                253 => [
                   "OnvarID" => 253,
                   "CityName" => "كوثر",
                   "ProvinceID" => "91",
                   "InvarID" => 338
                ],
                254 => [
                   "OnvarID" => 254,
                   "CityName" => "خلخال",
                   "ProvinceID" => "91",
                   "InvarID" => 152
                ],
                255 => [
                   "OnvarID" => 255,
                   "CityName" => "حاجی آباد",
                   "ProvinceID" => "64",
                   "InvarID" => 141
                ],
                256 => [
                   "OnvarID" => 256,
                   "CityName" => "پارسیان",
                   "ProvinceID" => "64",
                   "InvarID" => 98
                ],
                257 => [
                   "OnvarID" => 257,
                   "CityName" => "بستك",
                   "ProvinceID" => "64",
                   "InvarID" => 70
                ],
                258 => [
                   "OnvarID" => 258,
                   "CityName" => "بندر عباس",
                   "ProvinceID" => "64",
                   "InvarID" => 79
                ],
                259 => [
                   "OnvarID" => 259,
                   "CityName" => "میناب",
                   "ProvinceID" => "64",
                   "InvarID" => 400
                ],
                260 => [
                   "OnvarID" => 260,
                   "CityName" => "رودان",
                   "ProvinceID" => "64",
                   "InvarID" => 204
                ],
                261 => [
                   "OnvarID" => 261,
                   "CityName" => "بندر لنگه",
                   "ProvinceID" => "64",
                   "InvarID" => 77
                ],
                262 => [
                   "OnvarID" => 262,
                   "CityName" => "خمیر",
                   "ProvinceID" => "64",
                   "InvarID" => 154
                ],
                263 => [
                   "OnvarID" => 263,
                   "CityName" => "بشاگرد",
                   "ProvinceID" => "64",
                   "InvarID" => 71
                ],
                264 => [
                   "OnvarID" => 264,
                   "CityName" => "سیریك",
                   "ProvinceID" => "64",
                   "InvarID" => 252
                ],
                265 => [
                   "OnvarID" => 265,
                   "CityName" => "جاسك",
                   "ProvinceID" => "64",
                   "InvarID" => 123
                ],
                266 => [
                   "OnvarID" => 266,
                   "CityName" => "ابوموسی",
                   "ProvinceID" => "NULL",
                   "InvarID" => 18
                ],
                267 => [
                   "OnvarID" => 267,
                   "CityName" => "قشم",
                   "ProvinceID" => "64",
                   "InvarID" => 310
                ],
                268 => [
                   "OnvarID" => 268,
                   "CityName" => "طالقان",
                   "ProvinceID" => "18",
                   "InvarID" => 276
                ],
                269 => [
                   "OnvarID" => 269,
                   "CityName" => "اشتهارد",
                   "ProvinceID" => "18",
                   "InvarID" => 34
                ],
                270 => [
                   "OnvarID" => 270,
                   "CityName" => "كرج",
                   "ProvinceID" => "18",
                   "InvarID" => 323
                ],
                271 => [
                   "OnvarID" => 271,
                   "CityName" => "فردیس",
                   "ProvinceID" => "18",
                   "InvarID" => 291
                ],
                272 => [
                   "OnvarID" => 272,
                   "CityName" => "ساوجبلاغ",
                   "ProvinceID" => "18",
                   "InvarID" => 222
                ],
                273 => [
                   "OnvarID" => 273,
                   "CityName" => "نظر آباد",
                   "ProvinceID" => "18",
                   "InvarID" => 406
                ],
                274 => [
                   "OnvarID" => 274,
                   "CityName" => "فامنین",
                   "ProvinceID" => "75",
                   "InvarID" => 287
                ],
                275 => [
                   "OnvarID" => 275,
                   "CityName" => "كبودرآهنگ",
                   "ProvinceID" => "75",
                   "InvarID" => 322
                ],
                276 => [
                   "OnvarID" => 276,
                   "CityName" => "رزن",
                   "ProvinceID" => "75",
                   "InvarID" => 197
                ],
                277 => [
                   "OnvarID" => 277,
                   "CityName" => "ملایر",
                   "ProvinceID" => "75",
                   "InvarID" => 382
                ],
                278 => [
                   "OnvarID" => 278,
                   "CityName" => "نهاوند",
                   "ProvinceID" => "75",
                   "InvarID" => 410
                ],
                279 => [
                   "OnvarID" => 279,
                   "CityName" => "تویسركان",
                   "ProvinceID" => "75",
                   "InvarID" => 119
                ],
                280 => [
                   "OnvarID" => 280,
                   "CityName" => "اسد آباد",
                   "ProvinceID" => "75",
                   "InvarID" => 29
                ],
                281 => [
                   "OnvarID" => 281,
                   "CityName" => "همدان",
                   "ProvinceID" => "75",
                   "InvarID" => 424
                ],
                282 => [
                   "OnvarID" => 282,
                   "CityName" => "بهار",
                   "ProvinceID" => "75",
                   "InvarID" => 82
                ],
                283 => [
                   "OnvarID" => 283,
                   "CityName" => "سقز",
                   "ProvinceID" => "73",
                   "InvarID" => 238
                ],
                284 => [
                   "OnvarID" => 284,
                   "CityName" => "سرو آباد",
                   "ProvinceID" => "73",
                   "InvarID" => 236
                ],
                285 => [
                   "OnvarID" => 285,
                   "CityName" => "مریوان",
                   "ProvinceID" => "73",
                   "InvarID" => 377
                ],
                286 => [
                   "OnvarID" => 286,
                   "CityName" => "بانه",
                   "ProvinceID" => "73",
                   "InvarID" => 59
                ],
                287 => [
                   "OnvarID" => 287,
                   "CityName" => "قروه",
                   "ProvinceID" => "73",
                   "InvarID" => 308
                ],
                288 => [
                   "OnvarID" => 288,
                   "CityName" => "دهگلان",
                   "ProvinceID" => "73",
                   "InvarID" => 182
                ],
                289 => [
                   "OnvarID" => 289,
                   "CityName" => "سنندج",
                   "ProvinceID" => "73",
                   "InvarID" => 245
                ],
                290 => [
                   "OnvarID" => 290,
                   "CityName" => "بیجار",
                   "ProvinceID" => "73",
                   "InvarID" => 93
                ],
                291 => [
                   "OnvarID" => 291,
                   "CityName" => "دیواندره",
                   "ProvinceID" => "73",
                   "InvarID" => 188
                ],
                292 => [
                   "OnvarID" => 292,
                   "CityName" => "كامیاران",
                   "ProvinceID" => "73",
                   "InvarID" => 321
                ],
                293 => [
                   "OnvarID" => 293,
                   "CityName" => "دلفان",
                   "ProvinceID" => "81",
                   "InvarID" => 176
                ],
                294 => [
                   "OnvarID" => 294,
                   "CityName" => "پل دختر",
                   "ProvinceID" => "81",
                   "InvarID" => 103
                ],
                295 => [
                   "OnvarID" => 295,
                   "CityName" => "رومشكان",
                   "ProvinceID" => "81",
                   "InvarID" => 208
                ],
                296 => [
                   "OnvarID" => 296,
                   "CityName" => "كوه دشت",
                   "ProvinceID" => "81",
                   "InvarID" => 340
                ],
                297 => [
                   "OnvarID" => 297,
                   "CityName" => "دوره",
                   "ProvinceID" => "81",
                   "InvarID" => 184
                ],
                298 => [
                   "OnvarID" => 298,
                   "CityName" => "خرم آباد",
                   "ProvinceID" => "81",
                   "InvarID" => 148
                ],
                299 => [
                   "OnvarID" => 299,
                   "CityName" => "دورود",
                   "ProvinceID" => "81",
                   "InvarID" => 185
                ],
                300 => [
                   "OnvarID" => 300,
                   "CityName" => "ازنا",
                   "ProvinceID" => "81",
                   "InvarID" => 27
                ],
                301 => [
                   "OnvarID" => 301,
                   "CityName" => "سلسله",
                   "ProvinceID" => "81",
                   "InvarID" => 239
                ],
                302 => [
                   "OnvarID" => 302,
                   "CityName" => "بروجرد",
                   "ProvinceID" => "81",
                   "InvarID" => 67
                ],
                303 => [
                   "OnvarID" => 303,
                   "CityName" => "الیگودرز",
                   "ProvinceID" => "81",
                   "InvarID" => 39
                ],
                304 => [
                   "OnvarID" => 304,
                   "CityName" => "ساوه",
                   "ProvinceID" => "51",
                   "InvarID" => 223
                ],
                305 => [
                   "OnvarID" => 305,
                   "CityName" => "زرندیه",
                   "ProvinceID" => "51",
                   "InvarID" => 215
                ],
                306 => [
                   "OnvarID" => 306,
                   "CityName" => "خنداب",
                   "ProvinceID" => "51",
                   "InvarID" => 158
                ],
                307 => [
                   "OnvarID" => 307,
                   "CityName" => "كمیجان",
                   "ProvinceID" => "51",
                   "InvarID" => 331
                ],
                308 => [
                   "OnvarID" => 308,
                   "CityName" => "اراك",
                   "ProvinceID" => "51",
                   "InvarID" => 19
                ],
                309 => [
                   "OnvarID" => 309,
                   "CityName" => "فراهان",
                   "ProvinceID" => "51",
                   "InvarID" => 289
                ],
                310 => [
                   "OnvarID" => 310,
                   "CityName" => "آشتیان",
                   "ProvinceID" => "51",
                   "InvarID" => 11
                ],
                311 => [
                   "OnvarID" => 311,
                   "CityName" => "تفرش",
                   "ProvinceID" => "51",
                   "InvarID" => 114
                ],
                312 => [
                   "OnvarID" => 312,
                   "CityName" => "شازند",
                   "ProvinceID" => "51",
                   "InvarID" => 255
                ],
                313 => [
                   "OnvarID" => 313,
                   "CityName" => "خمین",
                   "ProvinceID" => "51",
                   "InvarID" => 155
                ],
                314 => [
                   "OnvarID" => 314,
                   "CityName" => "دلیجان",
                   "ProvinceID" => "51",
                   "InvarID" => 178
                ],
                315 => [
                   "OnvarID" => 315,
                   "CityName" => "محلات",
                   "ProvinceID" => "51",
                   "InvarID" => 371
                ],
                316 => [
                   "OnvarID" => 316,
                   "CityName" => "چالوس",
                   "ProvinceID" => "16",
                   "InvarID" => 136
                ],
                317 => [
                   "OnvarID" => 317,
                   "CityName" => "عباس آباد",
                   "ProvinceID" => "16",
                   "InvarID" => 279
                ],
                318 => [
                   "OnvarID" => 318,
                   "CityName" => "كلاردشت",
                   "ProvinceID" => "16",
                   "InvarID" => 328
                ],
                319 => [
                   "OnvarID" => 319,
                   "CityName" => "تنكابن",
                   "ProvinceID" => "16",
                   "InvarID" => 116
                ],
                320 => [
                   "OnvarID" => 320,
                   "CityName" => "رامسر",
                   "ProvinceID" => "16",
                   "InvarID" => 191
                ],
                321 => [
                   "OnvarID" => 321,
                   "CityName" => "آمل",
                   "ProvinceID" => "16",
                   "InvarID" => 14
                ],
                322 => [
                   "OnvarID" => 322,
                   "CityName" => "نور",
                   "ProvinceID" => "16",
                   "InvarID" => 412
                ],
                323 => [
                   "OnvarID" => 323,
                   "CityName" => "نوشهر",
                   "ProvinceID" => "16",
                   "InvarID" => 413
                ],
                324 => [
                   "OnvarID" => 324,
                   "CityName" => "محمودآباد",
                   "ProvinceID" => "16",
                   "InvarID" => 372
                ],
                325 => [
                   "OnvarID" => 325,
                   "CityName" => "فریدونكنار",
                   "ProvinceID" => "16",
                   "InvarID" => 294
                ],
                326 => [
                   "OnvarID" => 326,
                   "CityName" => "سوادكوه",
                   "ProvinceID" => "16",
                   "InvarID" => 246
                ],
                327 => [
                   "OnvarID" => 327,
                   "CityName" => "سوادكوه شمالی",
                   "ProvinceID" => "16",
                   "InvarID" => 247
                ],
                328 => [
                   "OnvarID" => 328,
                   "CityName" => "قائمشهر",
                   "ProvinceID" => "16",
                   "InvarID" => 304
                ],
                329 => [
                   "OnvarID" => 329,
                   "CityName" => "میاندورود",
                   "ProvinceID" => "16",
                   "InvarID" => 395
                ],
                330 => [
                   "OnvarID" => 330,
                   "CityName" => "ساری",
                   "ProvinceID" => "16",
                   "InvarID" => 220
                ],
                331 => [
                   "OnvarID" => 331,
                   "CityName" => "بابل",
                   "ProvinceID" => "16",
                   "InvarID" => 52
                ],
                332 => [
                   "OnvarID" => 332,
                   "CityName" => "سیمرغ",
                   "ProvinceID" => "16",
                   "InvarID" => 253
                ],
                333 => [
                   "OnvarID" => 333,
                   "CityName" => "جویبار",
                   "ProvinceID" => "16",
                   "InvarID" => 129
                ],
                334 => [
                   "OnvarID" => 334,
                   "CityName" => "نكا",
                   "ProvinceID" => "16",
                   "InvarID" => 408
                ],
                335 => [
                   "OnvarID" => 335,
                   "CityName" => "گلوگاه",
                   "ProvinceID" => "16",
                   "InvarID" => 352
                ],
                336 => [
                   "OnvarID" => 336,
                   "CityName" => "بهشهر",
                   "ProvinceID" => "16",
                   "InvarID" => 85
                ],
                337 => [
                   "OnvarID" => 337,
                   "CityName" => "بابلسر",
                   "ProvinceID" => "16",
                   "InvarID" => 53
                ],
                338 => [
                   "OnvarID" => 338,
                   "CityName" => "تاكستان",
                   "ProvinceID" => "15",
                   "InvarID" => 107
                ],
                339 => [
                   "OnvarID" => 339,
                   "CityName" => "آبیك",
                   "ProvinceID" => "15",
                   "InvarID" => 4
                ],
                340 => [
                   "OnvarID" => 340,
                   "CityName" => "البرز",
                   "ProvinceID" => "15",
                   "InvarID" => 38
                ],
                341 => [
                   "OnvarID" => 341,
                   "CityName" => "قزوین",
                   "ProvinceID" => "15",
                   "InvarID" => 309
                ],
                342 => [
                   "OnvarID" => 342,
                   "CityName" => "آوج",
                   "ProvinceID" => "15",
                   "InvarID" => 15
                ],
                343 => [
                   "OnvarID" => 343,
                   "CityName" => "بوئین زهرا",
                   "ProvinceID" => "15",
                   "InvarID" => 87
                ],
                344 => [
                   "OnvarID" => 344,
                   "CityName" => "قم",
                   "ProvinceID" => "14",
                   "InvarID" => 314
                ],
                345 => [
                   "OnvarID" => 345,
                   "CityName" => "دامغان",
                   "ProvinceID" => "87",
                   "InvarID" => 167
                ],
                346 => [
                   "OnvarID" => 346,
                   "CityName" => "شاهرود",
                   "ProvinceID" => "87",
                   "InvarID" => 256
                ],
                347 => [
                   "OnvarID" => 347,
                   "CityName" => "میامی",
                   "ProvinceID" => "87",
                   "InvarID" => 394
                ],
                348 => [
                   "OnvarID" => 348,
                   "CityName" => "سرخه",
                   "ProvinceID" => "87",
                   "InvarID" => 233
                ],
                349 => [
                   "OnvarID" => 349,
                   "CityName" => "سمنان",
                   "ProvinceID" => "87",
                   "InvarID" => 242
                ],
                350 => [
                   "OnvarID" => 350,
                   "CityName" => "مهدیشهر",
                   "ProvinceID" => "87",
                   "InvarID" => 389
                ],
                351 => [
                   "OnvarID" => 351,
                   "CityName" => "آرادان",
                   "ProvinceID" => "87",
                   "InvarID" => 6
                ],
                352 => [
                   "OnvarID" => 352,
                   "CityName" => "گرمسار",
                   "ProvinceID" => "87",
                   "InvarID" => 348
                ],
                353 => [
                   "OnvarID" => 353,
                   "CityName" => "ممانه و سملقان",
                   "ProvinceID" => "32",
                   "InvarID" => 368
                ],
                354 => [
                   "OnvarID" => 354,
                   "CityName" => "راز و جرگلان",
                   "ProvinceID" => "32",
                   "InvarID" => 190
                ],
                355 => [
                   "OnvarID" => 355,
                   "CityName" => "اسفراین",
                   "ProvinceID" => "32",
                   "InvarID" => 30
                ],
                356 => [
                   "OnvarID" => 356,
                   "CityName" => "فاروج",
                   "ProvinceID" => "32",
                   "InvarID" => 285
                ],
                357 => [
                   "OnvarID" => 357,
                   "CityName" => "شیروان",
                   "ProvinceID" => "32",
                   "InvarID" => 271
                ],
                358 => [
                   "OnvarID" => 358,
                   "CityName" => "بجنورد",
                   "ProvinceID" => "32",
                   "InvarID" => 62
                ],
                359 => [
                   "OnvarID" => 359,
                   "CityName" => "جاجرم",
                   "ProvinceID" => "32",
                   "InvarID" => 122
                ],
                360 => [
                   "OnvarID" => 360,
                   "CityName" => "گرمه",
                   "ProvinceID" => "32",
                   "InvarID" => 349
                ],
                361 => [
                   "OnvarID" => 361,
                   "CityName" => "نیمروز",
                   "ProvinceID" => "61",
                   "InvarID" => 418
                ],
                362 => [
                   "OnvarID" => 362,
                   "CityName" => "هیرمند",
                   "ProvinceID" => "61",
                   "InvarID" => 427
                ],
                363 => [
                   "OnvarID" => 363,
                   "CityName" => "هامون",
                   "ProvinceID" => "61",
                   "InvarID" => 419
                ],
                364 => [
                   "OnvarID" => 364,
                   "CityName" => "زابل",
                   "ProvinceID" => "61",
                   "InvarID" => 211
                ],
                365 => [
                   "OnvarID" => 365,
                   "CityName" => "زهك",
                   "ProvinceID" => "61",
                   "InvarID" => 218
                ],
                366 => [
                   "OnvarID" => 366,
                   "CityName" => "میرجاوه",
                   "ProvinceID" => "61",
                   "InvarID" => 399
                ],
                367 => [
                   "OnvarID" => 367,
                   "CityName" => "زاهدان",
                   "ProvinceID" => "61",
                   "InvarID" => 212
                ],
                368 => [
                   "OnvarID" => 368,
                   "CityName" => "خاش",
                   "ProvinceID" => "61",
                   "InvarID" => 144
                ],
                369 => [
                   "OnvarID" => 369,
                   "CityName" => "دلگان",
                   "ProvinceID" => "61",
                   "InvarID" => 177
                ],
                370 => [
                   "OnvarID" => 370,
                   "CityName" => "ایرانشهر",
                   "ProvinceID" => "61",
                   "InvarID" => 49
                ],
                371 => [
                   "OnvarID" => 371,
                   "CityName" => "مهرستان",
                   "ProvinceID" => "61",
                   "InvarID" => 392
                ],
                372 => [
                   "OnvarID" => 372,
                   "CityName" => "سیب و سواران",
                   "ProvinceID" => "61",
                   "InvarID" => 249
                ],
                373 => [
                   "OnvarID" => 373,
                   "CityName" => "سراوان",
                   "ProvinceID" => "61",
                   "InvarID" => 227
                ],
                374 => [
                   "OnvarID" => 374,
                   "CityName" => "فنوج",
                   "ProvinceID" => "61",
                   "InvarID" => 298
                ],
                375 => [
                   "OnvarID" => 375,
                   "CityName" => "سرباز",
                   "ProvinceID" => "61",
                   "InvarID" => 229
                ],
                376 => [
                   "OnvarID" => 376,
                   "CityName" => "قصر قند",
                   "ProvinceID" => "61",
                   "InvarID" => 312
                ],
                377 => [
                   "OnvarID" => 377,
                   "CityName" => "نیك شهر",
                   "ProvinceID" => "61",
                   "InvarID" => 417
                ],
                378 => [
                   "OnvarID" => 378,
                   "CityName" => "چاه بهار",
                   "ProvinceID" => "61",
                   "InvarID" => 132
                ],
                379 => [
                   "OnvarID" => 379,
                   "CityName" => "كنارك",
                   "ProvinceID" => "61",
                   "InvarID" => 332
                ],
                380 => [
                   "OnvarID" => 380,
                   "CityName" => "فیروزكوه",
                   "ProvinceID" => "11",
                   "InvarID" => 302
                ],
                381 => [
                   "OnvarID" => 381,
                   "CityName" => "ملارد",
                   "ProvinceID" => "11",
                   "InvarID" => 381
                ],
                382 => [
                   "OnvarID" => 382,
                   "CityName" => "پیشوا",
                   "ProvinceID" => "11",
                   "InvarID" => 106
                ],
                383 => [
                   "OnvarID" => 383,
                   "CityName" => "قرچك",
                   "ProvinceID" => "11",
                   "InvarID" => 307
                ],
                384 => [
                   "OnvarID" => 384,
                   "CityName" => "پاكدشت",
                   "ProvinceID" => "11",
                   "InvarID" => 100
                ],
                385 => [
                   "OnvarID" => 385,
                   "CityName" => "پردیس",
                   "ProvinceID" => "11",
                   "InvarID" => 102
                ],
                386 => [
                   "OnvarID" => 386,
                   "CityName" => "دماوند",
                   "ProvinceID" => "11",
                   "InvarID" => 179
                ],
                387 => [
                   "OnvarID" => 387,
                   "CityName" => "ری",
                   "ProvinceID" => "11",
                   "InvarID" => 209
                ],
                388 => [
                   "OnvarID" => 388,
                   "CityName" => "اسلامشهر",
                   "ProvinceID" => "11",
                   "InvarID" => 33
                ],
                389 => [
                   "OnvarID" => 389,
                   "CityName" => "قدس",
                   "ProvinceID" => "11",
                   "InvarID" => 306
                ],
                390 => [
                   "OnvarID" => 390,
                   "CityName" => "شهریار",
                   "ProvinceID" => "11",
                   "InvarID" => 265
                ],
                391 => [
                   "OnvarID" => 391,
                   "CityName" => "ورامین",
                   "ProvinceID" => "11",
                   "InvarID" => 428
                ],
                392 => [
                   "OnvarID" => 392,
                   "CityName" => "تهران",
                   "ProvinceID" => "11",
                   "InvarID" => 118
                ],
                393 => [
                   "OnvarID" => 393,
                   "CityName" => "شمیرانات",
                   "ProvinceID" => "11",
                   "InvarID" => 261
                ],
                394 => [
                   "OnvarID" => 394,
                   "CityName" => "رباط كریم",
                   "ProvinceID" => "11",
                   "InvarID" => 196
                ],
                395 => [
                   "OnvarID" => 395,
                   "CityName" => "بهارستان",
                   "ProvinceID" => "11",
                   "InvarID" => 83
                ],
                396 => [
                   "OnvarID" => 396,
                   "CityName" => "چالدران",
                   "ProvinceID" => "57",
                   "InvarID" => 135
                ],
                397 => [
                   "OnvarID" => 397,
                   "CityName" => "شوط",
                   "ProvinceID" => "57",
                   "InvarID" => 269
                ],
                398 => [
                   "OnvarID" => 398,
                   "CityName" => "ماكو",
                   "ProvinceID" => "57",
                   "InvarID" => 367
                ],
                399 => [
                   "OnvarID" => 399,
                   "CityName" => "خوی",
                   "ProvinceID" => "57",
                   "InvarID" => 164
                ],
                400 => [
                   "OnvarID" => 400,
                   "CityName" => "سلماس",
                   "ProvinceID" => "57",
                   "InvarID" => 241
                ],
                401 => [
                   "OnvarID" => 401,
                   "CityName" => "پلدشت",
                   "ProvinceID" => "57",
                   "InvarID" => 104
                ],
                402 => [
                   "OnvarID" => 402,
                   "CityName" => "جایپاره",
                   "ProvinceID" => "57",
                   "InvarID" => 137
                ],
                403 => [
                   "OnvarID" => 403,
                   "CityName" => "ارومیه",
                   "ProvinceID" => "57",
                   "InvarID" => 26
                ],
                404 => [
                   "OnvarID" => 404,
                   "CityName" => "اشنویه",
                   "ProvinceID" => "57",
                   "InvarID" => 35
                ],
                405 => [
                   "OnvarID" => 405,
                   "CityName" => "سردشت",
                   "ProvinceID" => "57",
                   "InvarID" => 234
                ],
                406 => [
                   "OnvarID" => 406,
                   "CityName" => "بوكان",
                   "ProvinceID" => "57",
                   "InvarID" => 91
                ],
                407 => [
                   "OnvarID" => 407,
                   "CityName" => "مهاباد",
                   "ProvinceID" => "57",
                   "InvarID" => 388
                ],
                408 => [
                   "OnvarID" => 408,
                   "CityName" => "پیرانشهر",
                   "ProvinceID" => "57",
                   "InvarID" => 105
                ],
                409 => [
                   "OnvarID" => 409,
                   "CityName" => "میاندوآب",
                   "ProvinceID" => "26",
                   "InvarID" => 396
                ],
                410 => [
                   "OnvarID" => 410,
                   "CityName" => "نقده",
                   "ProvinceID" => "57",
                   "InvarID" => 407
                ],
                411 => [
                   "OnvarID" => 411,
                   "CityName" => "تكاب",
                   "ProvinceID" => "57",
                   "InvarID" => 115
                ],
                412 => [
                   "OnvarID" => 412,
                   "CityName" => "شاهین دژ",
                   "ProvinceID" => "57",
                   "InvarID" => 257
                ],
                413 => [
                   "OnvarID" => 413,
                   "CityName" => "اشكذر",
                   "ProvinceID" => "93",
                   "InvarID" => 430
                ],
                414 => [
                   "OnvarID" => 414,
                   "CityName" => "میبد",
                   "ProvinceID" => "93",
                   "InvarID" => 398
                ],
                415 => [
                   "OnvarID" => 415,
                   "CityName" => "اردكان",
                   "ProvinceID" => "93",
                   "InvarID" => 22
                ],
                416 => [
                   "OnvarID" => 416,
                   "CityName" => "ابركوه",
                   "ProvinceID" => "93",
                   "InvarID" => 16
                ],
                417 => [
                   "OnvarID" => 417,
                   "CityName" => "بافق",
                   "ProvinceID" => "93",
                   "InvarID" => 58
                ],
                418 => [
                   "OnvarID" => 418,
                   "CityName" => "مهریز",
                   "ProvinceID" => "93",
                   "InvarID" => 393
                ],
                419 => [
                   "OnvarID" => 419,
                   "CityName" => "تفت",
                   "ProvinceID" => "93",
                   "InvarID" => 113
                ],
                420 => [
                   "OnvarID" => 420,
                   "CityName" => "یزد",
                   "ProvinceID" => "93",
                   "InvarID" => 430
                ],
                421 => [
                   "OnvarID" => 421,
                   "CityName" => "بهاباد",
                   "ProvinceID" => "93",
                   "InvarID" => 81
                ],
                422 => [
                   "OnvarID" => 422,
                   "CityName" => "خاتم",
                   "ProvinceID" => "93",
                   "InvarID" => 143
                ],
                423 => [
                   "OnvarID" => 423,
                   "CityName" => "ماهنشان",
                   "ProvinceID" => "67",
                   "InvarID" => 369
                ],
                424 => [
                   "OnvarID" => 424,
                   "CityName" => "خدابنده",
                   "ProvinceID" => "67",
                   "InvarID" => 146
                ],
                425 => [
                   "OnvarID" => 425,
                   "CityName" => "ابهر",
                   "ProvinceID" => "67",
                   "InvarID" => 17
                ],
                426 => [
                   "OnvarID" => 426,
                   "CityName" => "ابهر",
                   "ProvinceID" => "67",
                   "InvarID" => 17
                ],
                427 => [
                   "OnvarID" => 427,
                   "CityName" => "سلطانیه",
                   "ProvinceID" => "67",
                   "InvarID" => 240
                ],
                428 => [
                   "OnvarID" => 428,
                   "CityName" => "ایجرود",
                   "ProvinceID" => "67",
                   "InvarID" => 47
                ],
                429 => [
                   "OnvarID" => 429,
                   "CityName" => "زنجان",
                   "ProvinceID" => "67",
                   "InvarID" => 217
                ],
                430 => [
                   "OnvarID" => 430,
                   "CityName" => "طارم",
                   "ProvinceID" => "67",
                   "InvarID" => 275
                ],
                431 => [
                   "OnvarID" => 431,
                   "CityName" => "خرمدره",
                   "ProvinceID" => "67",
                   "InvarID" => 150
                ]
            ];

            $cities = [];
            foreach ($xml as $value) {
                //  if ($value->fk_FeatureType >= 1 && $value->fk_FeatureType <= 6) { //// code ghabli
                if (RoadObserved::where('fk_RegisteredEventMessage', $value->fk_RegisteredEventMessage)->exists()) {
                    continue;
                }

                if ($value->fk_FeatureType >= 1 && $value->fk_FeatureType <= 18) {
                    $mobile = null;

                    if ($value->MobileForSendEventSms && (strlen($value->MobileForSendEventSms) == 11)) {
                        $mobile = $value->MobileForSendEventSms;
                    }

                    $city = findCityFromGeoJson($value->YGeo, $value->XGeo);
                    $cityModel = $city ? City::find($city['city_id']) : null;
                    $rop = RoadObserved::updateOrCreate(
                        ['fk_RegisteredEventMessage' => $value->fk_RegisteredEventMessage],
                        ['fk_RegisteredEventMessage' => $value->fk_RegisteredEventMessage ?? null,
                        'Title' => $value->Title ?? null,
                        'StartTime' => $value->StartTime ?? null,
                        'EndTime' => $value->EndTime ?? null,
                        'StartDate' => $value->StartDate ?? null,
                        'EndDate' => $value->EndDate ?? null,
                        'StartTime_DateTime' => $value->StartTime_DateTime ?? null,
                        'StartTime_DateTime_fa' => Verta::instance($value->StartTime_DateTime) ?? null,
                        'EndTime_DateTime' => $value->EndTime_DateTime ?? null,
                        'AutoID' => $value->AutoID ?? null,
                        'fk_Country' => $value->fk_Country ?? null,
                        'ProvinceName' => $value->ProvinceName ?? null,
                        'fk_Province' => $value->fk_Province ?? null,
                        'fk_Town' => $value->fk_Town ?? null,
                        'TownName' => $value->TownName ?? null,
                        'lng'=> $value->XGeo ?? null,
                        'lat'=> $value->YGeo ?? null,
                        'XLAM'=> $value->XLAM ?? null,
                        'YLAM'=> $value->YLAM ?? null,
                        'WeatherName' => $value->WeatherName ?? null,
                        'fk_Weather' => $value->fk_Weather ?? null,
                        'EventTypeTitle' => $value->EventTypeTitle ?? null,
                        'fk_EventType' => $value->fk_EventType ?? null,
                        'FeatureTypeTitle' => $value->FeatureTypeTitle ?? null,
                        'fk_FeatureType' => $value->fk_FeatureType ?? null,
                        'Description' => (strlen($value->Description) > 5) ? $value->Description : null,
                        'MobileForSendEventSms' => $mobile,
                        'rms_province_id' => $rmsProvinceId[(int)$value->fk_Province] ?? null,
                        'rms_city_id' => $rmsCityId[(int)$value->fk_Town]["InvarID"] ?? null,
                        'observed_way_id' => self::get_way_id_from_nominatim($value->XGeo, $value->YGeo) ?? null,

                        'province_id' => $city ? $city['province_id'] : null,
                        'city_id' => $city ? $city['city_id'] : null,
                        // 'handler_type' => EdarateShahri::class,
                        'edarate_shahri_id' => $cityModel ? ($cityModel->edarateShahri()->where('is_primary', 1)->exists() ? $cityModel->edarateShahri()->where('is_primary', 1)->first()->id : null) : null,
                        'province_fa' => Province::find($city['province_id'])->name_fa,
                        'city_fa' => $cityModel ? $cityModel->name_fa : null,
                    ]
                    );
                }
            }
        } else {
            /////log for error add all of things like successfull operation
            $msg = 'rms: error in get data roadobserved  babe!!!!'."\n";
            // self::sms_sender('09398586633', $msg);
            // self::sms_sender('09367487107', $msg);
            return $result;
        }
        echo 'done at: '.date("Y-m-d H:i:s")."\n";
        return 0;
    }
    public function sms_sender($mobile, $msg)
    {
        $client=new SoapClient("http://sms1000.ir/webservice/smspro.asmx?WSDL");
        $result=$client->doSendSMS(
            array(
                'uUsername' => 'rmto',
                'uPassword' => 'Rahdari89',
                'uNumber' => '1000141',
                'uCellphones' => $mobile,
                'uMessage' => $msg,
                'uFarsi' => true,
                'uTopic' => false,
                'uFlash' => false
            )
        );
        //print_r($result);
        $x = $result->doSendSMSResult;
        return $x;
    }


    public function get_way_id_from_nominatim($lat, $lng)
    {
        $url = "https://testmap.141.ir/nominatim/reverse?format=jsonv2&lat=".$lat."&lon=".$lng."&zoom=16&addressdetails=16";
        $arrContextOptions=array(
         "ssl"=>array(
            "verify_peer"=>false,
            "verify_peer_name"=>false,
         )
         );

        $result = file_get_contents($url, false, stream_context_create($arrContextOptions));
        $result = json_decode($result);
        if (isset($result->osm_type)) {
            if ($result->osm_type == 'way') {
                return $result->osm_id;
            }
        }
        return 0;
    }
}
