Ko'proq

Teskari geokod: Jahon Geokod Xizmatiga ulana olmaydi

Teskari geokod: Jahon Geokod Xizmatiga ulana olmaydi


Men, ehtimol, bu savolga ESRIga yordam so'rab murojaat qilishim kerak edi, lekin umid qilgandimki, boshqa birov ham xuddi shu muammoga duch kelgan va uni hal qilgan. Men katta universitetning bir qismiman va biz sayt litsenziyasi sifatida ArcMap -ni olamiz. Biz tez -tez geokod qilamiz va ArcGIS Online -da kredit uchun to'laymiz. Ammo, agar menga geokod kerak bo'lsa, men asbobni jismonan ochganimda, faqat MGRS geokodlash xizmati mavjudligini payqadim. Men manzillarning ma'lumotlar bazasini o'ng tugmasini bosganimda va geokod variantini tanlaganimda, World Geocoder ko'rsatiladi va ishlaydi (agar men ArcGIS -ga onlayn kirgan bo'lsam). Men shu tarzda geokod qilyapman va bu muammo bo'lmadi, faqat endi men geokodni teskari o'zgartirishim kerak. Jahon geokodlash xizmati teskari geokodlash vositasida ko'rinmaydi va teskari geokodni sichqonchaning o'ng tugmasi bilan bosish mumkin emas. Men asboblar panelida "geokoder qo'shishni" sinab ko'rdim, lekin Jahon geokod xizmati qaerda yashayotganini topa olmayapman. Buni qanday tuzatish yoki muammoni hal qilish haqida har qanday fikr bormi?


Qarang, bu yordam beradimi. Bu ArcGIS server ulanishini qo'shish orqali Jahon Geokod Xizmatiga qanday ulanish haqida havola


Teskari geokod

ReverseGeocode operatsiyasi geokod xizmat resursida amalga oshiriladi. Bu operatsiyaning natijasi-teskari geokodli manzil manbai. Bu manba teskari geokodlangan manzilga tegishli barcha manzil maydonlari va uning aniq joylashuvi haqida ma'lumot beradi.

ReverseGeocode operatsiyasi ma'lum bir x/y manzilidagi manzilni aniqlaydi. Siz nuqta joylashuvining koordinatalarini geokodlash xizmatiga o'tkazasiz va xizmat manzilga yoki manzilga eng yaqin bo'lgan joyni qaytaradi.

REST so'rovining URL manzilida HTTPS bo'lishi kerak. HTTP bilan so'rovlar qo'llab -quvvatlanmaydi.


Geokodlash va teskari geokodlash o'rtasidagi farq nima?

Yangi boshlanuvchilar uchun biz savolga javob berishimiz kerak: geokodlash nima? Geokodlash manzildan boshlanadi va sizga kenglik/uzunlik nuqtasini (geokod) qaytarib beradi. Teskari geokodlash kenglik/uzunlik nuqtasidan boshlanadi va sizga manzilni qaytarib beradi.

Masalan, aytaylik, biz xalqaro geokodirovka qilamiz va siz Everest cho'qqisida yashaysiz. Bu, birinchi navbatda, juda ajoyib - manzarali joy olishning yo'li.

Sizning manzilingiz shunday formatlanadi:

Geocoding bu manzilni oladi va uni tegishli geokod bilan almashtiradi, bu manzilning kenglik va uzunlik koordinatalari. Everest tog'idagi manzilingiz uchun geokod quyidagicha bo'ladi:

Bu geokod er yuzidagi aniq nuqtani ifodalaydi. Pochta manzili er yuzidagi aniq nuqta emas. Shunday qilib, geokod siz yashayotgan joyning aniq ta'rifi bo'lishi mumkin. Manzilni geokodga aylantirish jarayoni "geokodlash" deb nomlanadi. Xo'sh, teskari geokodlash nima?

Teskari geokodlash - bu geokodni manzilga aylantirish jarayoni.

Agar biz sizning geografik kenglik va uzunlik koordinatalaringizdan (yoki geokodingizdan) boshlagan bo'lsak:

bu geokodni teskari geokodlash bizga manzilingizni qaytarib beradi

Bu manzil ma'lumotlari sizning "teskari geokod" deb nomlanadi.

Siz: "Ajoyib. Tushundim. Lekin kimga g'amxo'rlik qiladi? Geokodlash va teskari geokodlash men uchun nima qiladi? ” Men javob berardim: “Ushbu hujjatning keyingi bo'limiga xush kelibsiz. Siz men so'ragan aniq savolni beryapsiz. ”

Geokodlar oddiy manzil bera olmaydigan geografik ma'lumotlarning aniqligini berishi mumkin. Masalan, tasavvur qiling -a, sizning tog'ingiz. Everest uyi, aslida, keng tarqalgan turar -joy majmuasining bir qismidir.

Agar kimdir sizning kvartirangizga paket etkazib berishga harakat qilsa, bu manzil ularni sizning manzilingiz emas, balki kompleksning manziliga olib keladi. Eng yomoni, manzillar birlik raqamlarini ko'rsatmaydi. Endi manzilni topish qiyin bo'ladi.

Geokod joylashuvga asoslangan qo'shimcha aniqlikni ta'minlaydi. Kenglik va uzunlikka ega bo'lish aniq manzilni aniqlab beradi. Yuqori aniqlik darajasi sizga to'g'ri manzillar va eng to'g'ri geokodlarni olishingizni kafolatlaydi. Albatta, bu siz foydalanayotgan teskari geokodlash veb -xizmatlarining to'g'riligiga bog'liq.

Aniqlik darajalari

Geocodingning foydasi siz foydalanayotgan geokodlash xizmatining to'g'riligiga bog'liq. Geokodlash sohasida aniqlikning turli darajalari mavjud. Shunday qilib, biz sizga kerak bo'ladigan xizmatlarni tahlil qilishingizni maslahat beramiz. Teskari geokodlash aniqligining turli darajalari:

  • Uyingizda geokodlash: Geokod aniqligining eng yuqori darajasi. Nomidan ko'rinib turibdiki, bu koordinatalar ko'rib chiqilayotgan joyning tomi sifatida tasdiqlangan. Bu ma'lumotlar ko'pincha interpolatsiya orqali olinadi. Uyingizda joylashgan joy yaqin yo'llarning ma'lum koordinatalari asosida hisoblanadi.
  • Centroid posilkasi: Posilka yoki mulkning markazini aniqlaydi. Bu tomning aniqligi emas, lekin u hech bo'lmaganda mulkka tegishi tasdiqlangan va geokodlar uchastkaning o'rtasiga yaqin bo'lishi mumkin.
  • Aniq yo'l: Geografik ma'lumotlar magistral yoki ko'cha darajasida tasdiqlangan. Mulkning aniq joylashuvi aniqlanmagan. Aksincha, ma'lumotlarning bu darajasi sizning "yaqin" ekanligingizni bildiradi, lekin uning aniq joylashuvi tasdiqlanmaydi.
  • Mahalliylik: Ma'lumotlar shahar yoki shaharcha darajasida tasdiqlangan. Qidiruv ma'lum bir shahar yoki shaharchada bo'lishi aniqlandi, lekin aniqroq aniqlab bo'lmaydi.
  • Ma'muriy hudud: Geokodlash aniqligining eng past darajasi. Ko'rib chiqilayotgan joyni faqat ma'lum bir shtat yoki viloyatda ajratish mumkin.

Muayyan geokod xizmati yoki API xizmat ko'rsatuvchi provayderiga kirishdan oldin, aniqlik darajasi sizga kerak bo'lgan darajaga mos kelishini ta'minlash uchun bir nechta namunali ko'cha manzillarini ishga tushirishni taklif qilamiz. E'tibor bering: ko'p teskari geokodlash kompaniyalari, ular bo'lmaganida, "tomning balandligi aniq" deb e'lon qilishadi. Ularning sotish nusxalariga ishonishning o'rniga, manzillar namunasini sinab ko'ring va o'zingiz ko'ring.

Geokodni manzilga qanday o'zgartirish kerak

Biz geokod nima ekanligini va geokodlar bizga qanday yordam berishi mumkinligini bilamiz. Biz geokodlash bilan aniqlik darajasi farqli ekanligini bilib oldik. Keling, geokodni uy raqami, ko'cha nomi, shahar nomi, pochta indeksi, mamlakat kodi, geonamlari va boshqa geo joy nomlari bilan ko'chadagi manzilga qanday o'zgartirish mumkin. Bu bizga kerakli joylashuv ma'lumotlarini beradi.

Koordinatalar odatda ikkita formatda ko'rsatiladi. Birinchidan, kenglik va uzunlik sifatida, odam gradus belgisini (°) tushunadi va o'z ichiga oladi va Shimoliy, Sharqiy, Janubiy va G'arbiy ko'rsatkichlarni o'z ichiga oladi. Boshqa raqamli stsenariy sifatida ko'rsatiladi, uni kompyuter yaxshiroq tushunadi.

Ko'proq inson Mt uchun tushunarli format. Everest shunday ko'rinishga ega bo'ladi:

Qancha ko'p bo'lsa kompyuter tushunarli format quyidagicha ko'rinadi:

Katta farq yo'q, lekin hamma ham geokod tizimlari odamlarga tushunarli bo'lgan formatni izohlay olmaydi. Shunday qilib, kompyuterning tushunarli koordinatalarini olganingizga ishonch hosil qiling.

O'zingizning geokodingizni teskari geokodlash mexanizmiga kiriting

Geocoding qidirish provayderlari ko'pincha konvertor yoki topuvchi xizmatlari deb ataladi. Yaqin -atrofda bo'lgani uchun biz SmartyStreets -ning teskari geokoderidan foydalanamiz.

Mana biz kiritgan asl geokod va SmartyStreets API javobida qaytargan geokod. Bu 29 futga (8,83 metr) yaxshilandi. Pokiza.

Nihoyat, SmartyStreets demosi API javobida sizning geokodingizga eng yaqin 10 manzilni o'z ichiga oladi. Shuningdek, biz har bir manzilni eng yaxshi geokodlar va aniqlik darajasi bilan bog'laymiz.

Va u erda sizda bor! Biz faqat geokodni teskari yo'naltiramiz. Bu yaxshi tuyuladi, shunday emasmi?

To'liq teskari geokodlash

Bitta manzilni geokodga qaytarish juda oddiy, lekin agar siz ko'p geokodlarni manzilga aylantirmoqchi bo'lsangiz nima qilasiz?

Siz har bir geokodni birma -bir qo'lda qayta ishlashingiz mumkin edi, lekin siz tezlikda osmon millarini bosib o'tib, har bir joyga shaxsan tashrif buyurishingiz mumkin. Aytmoqchimanki, kimning geokodini yuzlab, minglab yoki hatto yuz minglab geokodlarni alohida -alohida manzillarga aylantirishga vaqti bor?

Ko'pgina geokodlarni tezda qayta ishlash uchun siz teskari geokodlashni bajarishni xohlaysiz. Buning uchun siz CSV fayli bilan yuklashga ruxsat beruvchi teskari geokodli xizmat ko'rsatuvchi provayderdan foydalanishingiz kerak bo'ladi. Shuningdek, teskari geokodli API provayderini topishingiz mumkin.

Paket va API uchun xizmat ko'rsatuvchi provayderlar

Teskari geokodlashni partiyalar bilan ta'minlaydigan bir qator taniqli kompaniyalar mavjud. Bu kompaniyalarning xizmatlari narx va sifat jihatidan farq qiladi, lekin biz ikkita mashhur provayderning ijobiy va salbiy tomonlarini muhokama qilamiz: Google va OpenStreetMaps.

Google teskari geokodlash

Eng mashhur teskari geokod konvertorlaridan biri, albatta, Google. Axir, kim Google xaritalari haqida eshitmagan? Va ular xaritalar qilgani uchun, Google ham API orqali geokodlarni to'playdi va teskari geokodlashni amalga oshiradi.

Ko'pgina geokod provayderlari singari, Google 200 dan ortiq mamlakatlar va hududlarni qamrab oladi, lekin geokodlash aniqligi darajasi har bir mamlakatda turlicha. Masalan, Qo'shma Shtatlar uchun fazoviy ma'lumotlarni geokodlash ko'pincha "uyingizda" darajasidagi aniqlik bo'lishi mumkin. Xitoy uchun geokodlar noto'g'riligi bilan ajralib turadi va ularni faqat ma'muriy yoki shtat/viloyat darajasida tekshirish mumkin.

Shunisi e'tiborga loyiqki, Google-ning teskari geokodlash API-si ma'lum koordinatalar haqidagi ma'lumot turlarini Google xaritalarida o'rnatilgan foydalanuvchilarga qaragan teskari geokoder kabi yig'maydi. Bu shuni anglatadiki, siz sotib olishingiz mumkin bo'lgan Google Geocoding API, ularning ichki Google xaritalariga qaraganda aniqroq emas. Shunday qilib, biz uni bajarishdan oldin aniqlik testini o'tkazish uchun API olishingizni tavsiya qilamiz. Agar siz ularning foydalanuvchilarini teskari geokoderga qaragan holda sinab ko'rsangiz, siz hikoyaning bir qismini olasiz.

Google xaritalash xizmatining geokodlaridan tashqari, "Marshrutlar" va "Joylar" uchun ma'lumot manbasini taqdim etadi. Biroq, bu ma'lumotlar ba'zi cheklovlar bilan birga keladi. Xususan, foydalanuvchilar soniyasiga faqat server tarafidan 50 ta so'rov bilan cheklangan. Bu shuni anglatadiki, ko'p ma'lumotni kesish ko'p vaqt talab qilishi mumkin.

Shunday qilib, Google -dan foydalanishning afzalligi shundaki, siz Google Xaritalar ortidagi kompaniyadan foydalanasiz - bu uning foydaliligi va aniqligi bilan mashhur. Google Address API -ni ishlatishning salbiy tomoni shundaki, siz Google Xaritalar ko'rsatadigan aniqlikka ega bo'lmaysiz. Va Google sizga qaytaradigan manzil haqiqiy, haqiqiy manzil ekanligini tasdiqlamaydi.

OpenStreetMap teskari geokodlash

OpenStreetMaps - bu geokodirovka ma'lumotlarining yana bir taniqli provayderi. OpenStreetMap loyihasi butun dunyo bo'ylab geografik ma'lumotlarni taqdim etish uchun hamkorlik qiladigan xaritalash bo'yicha mutaxassislar jamoasi tomonidan tuzilgan.

OpenStreetMap -ning yaxshi tomoni shundaki, u vikining o'ziga xos turi: u bepul va uni maqsadli odamlar qo'llab -quvvatlaydi. Salbiy tomoni shundaki, agar siz veb -xizmatidan foydalansangiz, OpenStreetMap va uning ishtirokchilarini kreditlashingizni talab qiladi. Shunday qilib, agar sizga har qanday turdagi biznes jarayonlari uchun teskari geokodlar kerak bo'lsa, siz boshqa provayderni qidirishingiz kerak bo'ladi.

Bundan tashqari, dunyoni teskari geokodlash kabi ulkan loyihada ko'ngillilar bilan ish olib borishda, geografik ma'lumotlarning aniqligi koordinatadan koordinatagacha farq qilishi mumkin. Shunday qilib, ommaviy yoki API xizmat ko'rsatuvchi provayderga topshirishdan oldin bir nechta manzillarni sinab ko'ring.

SmartyStreets teskari geokodlash

SmartyStreets US Reverse Geocoding API-bu jahon darajasidagi geokoder. Bizning teskari geokoderimiz boshqa provayderlarga qaraganda bir qancha raqobatbardosh afzalliklarga ega. Bu erda korxonalar SmartyStreets -ni tanlashining asosiy sabablari.

Tezlik - Esingizdami, Google darajasi sizni soniyasiga 50 ta teskari geokod bilan cheklaydi? Agar mahallada sayr qilish uchun sizga bir nechta geokod kerak bo'lsa, bu juda yaxshi. Agar sizda bir necha haftada telekommunikatsiya provayderlari kabi 200 milliard geokod bo'lsa nima bo'ladi? Bu koordinatalarni geokodlash uchun 127 yil kerak bo'ladi. Bu vaqtga kelib, ma'lumotlar endi foydali bo'lmaydi.

Yaxshiyamki, SmartyStreets sekundiga 30 000 dan ortiq qidiruv tezligini o'z ichiga olgan rejalarni taklif qiladi. Xuddi Google -ga qaraganda 600+ marta tezroq. Agar Google "Dunyo bo'ylab 80 kunda" kitobi bo'lganida, SmartyStreets "Dunyo bo'ylab, otaxonni tomosha qilishdan ko'ra qisqa vaqt ichida" kitobi bo'lar edi. Ta'sirchan.

Aniqlik - Aniqlik muhim. Giper-aniqlikdagi jinslar. SmartyStreets geokodlarni o'zgartirganda, biz sizga koordinatalaringizga eng yaqin manzillarni beramiz. Shuningdek, biz sizning manzilingiz uchun eng aniq geokodni taqdim etamiz. Shunday qilib, siz bizga geokodni berasiz, biz esa manzilni qaytarib beramiz va iloji bo'lsa, uyingizda geokod.

Kaskadli qaror - Geokodni teskari o'zgartirganda, biz mavjud bo'lgan eng aniq manzillarni taqdim etamiz. Biz geokodlarning aksariyati uchun uyingizda aniqligini taklif qilamiz. Agar biz so'ralgan geokodni topa olmasak, biz geokod bo'lmaguncha keyingi aniqlik darajalariga o'tamiz. Eng muhimi, biz sizga qanday aniqlik darajasida erishganimizni aytib beramiz, siz taxmin qilmaysiz.

Biz taxmin qilmaymiz - Taxmin qilish va geokodlar birgalikda yaxshi o'ynamaydi. Hali ham, geokodlari ko'zlari bog'langan dart otishdek aniq bo'lgan geokodlarni etkazib beruvchilar bor. Bu provayderlar iloji boricha sizga so'ralgan manzilingiz uchun geokod berish uchun qo'lidan kelganicha harakat qilishadi. Agar ular so'ralgan geokodni bera olmasalar, ular yuzlab kilometr uzoqlikda bo'lishi mumkin bo'lgan eng yaxshi taxminni aytadilar.

Yomon ma'lumotlarga asoslanib, biznes -qarorlar qabul qilinishini taxmin qiladigan geokoderlar. Siz provayderning qorong'uda tortishishdan ko'ra, "biz bilmaymiz" deganini afzal ko'rasiz.

Boshqa provayderlar singari, SmartyStreets ham sizga eng aniq geokodlarni berish uchun hamma narsani qiladi. Ishonchimiz komil bo'lmaganda, biz taxmin qilmaymiz. Buning o'rniga, biz sizga bilmaganimizni aytamiz. Shunday qilib, siz noto'g'ri ma'lumotlarga asoslangan biznes qarorlarini qabul qilmaysiz.

To'g'ri, standart manzil - SmartyStreets manzillarni tekshirish dasturi sifatida tug'ilgan. Tasdiqlash bizning birinchi sevgimiz bo'lgani uchun, biz uni AQShning Geocoding va teskari geokodlash mahsulotlariga joylashtirdik.

Manzilni geokodlashda biz birinchi navbatda manzilni standartlashtirishni amalga oshiramiz va uning haqiqiy va to'g'ri ekanligiga ishonch hosil qilamiz. Keyin, biz sizga Geocode beramiz. Teskari geokod yordamida biz sizning geokodingizni faqat haqiqiy AQSh manzillariga moslashtiramiz. Va, albatta, biz sizga manzilni o'sha standart formatda beramiz.

Men sizga kichik sirni ochmoqchiman. Eng yaxshi geokodlash eng yuqori darajadagi manzilni tasdiqlashdan kelib chiqadi. Agar provayder manzilni tasdiqlamasa yoki ochiq manbali ma'lumotlarga tayanmasa, siz ko'pincha noto'g'ri-ijobiy xabarlarni olasiz. Shuning uchun biz geokodlash mahsulotlarini ishlab chiqarishni tanladik. Biz manzillarni tasdiqlash sohasida etakchimiz. Shunday qilib, biz mavjud bo'lgan eng aniq geokodlarni taqdim eta olamiz.

Juda ishonchli - Bizning API -larimizni ishlatish uchun kod yozganingizda, u har doim to'g'ri ishlashini xohlaysiz.

SmartyStreets sizning tizimlaringizga oson integratsiya qilish uchun SDK va ko'plab namuna kodlarini taqdim etadi va biz 99,98% ish vaqtini kafolatlaymiz. Amalda, biz kompaniyamiz tashkil etilganidan beri 100% ish vaqtiga ega bo'ldik.

Biz shunchalik ishonamizki, Grinvich qirollik rasadxonasi ish vaqtimizga qarab soatlarini o'rnatadi. 1988 yildagi Toyota Hilux SmartyStreets -dan quvvat manbai sifatida foydalanadi. Bizning dasturiy ta'minot oqim kondansatörünün muhim tarkibiy qismi edi (biz DeLorean bilan maslahatlashmaganmiz). Biz Nokia 3210 -ni ishlab chiqishda foydalanganmiz. Bizning API -larimiz hatto termodinamikaning ikkinchi qonunini buzgani va "teskari entropiya" deb nomlangan yangi narsani namoyish qilgani ko'rsatildi. Bu mavzu bo'yicha ko'plab ilmiy ishlar kutilmoqda.

Qanday qilib biz shunchalik ishonchli bo'ldik? Mana qanday:

  • Qo'shma Shtatlarning bir qancha mintaqalarida ishlaydigan ortiqcha ma'lumotlar markazlari
  • Serverning ortiqcha monitoringi
  • Yukga qarab cheksiz darajaga yaqin bo'lgan ma'lumotlar markazlari
  • Xodimlar faqat Jorj Vashingtondan

Shunday qilib, siz bizning API -larimizdan foydalanishni boshlaganingizda, ularni sizning tizimingizning eng ishonchli komponentlari deb topsangiz, hayron bo'lmang.

Xulosa

Teskari geokodlash - bu kenglik va uzunlik koordinatalarini kiritish va tegishli manzilni olish amaliyoti. Aniqlik darajasi tomdan ma'muriy hududgacha o'zgarishi mumkin. Buni bilib, siz o'zingizning ehtiyojlaringiz uchun to'g'ri teskari geokoder xizmatlarini qidirishingiz va hatto partiya yoki API xizmatlarini ko'rsatadigan xizmatni topishingiz mumkin. Taqdim etilgan aniqlik darajasi kerakli aniqlik darajasiga mos kelishini kafolatlash uchun avval mahsulotni sinovdan o'tkazishni tavsiya qilamiz.

Endi u erga boring va sizning ehtiyojlaringizga mos keladigan eng yaxshi teskari geokodlash manzilini aniqlash xizmatini toping (bitta manzil, partiya yoki API) va lat long manzillarini manzilga o'zgartirishni boshlang!

Manzilingizni olganingizdan so'ng, siz ularni manzilni tekshirish vositasi orqali ishga tushirishingiz yoki ommaviy manzilni tekshirish vositasi yoki hatto manzilni tekshirish API -laridan birini sinab ko'rishingiz kerak.


Maxsus chiqish xususiyatlarini tanlash

ArcGIS World Geocoding Service ma'lum bir reverseGeocode kirish joyi uchun eng mos manzil yoki joyni qaytarish uchun tuzilgan. Biroq, teskari geokodlashni ishlatadigan dasturni ishlab chiquvchi sifatida, teskari geokod natijalarini ko'proq nazorat qilishni xohlashingiz mumkin. Masalan, siz ilovangiz foydalanuvchilaridan geokod o'rnini o'zgartirganda qaytariladigan xususiyatlarni tanlashini xohlashingiz mumkin. Yoki oldingi jadvalda keltirilgan qidirish toleranslari etarli emas va siz uzoq manzillarning qaytarilishini xohlaysiz. Ehtimol siz StreetInt o'yinlarini qaytarishni xohlaysiz. Teskari geokodlash natijalarini takomillashtirish orqali bunday talablarni qondirish uchun featureTypes parametridan foydalanishingiz mumkin.

FeatureTypes parametri, reverseGeocode so'rovi bilan qaytariladigan bir yoki bir nechta o'yin turini ko'rsatish uchun ishlatilishi mumkin. Agar featureTypes uchun bitta qiymat kiritilgan bo'lsa, qidiruv bardoshligi 500 metrgacha uzaytiriladi. Agar featureTypes parametri bir nechta qiymatlarni o'z ichiga oladigan bo'lsa, xususiyatlar ierarxiyasi jadvalida aniqlangan qidiruv toleranslari ishlatiladi. FeatureTypes parametrida ishlatiladigan mantiq tafsilotlari quyida tasvirlangan.

FeatureTypes shartlariga mos keladi

  • Agar featureTypes bo'sh bo'lsa, moslik StreetInt -ni hisobga olmaganda, xususiyatlar turining ierarxiya jadvalida aniqlangan standart xususiyatlar ierarxiyasiga va qidiruv toleranslariga asoslanadi. StreetInt o'yinlari faqat featureTypes = StreetInt reverseGeocode so'roviga kiritilgan bo'lsa qaytariladi.
  • Agar featureTypes bitta qiymatni o'z ichiga oladigan bo'lsa, 500 metrlik qidirish bardoshligi ishlatiladi va faqat kirish xususiyatining turi qidiriladi.
    • Agar kirish funktsiyasi turi kirish joyidan 500 metr masofada mavjud bo'lsa, u holda bu xususiyatga moslik qaytariladi.
    • Agar kirish joyidan 500 metr masofada kirish funktsiyasi turiga mos kelmasa, reverseGeocode so'rovi uchun hech qanday mos kelmaydi.
    • Agar kirish joyi kirish xususiyatlarining faqat bittasini qidirish bardoshliligida bo'lsa, u holda bu xususiyat turiga moslik qaytariladi.
    • Agar kirish joyi bir nechta kirish xususiyatlarining qidiruv bardoshliligida bo'lsa, u holda kirish xususiyatining turiga eng yuqori ustuvorlik mos keladi.
    • Agar kirish joyi kirish xususiyatlarining har qanday turiga bardoshli bo'lmasa, moslik qaytarilmaydi.

    FeatureTypes -ni turli xil stsenariylarda qanday ishlatish mumkinligini bilish uchun quyidagi misollarni ko'rib chiqing.

    featureTypes misoli: teskari geokod chorrahasi

    Ushbu misolda, biz StreetThere mosligini reverseGeocode so'rovi bilan qaytarish uchun featureTypes parametridan foydalanamiz. Bu misol yuqoridagi 6 -misol bilan bir xil kirish joyidan foydalanadi.

    featureTypes misoli: teskari geokod uzoq PointAddress

    Ushbu misolda, kirish joyi standart PointAddress qidirish bardoshligidan tashqarida bo'lganida, PointAddress xususiyatiga moslikni qaytarish uchun featureTypes parametridan foydalanamiz. PointAddress bu reverseGeocode so'rovidagi featureTypes parametriga kiritilgan yagona qiymat bo'lgani uchun, qidirish bardoshligi 500 metrni tashkil etadi, bu esa PointAddress -ning uzoqroq o'yinlarini qaytarish imkonini beradi.

    Bu holda, agar featureTypes so'rovga kiritilmagan bo'lsa, uning o'rniga Mahalliylik mosligi qaytariladi.

    featureTypes misoli: Bir nechta kiritish xususiyatiTypes qiymatlari

    FeatureTypes parametrini ishlatishning odatiy holati-bu manzillar bo'lmagan xususiyatlarga mos kelishni istisno qilish, buni functionTypes = PointAddress, StreetAddress-ni o'rnatish orqali amalga oshirish mumkin. Bu misolda kirish joyi POI va PointAddress xususiyatlarining qidiruv bardoshliligiga to'g'ri keladi, lekin POI mosligini istisno qilish uchun featureTypes ishlatilgani uchun PointAddressga moslik qaytariladi. Bu misol yuqoridagi 1 -misol bilan bir xil kirish joyidan foydalanadi.

    Bu holda, agar featureTypes so'rovga kiritilmagan bo'lsa, POI mosligi qaytariladi.


    Teskari geokodlash: Jahon geokod xizmati - Geografik axborot tizimlariga ulana olmaydi

    Geocoder - Ruby uchun geokodlashning to'liq echimi. Rails bilan u geokodirovkani (ko'cha yoki IP -manzil bo'yicha), teskari geokodlashni (berilgan koordinatalar bo'yicha ko'cha manzilini toping) va ActiveRecord ob'ektlari uchun masofani hisoblashni qo'shadi. Bu sizning ob'ektlaringizga geokodni chaqirish va Venue.near ("Billings, MT") kabi doiradan foydalanish kabi oddiy. Ma'lumotlar bazasi xususiy funktsiyalariga tayanilmagani uchun, ma'lum bir hududda geokodlangan ob'ektlarni qidirish PostgreSQL, MySQL va hatto SQLite bilan ishlaydi.

    Geokoder Ruby (MRI) 1.8.7, 1.9.2 va JRuby 1.5.3 bilan muvaffaqiyatli sinovdan o'tkazildi.

    Geocoder Rails 3 bilan mos keladi. Agar siz uni Rails 2 bilan ishlatishingiz kerak bo'lsa, iltimos, rails2 filialiga qarang (endi saqlanmagan, cheklangan funktsiyalar to'plami).

    va buyruq satrida ishga tushiring:

    Ob'ektning geokodirovkasini sozlash

    Kenglik va uzunlik koordinatalarini saqlash uchun sizning ob'ektingiz ikkita atributga (ma'lumotlar bazasi ustunlari) ega bo'lishi kerak. Odatiy bo'lib, ularni kenglik va uzunlik deb atash kerak, lekin uni o'zgartirish mumkin (quyida "Konfiguratsiya haqida batafsil" bo'limiga qarang):

    Teskari geokodlash uchun sizning modelingiz manzilni qaytaradigan usulni taqdim etishi kerak. Bu bitta atribut bo'lishi mumkin, lekin u har xil atributlardan (masalan: shahar, shtat va mamlakat) yig'ilgan satrni qaytaradigan usul bo'lishi mumkin.

    Sizning modelingizda Geocoder -ga ayting, qaysi usul ob'ektingizning to'liq manzilini qaytaradi:

    Teskari geokodlash uchun Geocoderga ayting, qaysi usullar kenglik va uzunlikni qaytaradi:

    Agar siz sinfga geokodlashni qo'shgan bo'lsangiz va mavjud ob'ektlar ko'p bo'lsa, bu Rake vazifasidan foydalanib, ularning barchasini geokodlash mumkin:

    Ma'lumotlar bazasi joylashuvi to'g'risida so'rovlar

    Ob'ektlarni joylashuvi bo'yicha topish uchun quyidagi maydonlardan foydalaning:

    Geokodlangan ob'ektlar yordamida siz shunday narsalarni qilishingiz mumkin:

    Ba'zi foydali usullar ham mavjud:

    Iltimos, qo'shimcha usullar va dalillar haqida batafsil ma'lumot olish uchun kodni ko'ring (masalan, kilometr bilan ishlash).

    Siz koordinatalarni saqlash uchun kenglik va uzunlik ma'lumotlar bazasi ustunlarining nomlarini ishlatishda qolib ketmaysiz. Masalan, lat va lonni ishlatish uchun:

    Manzil usuli Google Xaritalarni qidirishda ishlatadigan istalgan qatorni qaytarishi mumkin. Masalan, quyidagilardan biri qabul qilinadi:

    Agar sizning modelingiz ko'cha, shahar, shtat va mamlakat atributlariga ega bo'lsa, siz shunday qilishingiz mumkin:

    Teskari geokodlash uchun siz manzil saqlanadigan muqobil ism atributini ham belgilashingiz mumkin, masalan:

    Hozircha biz ob'ekt atributlariga geokodlash natijalarini belgilash uchun yorliqlarni ko'rib chiqdik. Ammo, agar siz xohlagan narsani qilishingiz kerak bo'lsa, siz ajratilgan geokodlash natijasini o'zingiz xohlagan usulda boshqaradigan blokni (ob'ektni geokodlash va Geocoder :: Result ob'ektini olish) ta'minlash orqali avtomatik topshiriqni o'tkazib yuborishingiz mumkin. :

    Har bir Geocoder :: Result ob'ekti, natijasi quyidagi ma'lumotlarni beradi:

    result.coordinates # yuqoridagi ikkita qator

    va agar siz foydalanayotgan geokodlash xizmati tomonidan qaytarilgan natijalar bilan tanish bo'lsangiz, undan ham ko'proq kirishingiz mumkin (tafsilotlar uchun kod izohlariga qarang: lib/geocoder/results/*).

    Odatiy bo'lib, Geocoder koordinatalar va manzillarni olish uchun Google -ning geokodlash API -dan foydalanadi. Agar siz Yahoo -ning geokodlash API -dan foydalanmoqchi bo'lsangiz, uni boshlang'ichga qo'shishingiz mumkin:

    Yahoo ilovasining identifikatorini olish uchun quyidagi manzilga o'ting:

    E'tibor bering, har xil geokod xizmatlari tomonidan qaytarilgan natija ob'ektlari yuqorida sanab o'tilgan usullarni qo'llaydi. Bundan tashqari, siz o'zingizning Geocoder :: Result kichik sinfini va geokodlash xizmatining natijalar tuzilishini bilishingiz kerak:

    Siz geokodlash xizmatiga ulanish uchun ishlatiladigan vaqtni belgilashingiz mumkin. Standart - 3 soniya, lekin agar siz uni 5 ga o'rnatmoqchi bo'lsangiz, quyidagilarni boshlangichga qo'ying:

    Siz teskari geokodlash natijalari uchun ishlatiladigan tilni nemis tiliga o'rnatishingiz mumkin, masalan:

    Qo'llab -quvvatlanadigan tillar ro'yxati uchun siz foydalanayotgan geokodlash xizmati hujjatlarini ko'ring.

    Xuddi shu modelda oldinga va teskari geokodlash

    Agar siz bir xil modelga oldinga yoki teskari geokodlash funksiyasini qo'llasangiz (aytaylik, foydalanuvchilar manzil yoki koordinatalarni taqdim etishlari mumkin va siz etishmayotgan narsalarni to'ldirishni xohlaysiz), siz ikkita manzil usulini taqdim etasiz:

    olingan manzilni saqlash uchun bittasi (teskari geokodlash)

    koordinatalarni olishda foydalanish uchun manzilni ko'rsatish uchun (oldinga geokodlash)

    Biroq, kenglik/uzunlik atributlarining faqat bitta to'plami bo'lishi mumkin va siz oxirgi ko'rsatganingizdan foydalaniladi. Misol uchun:

    Buning sababi shundaki, biz masofani hisoblashda noaniqlikni xohlamaymiz. Bizga koordinatalar uchun yagona, obro'li manba kerak!

    IP -manzil bo'yicha geokodlashni so'rang

    Geocoder standart Rack :: Request ob'ektiga joylashuv usulini qo'shadi, shunda siz har qanday HTTP so'rovining manzilini IP -manzil orqali osongina topishingiz mumkin. Masalan, Rails kontrollerida yoki Sinatra ilovasida:

    Geocoder -ni Rails tashqarisida Geocoder.search usuliga qo'ng'iroq qilib ishlatishingiz mumkin:

    Bu Geocoder :: Result ob'ektini, geokodlash xizmati tomonidan taqdim etilgan barcha ma'lumotlarni qaytaradi. Tafsilotlar uchun yuqoridagi va kodni ko'ring.

    SQLite -dagi masofaviy so'rovlar

    SQLite -ning trigonometrik funktsiyalarining etishmasligi yaqin doirani muqobil ravishda amalga oshirishni talab qiladi. SQLite -dan foydalanganda Geocoder avtomatik ravishda ma'lum bir nuqtaga yaqin ob'ektlarni topish uchun kamroq aniq algoritmdan foydalanadi. Bu algoritm natijalariga juda ishonmaslik kerak, chunki u berilgan radiusdan tashqaridagi ob'ektlarni qaytaradi.

    Trig funktsiyasiz nuqtalar orasidagi masofani hisoblash ham mumkin emas, shuning uchun natijalarni "yaqinlik" bo'yicha saralash mumkin emas.

    SQLite -da ma'lum bir nuqtaga yaqin kengaytmalarni o'rnatmasdan ob'ektlarni topish uchun bir nechta variant mavjud:

    Yaqin nuqtalarni topish uchun doira o'rniga kvadratdan foydalaning. Masalan, agar siz 40.71, 100.23 yaqinidagi nuqtalarni topmoqchi bo'lsangiz, kengligi 39.71 dan 41.71 gacha va uzunligi 99.23 dan 101.23 gacha bo'lgan ob'ektlarni qidiring. Bir darajali kenglik yoki uzunlik maksimal 69 milni tashkil qiladi, shuning uchun yuqori va pastki chegaralarni olish uchun markaz koordinatalarini qo'shish va olib tashlash miqdorini olish uchun radiusingizni (milga) 69.0 ga bo'ling. Natijalar unchalik aniq bo'lmaydi (siz kerakli radiusdan tashqarida ochko olasiz - eng yomoni 29% uzoqroqda), lekin siz barcha nuqtalarni kerakli radiusda olasiz.

    Geocoder :: Calculations.distance_between usuli yordamida barcha ob'ektlarni xotiraga yuklang va ular orasidagi masofani hisoblang. Bu aniq natijalar beradi, lekin ma'lumotlar bazasida juda ko'p ob'ektlar bo'lsa, juda sekin bo'ladi (va ko'p xotira ishlatiladi).

    Agar sizda ko'p sonli ob'ektlar bo'lsa (shuning uchun siz №2 yondashuvni ishlata olmaysiz) va sizga aniq natijalar kerak (1 -yondashuvdan yaxshiroq), siz ikkalasining kombinatsiyasidan foydalanishingiz mumkin. O'zingizning markaziy nuqtangiz atrofidagi kvadrat ichidagi barcha narsalarni oling va Geocoder :: Calculations.distance_between yordamida juda uzoqdagi narsalarni olib tashlang.

    Geocoder bu funktsiyani ko'lam sifatida taqdim etishi kerakligi sababli, biz #1 -variantni tanlashimiz kerak, lekin agar sizga aniqlik kerak bo'lsa, #2 yoki #3 -ni ishlatishga jur'at eting.

    Siz yaqin doirani qo'shish opsiyasini taqdim etadigan boshqa doirada ishlata olmaysiz, chunki yaqin tomonidan yaratilgan SELECT bandi uning ustiga yozadi (yoki aksincha). Buning o'rniga, birlashmalarni ishlatib ko'ring va kerakli ustunlarni olish uchun a: variantni yaqin doiraga o'tkazing. Masalan, Rails 2 sintaksisida:

    Agar kimdir bu muammoning yanada oqilona echimiga ega bo'lsa, men uni ko'rishga juda qiziqaman.


    BigDataCloud -ning teskari teskari geokodlashining afzalliklari

    • Ma'muriy/ma'muriy bo'lmagan chegaralarga asoslangan natijalarni beradi
    • Foydalanuvchi haqida batafsil ma'lumot beradi
    • AQSh, Buyuk Britaniya va Avstraliya uchun pochta indeksi aniqligi.
    • Juda tez javob berish vaqti (millisekund)
    • 147 umumiy dunyo tillarini qo'llab -quvvatlaydi.
    • City API-ga cheksiz mijozlar tomonidan teskari geokodlash
    • Qulay server tomonidagi teskari geokodlash API

    Shunday qilib, real vaqtda va aniq foydalanuvchi joylashuviga muhtoj bo'lgan har qanday ishlab chiquvchilar uchun BigDataCloud-bu mukammal echim.


    Sintaksis

    Nuqtalar xususiyati sinfi yoki qatlami, bu joylarning xususiyatlarining joylashuviga qarab qaytariladi.

    Kirish funktsiyasi sinfining geokodini teskari o'zgartirish uchun manzilni aniqlash moslamasi.

    Meros:

    Joylashuvlar fayllar papkasida saqlanishi kerak, shuning uchun siz geodatabazalarda saqlanadigan joylashuvlar uchun qo'llab -quvvatlanmaydigan, masalan, ish faoliyatini yaxshilash, ko'p ishlov berish imkoniyatlari va takliflarni qo'llab -quvvatlash kabi yangi xususiyatlardan foydalanasiz. ArcGIS 10.4 - geodatabazalarda lokatorlarni saqlashni qo'llab -quvvatlovchi oxirgi versiya.

    Agar manzilni aniqlash moslamasi kesishgan moslikni qo'llab -quvvatlasa, nuqta uchun manzilni ko'cha manzili yoki chorrahaning manzili sifatida qaytarish kerakligini ko'rsatadi.

    • MANZIL - Ko'cha manzillarini yoki kirish manzilini aniqlovchi tomonidan belgilangan formatda qaytadi. Bu standart variant.
    • INTERSECTION - kesishgan manzillarni qaytaradi. Agar manzilni aniqlash mos keladigan kesishuv manzillarini qo'llab -quvvatlasa, bu variant mavjud.

    Nuqta joylashuvi uchun eng yaqin manzil yoki chorrahani qidirish uchun ishlatiladigan masofa. Ba'zi lokatorlar qidiruv masofasi parametrini bekor qilishni qo'llab -quvvatlamaydigan optimallashtirilgan masofa qiymatlaridan foydalanadilar.

    Qaytarilishi mumkin bo'lgan o'yin turlarini cheklaydi. Bitta yoki bir nechta qiymatlarni tanlash mumkin. Agar bitta qiymat tanlansa, kirish funktsiyasi turini qidirish bardoshligi 500 metrni tashkil qiladi. Agar bir nechta qiymatlar kiritilgan bo'lsa, funktsiyalar turidagi ierarxiya jadvalida ko'rsatilgan standart qidirish masofalari qo'llaniladi. ReverseGeocode uchun featureTypes parametri haqida batafsil ma'lumot olish uchun REST API veb -yordamiga qarang.

    Bu parametr hamma lokatorlar uchun qo'llab -quvvatlanmaydi.

    Agar parametr uchun bir nechta qiymat ko'rsatilgan bo'lsa, qiymatlarni vergul bilan ajratish kerak, verguldan keyin bo'sh joy yo'q.

    • POINT_ADDRESS - uylar va binolarning joylashishini ko'rsatadigan nuqtalarga asoslangan ko'cha manzili.
    • STREET_ADDRESS - POINT_ADDRESS -dan farqli ko'cha manzili, chunki uy raqami raqamlar oralig'idan interpolyatsiya qilingan. STREET_ADDRESS mosliklari interpolatsiyalangan uy raqami qiymatini emas, balki mos keladigan ko'cha segmentining uy raqamlarini o'z ichiga oladi.
    • STREET_INTERSECTION - shahar va ixtiyoriy davlat va pochta indeksi ma'lumotlari bilan birga ko'cha chorrahasidan iborat ko'cha manzili. Bu STREET_ADDRESS ma'lumot ma'lumotlaridan olingan, masalan, Redlands Blvd & New York St, Redlands, CA, 92373.
    • STREET_NAME - STREET_ADDRESSga o'xshash, lekin uy raqamlari bo'lmagan, ma'muriy bo'linmalar va ixtiyoriy pochta indeksi bo'lmagan, masalan, W Olive Ave, Redlands, CA, 92373.
    • LOCALITY-aholi yashaydigan joyni ifodalovchi joy nomi.
    • POSTAL - pochta indeksi. Malumot ma'lumotlari pochta indeksi nuqtalari, masalan, 90210 AQSh.
    • POINT_OF_INTEREST —Points of interest. Reference data consists of administrative division place-names, businesses, landmarks, and geographic features, for example, Starbucks.
    • DISTANCE_MARKER —A street address that represents the linear distance along a street, typically in kilometers or miles, from a designated origin location, for example, Mile 25 I-5 N, San Diego, CA.

    This parameter is available for locators that support the locationType parameter. It specifies the preferred output geometry for PointAddress matches. The options for this parameter are a side-of-street location that can be used for routing, or the location that represents the rooftop or parcel centroid for the address. If the preferred location does not exist in the data, the default location will be returned instead. For geocode results with Addr_type=PointAddress , the X,Y attribute values describe the coordinates of the address along the street, while the DisplayX and DisplayY values describe the rooftop, or building centroid, coordinates. See the REST API web help for more details about the locationType parameter for reverseGeocode .

    This parameter is not supported for all locators.

    • ADDRESS_LOCATION —Returns geometry for geocode results that could represent an address location such as rooftop, building centroid, or front door.
    • ROUTING_LOCATION —Returns geometry for geocode results that represent a location close to the side of the street, which can be used for vehicle routing. Bu standart.

    Reverse Geocoding: cannot connect to World Geocode Service - Geographic Information Systems

    Geocoder is a complete geocoding solution for Ruby. With Rails it adds geocoding (by street or IP address), reverse geocoding (find street address based on given coordinates), and distance queries. It's as simple as calling geocode on your objects, and then using a scope like Venue.near("Billings, MT") .

    Supports multiple Ruby versions: Ruby 1.8.7, 1.9.2, and JRuby.

    Supports multiple databases: MySQL, PostgreSQL, SQLite, and MongoDB (1.7.0 and higher).

    Supports Rails 3. If you need to use it with Rails 2 please see the rails2 branch (no longer maintained, limited feature set).

    Works very well outside of Rails, you just need to install either the json (for MRI) or json_pure (for JRuby) gem.

    and run at the command prompt:

    Configure Object Geocoding ¶ ↑

    In the below, note that addresses may be street or IP addresses.

    Your model must have two attributes (database columns) for storing latitude and longitude coordinates. By default they should be called latitude and longitude but this can be changed (see “More on Configuration” below):

    For reverse geocoding your model must provide a method that returns an address. This can be a single attribute, but it can also be a method that returns a string assembled from different attributes (eg: city , state , and country ).

    Next, your model must tell Geocoder which method returns your object's geocodable address:

    For reverse geocoding, tell Geocoder which attributes store latitude and longitude:

    First, your model must have an array field for storing coordinates:

    You may also want an address field, like this:

    but if you store address components (city, state, country, etc) in separate fields you can instead define a method called address that combines them into a single string which will be used to query the geocoding service.

    Once your fields are defined, include the Geocoder::Model::Mongoid module and then call geocoded_by :

    Reverse geocoding is similar:

    Be sure to read Latitude/Longitude Order ichida Notes on MongoDB section below on how to properly retrieve latitude/longitude coordinates from your objects.

    MongoMapper is very similar to Mongoid, just be sure to include Geocoder::Model::MongoMapper .

    If you have just added geocoding to an existing application with a lot of objects you can use this Rake task to geocode them all:

    Geocoder will print warnings if you exceed the rate limit for your geocoding service.

    Request Geocoding by IP Address ¶ ↑

    Geocoder adds a location method to the standard Rack::Request object so you can easily look up the location of any HTTP request by IP address. For example, in a Rails controller or a Sinatra app:

    See “Advanced Geocoding” below for more information about Geocoder::Result objects.

    Location-Aware Database Queries ¶ ↑

    To find objects by location, use the following scopes:

    With geocoded objects you can do things like this:

    Some utility methods are also available:

    Please see the code for more methods and detailed information about arguments (eg, working with kilometers).

    When you run a location-aware query the returned objects have two attributes added to them (only w/ ActiveRecord):

    obj.distance - number of miles from the search point to this object

    obj.bearing - direction from the search point to this object

    Results are automatically sorted by distance from the search point, closest to farthest. Bearing is given as a number of clockwise degrees from due north, for example:

    You can convert these numbers to compass point names by using the utility method provided:

    Note: when using SQLite distance and bearing values are provided for interface consistency only. They are not very accurate.

    To calculate accurate distance and bearing with SQLite or MongoDB:

    The bearing_from/to methods take a single argument which can be: a [lat,lon] array, a geocoded object, or a geocodable address (string). The distance_from/to methods also take a units argument ( :mi or :km ).

    You are not stuck with using the latitude and longitude database column names (with ActiveRecord) or the coordinates array (Mongo) for storing coordinates. Misol uchun:

    The address method can return any string you'd use to search Google Maps. For example, any of the following are acceptable:

    If your model has street , city , state , and country attributes you might do something like this:

    For reverse geocoding you can also specify an alternate name attribute where the address will be stored, for example:

    So far we have looked at shortcuts for assigning geocoding results to object attributes. However, if you need to do something fancy you can skip the auto-assignment by providing a block (takes the object to be geocoded and an array of Geocoder::Result objects) in which you handle the parsed geocoding result any way you like, for example:

    Every Geocoder::Result object, result , provides the following data:

    result.coordinates - array of the above two

    If you're familiar with the results returned by the geocoding service you're using you can access even more data, but you'll need to be familiar with the particular Geocoder::Result object you're using and the structure of your geocoding service's responses. (See below for links to geocoding service documentation.)

    By default Geocoder uses Google's geocoding API to fetch coordinates and street addresses (FreeGeoIP is used for IP address info). However there are several other APIs supported, as well as a variety of settings. Please see the listing and comparison below for details on specific geocoding services (not all settings are supported by all services). The configuration options are:

    The following is a comparison of the supported geocoding APIs. The “Limitations” listed for each are a very brief and incomplete summary of some special limitations beyond basic data source attribution. Please read the official Terms of Service for a service before using it.

    optional (required for Premier)

    2,500 requests/day, 100,000 with Google Maps API Premier

    ar, eu, bg, bn, ca, cs, da, de, el, en, en-AU, en-GB, es, eu, fa, fi, fil, fr, gl, gu, hi, hr, hu, id, it, iw, ja, kn, ko, lt, lv, ml, mr, nl, no, pl, pt, pt-BR, pt-PT, ro, ru, sk, sl, sr, sv, tl, ta, te, th, tr, uk, vi, zh-CN, zh-TW (see spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1)

    “You must not use or display the Content without a corresponding Google map, unless you are explicitly permitted to do so in the Maps APIs Documentation, or through written permission from Google.” “You must not pre-fetch, cache, or store any Content, except that you may store: (i) limited amounts of Content for the purpose of improving the performance of your Maps API Implementation…”

    To use Google Premier set Geocoder::Configuration.lookup = :google_premier and Geocoder::Configuration.api_key = [key, client, channel] .

    optional in development (required for production apps)

    50,000 requests/day, more available by special arrangement

    “YOU SHALL NOT… (viii) store or allow end users to store map imagery, map data or geocoded location information from the Yahoo! Maps APIs for any future use (ix) use the stand-alone geocoder for any use other than displaying Yahoo! Maps or displaying points on Yahoo! Maps”

    No country codes or state names. Must be used on “public-facing, non-password protected web sites,” “in conjunction with Bing Maps or an application that integrates Bing Maps.”

    Please limit request rate to 1 per second and include your contact information in User-Agent headers. Data licensed under CC-BY-SA (you must provide attribution).

    Russian, Belarusian, and Ukrainian

    “Under no circumstances can our data be re-distributed or re-sold by anyone to other parties without our written permission.”

    It's a good idea, when relying on any external service, to cache retrieved data. When implemented correctly it improves your app's response time and stability. It's easy to cache geocoding results with Geocoder, just configure a cache store:

    This example uses Redis, but the cache store can be any object that supports these methods:

    store#[](key) - retrieves a value

    store#[]=(key, value) - stores a value

    store#keys - lists all keys

    Even a plain Ruby hash will work, though it's not a great choice (cleared out when app is restarted, not shared between app instances, etc).

    You can also set a custom prefix to be used for cache keys:

    By default the prefix is geocoder:

    If you need to expire cached content:

    Qil emas include the prefix when passing a URL to be expired. Expiring :all will only expire keys with the configured prefix (won't kill every entry in your key/value store).

    Before you implement caching in your app please be sure that doing so does not violate the Terms of Service for your geocoding service.

    Forward and Reverse Geocoding in the Same Model ¶ ↑

    If you apply both forward and reverse geocoding functionality to the same model (say users can supply an address or coordinates and you want to fill in whatever's missing), you will provide two address methods:

    one for storing the fetched address (reverse geocoding)

    one for providing an address to use when fetching coordinates (forward geocoding)

    However, there can be only one set of latitude/longitude attributes, and whichever you specify last will be used. Misol uchun:

    The reason for this is that we don't want ambiguity when doing distance calculations. We need a single, authoritative source for coordinates!

    You can use Geocoder outside of Rails by calling the Geocoder.search method:

    This returns an array of Geocoder::Result objects with all information provided by the geocoding service. Please see above and in the code for details.

    When you install the Geocoder gem it adds a geocode command to your shell. You can search for a street address, IP address, postal code, coordinates, etc just like you can with the Geocoder.search method for example:

    There are also a number of options for setting the geocoding API, key, and language, viewing the raw JSON reponse, and more. Please run geocode -h for details.

    Mongo document classes (Mongoid and MongoMapper) have a built-in near scope, but since it only works two-dimensions Geocoder overrides it with its own spherical near method in geocoded classes.

    Coordinates are generally printed and spoken as latitude, then logitude ([lat,lon]). Geocoder respects this convention and always expects method arguments to be given in [lat,lon] order. However, MongoDB requires that coordinates be stored in [lon,lat] order as per the GeoJSON spec (geojson.org/geojson-spec.html#positions), so internally they are stored “backwards.” However, this does not affect order of arguments to methods when using Mongoid or MongoMapper.

    To access an object's coordinates in the conventional order, use the to_coordinates instance method provided by Geocoder. Misol uchun:

    Calling obj.coordinates directly returns the internal representation of the coordinates which, in the case of MongoDB, is probably the reverse of what you want:

    For consistency with the rest of Geocoder, always use the to_coordinates method instead.

    Distance Queries in SQLite ¶ ↑

    SQLite's lack of trigonometric functions requires an alternate implementation of the near scope. When using SQLite, Geocoder will automatically use a less accurate algorithm for finding objects near a given point. Results of this algorithm should not be trusted too much as it will return objects that are outside the given radius, along with inaccurate distance and bearing calculations.

    There are few options for finding objects near a given point in SQLite without installing extensions:

    Use a square instead of a circle for finding nearby points. For example, if you want to find points near 40.71, 100.23, search for objects with latitude between 39.71 and 41.71 and longitude between 99.23 and 101.23. One degree of latitude or longitude is at most 69 miles so divide your radius (in miles) by 69.0 to get the amount to add and subtract from your center coordinates to get the upper and lower bounds. The results will not be very accurate (you'll get points outside the desired radius), but you will get all the points within the required radius.

    Load all objects into memory and compute distances between them using the Geocoder::Calculations.distance_between method. This will produce accurate results but will be very slow (and use a lot of memory) if you have a lot of objects in your database.

    If you have a large number of objects (so you can't use approach #2) and you need accurate results (better than approach #1 will give), you can use a combination of the two. Get all the objects within a square around your center point, and then eliminate the ones that are too far away using Geocoder::Calculations.distance_between .

    Because Geocoder needs to provide this functionality as a scope, we must go with option #1, but feel free to implement #2 or #3 if you need more accuracy.

    Geocoder comes with a test suite (just run rake test ) that mocks ActiveRecord and is focused on testing the aspects of Geocoder that do not involve executing database queries. Geocoder uses many database engine-specific queries which must be tested against all supported databases (SQLite, MySQL, etc). Ideally this involves creating a full, working Rails application, and that seems beyond the scope of the included test suite. As such, I have created a separate repository which includes a full-blown Rails application and some utilities for easily running tests against multiple environments:

    By default Geocoder will rescue any exceptions raised by calls to the geocoding service and return an empty array (using warn() to inform you of the error). You can override this and implement custom error handling for certain exceptions by using the :always_raise option:

    You cannot use the near scope with another scope that provides an includes option because the SELECT clause generated by near will overwrite it (or vice versa). Instead, try using joins and pass a :select option to the near scope to get the columns you want. Misol uchun:

    If anyone has a more elegant solution to this problem I am very interested in seeing it.


    Pricing: What Does Geocoding with JoinAddress Cost?

    In terms of prices, there are differences between JoinAddress as a locally installed version (On Premise) and JoinAddress as the online version.

    Prices for Online Geocoding

    Narxlar uchun Online Geocoding with JoinAddress is based on volumes. Depending on how many addresses you want to geocode, choose the appropriate volume. There is no expiry date. Agar sizda bo'lsa sotib olingan a volume, you can redeem it indefinitely.
    After registering and the free trial, choose one of the following volumes:

    Number of Addresses
    Price in €
    1.000 adresses150,-
    5.000 adresses
    600,-
    10.000 adresses990,-
    25.000 adresses
    1.290,-
    50.000 adresses1.890,-
    100.000 adresses
    2.890,-
    200.000 adresses3.390,-
    500.000 adresses
    6.390,-

    The above prices are net prices. Customers and businesses in Austria must pay 20% VAT. Companies from EU countries who provide their UID number do not have to pay any VAT. Private customers from EU countries must pay the applicable VAT for their country of origin. Businesses and private customers outside the EU do not have to pay any VAT.

    Prices for a Locally Installed Geocoder (On Premise)

    Agar Siz o'rnating JoinAddress locally in the company, The price depends on your requirements. The following omillar contribute to the narx:

    • Internationality of your addresses: Would you like to geocode addresses from just one country or from multiple countries and regions?
    • Raqam ning licenses/users required
    • Raqam ning interfaces to databases required
    • Extension for ArcGIS
    • Plugin for QGIS
    • Maintenance contract (if required)
    • Special requests

    Talk to us: Biz are happy to provide consulting as to which constellation will be best to geocode sizning address lists effectively and efficiently. Many of our customers have installed JoinAddress locally, but also use the online geocoder. We will help you calculate which solution is best for you. We see this as a service and our duty.


    Misol

    rgeocodio allows you to access the Geocodio platform in R studio. Instead of the steps mentioned above you can use the rgeocodio to perform the same functions.

    In order to install rgeocodio you will need to load the devtools package. Install it if you haven’t already install.packages("devtools") . Once devtools is loaded run: devtools::install_github('hrbrmstr/rgeocodio') .

    rgeocodio uses an API that you can get from the geocodio website. To get an API visit geocodio’s website. Then save it in your Renviron.

    To save the API in your Renvrion:

    1. Ni oching Renviron by running usethis::edit_r_environ()
    2. Once you are in the Renviron name and save the API you got from Geocodio. Maybe something like:
    1. Save your Renviron and then restart your R session just to be sure that the API is saved.

    Now that you have your API saved in R you still need to authorize the API in your R session. Do so by running gio_auth() .

    A quick note, force makes you set a new geocodio API key for the current environment. In general you will want to run force=F . Lets try a regeocodio example. Say you want to get the coordinates of the White House. You could run:

    Most of these variables are intuitive but I want to spend a few seconds on accuracy va accuracy type which we can learn more about here.

    Accuracy: because geocodio is interpolating the output will tell you how confident geocodio is in its estimation. Anything below 0.8 should be considered not accurate enough, but that is up to the user.

    Accuracy Type: interpolation uses the closest know geocodes. So if the closest geocodes are, for instance two ends of a street and you are trying to geocode a location somewhere on that street then the accuracy type will be “street.” In this case the accuracy type is “rooftop” which means the buildings on either side of the location were used to interpolate your query. Again, smartystreets has a good explanation of this.

    What if we want to geocode a bunch of addresses at once? To geocode multiple addresses at once we will use gio_batch_geocode . The data that we enter will need to be a character vector of addresses.

    You will notice that the output is a list with dataframes of the results embedded. There are a number of ways to extract the relevant data but one approach would be:

    Reverse geocoding uses gio_reverse and gio_batch_reverse .

    For gio_reverse you submit a longitude-latitude pair:

    For gio_batch_reverse we will submit a vector of numeric entries ordered by c(longitude, latitude):

    Notice that the output gives us multiple accuracy types.

    What about geocoding the rest of the world, chico?

    gasp Geocodio only works, from my understanding, in the United States and Canada. We would need to use a different service like Google’s geocoder to do the rest of the world.