Yandex.Maps APIã䜿çšããéçºè
ã«ã¯ãå€ãã®å Žåãå°å³äžã«å€ãã®ãªããžã§ã¯ãã衚瀺ããã¿ã¹ã¯ããããŸãã æ¬åœã«ãããã-çŽ10,000ãããã«ããã®ã¿ã¹ã¯ã¯ç§ãã¡èªèº«ã«ãé¢é£ããŠããŸã-Yandexã§è¬å±ãæ¢ããŠã¿ãŠãã ããã äžèŠãããšããããããããå®éã«åé¡ã¯äœã§ããïŒ æã£ãŠè¡ã£ãŠèŠããŠãã ãããã ãããããããéå§ãããŸã§ãåé¡ãå®éã«è»å
šäœã§ããããšãç解ããããšã¯ã§ããŸããã
ããããŸããã»ã©ã®èŠåæ§ãåããå€æ°ã®ã¿ã°ã«é¢ãã質åã¯ãã¯ã©ããšæè¡ãµããŒãã«å¯ããããŸãã ãããã®äººã
ã¯èª°ã§ããïŒ å°å³ã«10å以äžã®ã¿ã°ã衚瀺ããããšã«èå³ããã人ã¯ããŸããïŒ ãã®æçš¿ã§ã¯ãåé¡ã®å
šäœã詳ããèŠãŠãéçºè
ããããäžã«å€æ°ã®ãªããžã§ã¯ããæé©ã«è¡šç€ºããã®ã«åœ¹ç«ã€ããŒã«ãAPIã«ã©ã®ããã«ç»å Žãããã説æããŸãã
ã»ãšãã©ã®å ŽåãããŒã¿ããããã«ãã€ã³ãããæ
å ±ãµãŒãã¹ãåé¡ã«çŽé¢ããŠããŸãã ããšãã°ãbankomator.ruãµã€ãã¯ãéè¡ã®ATMã®å ŽæããŠãŒã¶ãŒã«äŒããŸãã
äžåç£ãªãœãŒã¹ãå€ãã®ããŒã¿ã«èŠããã§ããŸãã é¡èãªäŸã¯Cian.ruã§ãã
æè¿ãŸã§ãYandexå
ã§ã¯ãAPIãä»ããŠè€æ°ã®ãã€ã³ãã衚瀺ããããã®ããŸããŸãªãããã¯ããšããªãã¯ãé¢é£ããŒã ã«ã¢ããã€ã¹ããŠããŸããã é®®ãããªäŸã¯ãYandex.Real Estateããã³Yandex.Taxiã§ãã
ãã€ã³ã1.åé¡èªäœã¯äœã§ããïŒ
ã¿ã¹ã¯ã®é倧床ãæããã«ã¯ãããã解決ããããšããå¿
èŠããããŸãã ãŸãããµãŒãã¹ã®ããŒãžã«å°å³ã衚瀺ããæ¹æ³ãç解ããŸãããã ç°¡åãªã¹ããŒã ãèããŠã¿ãŸãããïŒ
ã¯ã©ã€ã¢ã³ãïŒiPhoneã®Safariãªã©ïŒã¯ããµãŒããŒã«index.htmlããŒãžãèŠæ±ããŸãã ãã®ããŒãžã¯ã次ã®ã³ãŒããå«ãããã¥ã¡ã³ãã§ãã
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="//api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script> <script type="text/javascript"> ymaps.ready(init); function init () { var myMap = new ymaps.Map('map', { center: [55.76, 37.64], zoom: 10 }); } </script> </head> <body> <div id="map"></div> </body>
次ã«ãã¿ã¹ã¯ãè€éã«ããŸãã Zenitãã¡ã³ã®äœæãä¿åããããŒã¿ããŒã¹ããããŸãã ãããŠããããã®ãã¡ã³ã®äœæãå°å³äžã«è¡šç€ºããããšæããŸãã
ãæ£é¢ãã®åé¡ã®è§£æ±ºçïŒ
- ããŒã¿ããŒã¹ããéžæãã10åã®ã¢ãã¬ã¹ãååŸããŸãã
- 10ååã®ã¢ãã¬ã¹å
šäœãå«ãé
åãindex.htmlãã¡ã€ã«ã«è¿œå ããŸãã
- ãã®ãã¡ã€ã«ãã¯ã©ã€ã¢ã³ãã«è»¢éããŸãã
- ã¯ã©ã€ã¢ã³ãã§ã¯ãé
åã®ããŒã¿ã䞊ã¹æ¿ããŠãåèŠçŽ ã®ãããäžã«ã©ãã«ãæç»ããŸãã
ããªãããããžã§ã¯ããããŒãžã£ãŒã§ãããéçºè
ããã®ãããªãœãªã¥ãŒã·ã§ã³ãå®èšŒããŠããå Žåãããããããªãã¯ç°è²ã«å€ããã§ãããã ããªãã¯åœŒã«ããªãã®äŸ¡å€å€æãäžããã§ãããã ãããã€ãªèšèãåé€ããå Žåã次ã®ç¹ã匷調ã§ããŸãã
- index.htmlãã¡ã€ã«ã®ééãæ°MBã«å¢å ãããŠãŒã¶ãŒã®ããŒãžãæ°ç§ééããŸãã
- ã¢ã¹ã¯ã¯ã®ã¿ã°ã®ã¿ã衚瀺ããå¿
èŠãããå ŽåããªãããŒã¿ããŒã¹å
šäœãã¯ã©ã€ã¢ã³ãã«è»¢éããã®ã§ããïŒ
- 人ã10åã®1ããèŠããªãã®ã«ããªãå°å³ã«ãã¹ãŠã®ããŒã¯ãæãã®ã§ããïŒ
- éåžžã®æ¹æ³ã§çŽ100ã200åã®ã¿ã°ããããã«æç»ãããšããããã®é床ãäœäžããŸãã
- ãã£ãã«ãè©°ãŸããããã©ãŠã¶ããããã®ã¿ã°ãæç»ããæéãããããã«ãã¿ã°ããããã§åŸã
ã«ããŒãã§ããŸããïŒ
æèã«ã¯2ã€ã®æ¹åããããŸãã
- ãŠãŒã¶ãŒã«è¡šç€ºãããããŒã¿ã決å®ããå¿
èŠãªãã®ã ããèŠæ±ã§ããããã«ããå¿
èŠããããŸãã
- ãããå¿
èŠã«ãªã£ãããæé©ã«æç»ããå¿
èŠããããŸãã
çŸå¹ŽåãAPIã¯Yandex.Map APIã§éçºããããããã®åé¡ïŒã¢ã¯ãã£ããšãªã¢ã®ãã¯ãããžãŒïŒã解決ããŸããã 詳现ã«ã€ããŠã¯
ãéçºè
ã¬ã€ããã芧
ãã ãã ã
ç°¡åã«èª¬æãããšããµãŒããŒäžã®ã¿ã°ã«å ããŠã¿ã°ã®ããã¹ã説æãå«ãéæãªç»åãçæããŸãã ã¯ã©ã€ã¢ã³ãã¯ããããã®è¡šç€ºé åãç£èŠãããããã®çŸåšã®è¡šç€ºé åã«å¿
èŠãªããŒã¿ãèŠæ±ã§ããŸãã
ããšãã°ããããã¹ãããã䜿çšãããšãmaps.yandex.ruã«æžæ»ãæãããŸãã ãµã€ãbankomator.ruã¯ãåããã¯ãããžãŒã䜿çšããŠäœæãããŸããã
ãã®æè¡ã«ã¯ããã€ãã®é倧ãªæ¬ ç¹ããããŸãã
1.
éåžžã«è€éãªãµãŒããŒåŽã ãã®ãããªåçãšãã®å¹ŸäœåŠçãªèª¬æãçæããã¢ãžã¥ãŒã«ãèªç±ã«äœæããŠã¿ãŠãã ããããã¹ãŠç解ã§ããŸãã
2.
絶察çãªæè»æ§ã ããŒã¯ããããŒãããšãã«ããŒã¯ããäžãããããšã¯ã§ããŸããã ã¯ã©ã€ã¢ã³ãäžã®ã©ãã«ã®å€èŠ³ããã°ããå€æŽããããšã¯ã§ããŸããã èŠããã«ããããã¿ã®å Žåã¯ããµãŒããŒã«ç»åãåçæããããã«äŸé Œããå¿
èŠããããŸãã
ãããã£ãŠããŠãŒã¶ãŒã¯ãããã¹ããããªãã§å¯èœãªéãã¹ãã³ããŸãããã¿ã€ã ã¢ãŠããä»ããŠãåã
ã®ãªããžã§ã¯ãã®ã»ããããããã§ã¯ã©ã€ã¢ã³ãã«è»¢éããŸããã åæã«ãã¯ã©ã€ã¢ã³ãäžã§åã³åé¡ãåŸ
ã£ãŠããŸããã ã¯ã©ã€ã¢ã³ãã«1000ãã€ã³ããæž¡ããå Žåãããããã©ã®ããã«æç»ããŸããïŒ
åãã€ã³ãããã
ymaps.Placemark
ãªããžã§ã¯ããçæããŠãããã«è¿œå ããå¿
èŠããããŸããã ã¿ã°ãã¯ã©ã¹ã¿ãŒåïŒ
ymaps.Clusterer
ïŒã«è¿œå ããã¯ã©ã¹ã¿ãŒåãããã¿ã°ããããã«è¿œå ã§ããŸãã 10,000ãã€ã³ããã¯ã©ã¹ã¿ãªã³ã°ããå ŽåããŸããããã®10,000ãã€ã³ããã€ã³ã¹ã¿ã³ã¹åããŠãããããããã¯ã©ã¹ã¿ãŒåããŒã«ã«è»¢éããå¿
èŠãããããšã«æ³šæããŠãã ããã ã€ãŸããã©ãã«ã¯ã¯ã©ã¹ã¿ãŒã«å
¥ããããããäžã«è¡šç€ºãããªãå ŽåããããŸãããããã§ãåæåã«ã¯æéãããããŸãã
ããããã¹ãŠã®åé¡ããŸãšãããšã次ã®ããšãå¯èœã«ããã¢ãžã¥ãŒã«ãäœæããããšã«ããŸããã
- ã¯ã©ã€ã¢ã³ãäžã«å€æ°ã®ãã€ã³ãããã°ããç°¡åã«æç»ããŸãã
- ã¯ã©ã€ã¢ã³ãäžã®ãã€ã³ããæäœãããšãã¯ãäžèŠãªåæåãé¿ããŠãã ããã
- å³å¯ã«ãªã³ããã³ãã§ã¯ã©ã€ã¢ã³ãã«ããŒã¿ãã¢ããããŒãããŸãã
ãããŠããããã£ãã
ç§ãã¡ã¯ã¢ã¶ã©ã·ã§ãããã€ã³ã2.ã©ãã«ããã°ããæã
ã©ãã«ããã°ããæç»ããæ¹æ³ãåŠç¿ããã«ã¯ãçŸåšã®æ¢åã®ãœãªã¥ãŒã·ã§ã³ã«ã©ã®ãããªåé¡ãããããç解ããå¿
èŠããããŸããã
ymaps.Placemark
ãªããžã§ã¯ããã§ããããšãèŠãŠã¿ãŸãããã
- 圌ã¯å°å³ã«æãããšãã§ããŸãã
- 圌ã«ã¯ç¬èªã®
placemark.balloon.
ãããŒãžã£ãŒããplacemark.balloon.
- 圌ã«ã¯ç¬èªã®
placemark.hint.
ãã³ããããŒãžã£ãŒãããplacemark.hint.
- 圌ã«ã¯ãã©ãã«ããã©ãã°ã¢ã³ãããããããŠã座æš
placemark.editor
ãä¿®æ£ã§ãããšãã£ã¿ãŒããããŸãã
ããã«ãã©ãã«ã¯ãç°å¢ã®ããããå€åã«åçã«å¯Ÿå¿ããŸãããªãã·ã§ã³ãããŒã¿ãå°å³æ圱ã®å€æŽãå°å³ã®çž®å°ºã®å€æŽãå°å³ã®äžå¿ã®å€æŽãªã©ã§ãã ãããç§ãã¡ã®åŒ·åãªç®å°ã§ãã
ããããéçºè
ãå€ãã®åãã¿ã€ãã®ã©ãã«ãå°å³äžã«è¡šç€ºããã ãã®å Žåããã®ãœãããŠã§ã¢ã®ãã¯ãŒã¯ãã¹ãŠå¿
èŠã§ããïŒ ããã§ããå¿
èŠãããŸããã
ãããã£ãŠãæåã®æŽå¯ã¯ããã§ããããã ããã©ãã«ã®ãã¹ãŠã®è£å©ã¢ãžã¥ãŒã«ã1ã€ã®å
±éã³ã³ããŒãã³ãã«é
眮ããåã
ã®ãªããžã§ã¯ãããšã«ãã¬ã³ããªã³ã°ãçŽæ¥æ
åœããããã°ã©ã ãšã³ãã£ãã£ã®ã¿ãäœæããŸãã
2çªç®ã®æŽå¯ã¯ãäžå¿
èŠãªãœãããŠã§ã¢åæåã®åé¡ã«ã€ããŠèãããšãã«çããŸããã ãã®ãããªåçã®é åã®ã©ããã§ãäžã®è©±ãæãåºããŸãã
äžèŠãªãœãããŠã§ã¢åæåãåãé€ããããšæãã倩æãæãã€ããŸããã 座ã£ãŠãä»å瀺ããããŸãïŒäžèŠãªãœãããŠã§ã¢ã®åæåãæ°ã«ãªãå Žåã¯ãããããããªãã§ãã ããã
ãªããžã§ã¯ãã«é¢ãããŠãŒã¶ãŒããŒã¿ïŒå®éã¯JSONïŒãä¿åããããšã決å®ãããªããžã§ã¯ãã®ããã°ã©ã ãšã³ãã£ãã£ã¯ããªããžã§ã¯ãããããã«æç»ããå¿
èŠãããå Žåã«ã®ã¿äœæãããŸãã
ãããã®ã¢ã€ãã¢ãšããã€ãã®éçºãçµã¿åãããåŸãå€æ°ã®ãã€ã³ããªããžã§ã¯ãã衚瀺ããæ°ããAPIã¢ãžã¥ãŒã«
-ymaps.ObjectManagerãçãŸããŸããã
ãªããžã§ã¯ãã®JSONèšè¿°ã¯ããã®ãããŒãžã£ãŒã®å
¥åã«éãããŸãã
ãããŒãžã£ãŒã¯ãã©ã®ããŒã¯ããããã®è¡šç€ºé åã«å
¥ãããåæããããŒã¯ãæç»ãããããããã®ããŒã¯ãã¯ã©ã¹ã¿ãŒåããŠããããã«çµæã衚瀺ããŸãã
ãããäžã«ã©ãã«ãšã¯ã©ã¹ã¿ãŒãæç»ããããã«ããããäžã®ã©ãã«ã®è¡šç€ºã®ã¿ãæ
åœãã
ymaps.Placemark
ãªããžã§ã¯ãïŒã€ãŸãymaps.overlayã*ïŒã®äžéšã®ã¿ãååŸããŸããã ãã©ã³ããã³ããªã©ã®ãã¹ãŠã®ã€ã³ãã©ã¹ãã©ã¯ãã£ãåäžã®å
±éã³ã³ããŒãã³ãã«é
眮ããŸãã
ãããã®ææ³ã«ãããã¯ã©ã€ã¢ã³ãã§å€æ°ã®ã©ãã«ãã¬ã³ããªã³ã°ããåé¡ã倧å¹
ã«æ¹åã§ããŸããã é床ã®åäžã¯æ¬¡ã®ãšããã§ãã
å³1.ãªããžã§ã¯ããäœæããŠãããã«è¿œå ããé床ãšãããã«ç¶ãå¯èŠéšåã®éåææç»- 1000åã®ã¿ã°ãäœæããŠãããã«è¿œå ãããšããã¹ãŠã®ã¿ã°ã衚瀺ãããŸãã
- 1000åã®ã¿ã°ãäœæããã¯ã©ã¹ã¿ãªã³ã°ã§ãããã«è¿œå ãããšããã¹ãŠã®ã¿ã°ã衚瀺ãããŸãã
- 10,000åã®ã¿ã°ãäœæããããããã¯ã©ã¹ã¿ãªã³ã°ã§ãããã«è¿œå ãããšããã¹ãŠã®ã¿ã°ã衚瀺ãããŸãã
- 50,000åã®ã¿ã°ãäœæããããããã¯ã©ã¹ã¿ãªã³ã°ã§ãããã«è¿œå ãããšããã¹ãŠã®ã¿ã°ã衚瀺ãããŸãã
- 50,000åã®ã¿ã°ãäœæããããããã¯ã©ã¹ã¿ãªã³ã°ã§ãããã«è¿œå ãããšã500åã®ãªããžã§ã¯ãã衚瀺ãããŸãã
- 50,000åã®ã¿ã°ãäœæããã¯ã©ã¹ã¿ãªã³ã°ããã«ãããã«è¿œå ãããšã10,000åã衚瀺ãããŸãã
å³2.ãªããžã§ã¯ããäœæããŠãããã«è¿œå ããé床ãšãããã«ç¶ãå¯èŠéšåã®åææç»- 1000åã®ã¿ã°ãäœæããŠãããã«è¿œå ãããšããã¹ãŠã®ã¿ã°ã衚瀺ãããŸãã
- 1000åã®ã¿ã°ãäœæããã¯ã©ã¹ã¿ãªã³ã°ã§ãããã«è¿œå ãããšããã¹ãŠã®ã¿ã°ã衚瀺ãããŸãã
- 10,000åã®ã¿ã°ãäœæããããããã¯ã©ã¹ã¿ãªã³ã°ã§ãããã«è¿œå ãããšããã¹ãŠã®ã¿ã°ã衚瀺ãããŸãã
- 50,000åã®ã¿ã°ãäœæããããããã¯ã©ã¹ã¿ãªã³ã°ã§ãããã«è¿œå ãããšããã¹ãŠã®ã¿ã°ã衚瀺ãããŸãã
- 50,000åã®ã¿ã°ãäœæããããããã¯ã©ã¹ã¿ãªã³ã°ã§ãããã«è¿œå ãããšã500åã®ãªããžã§ã¯ãã衚瀺ãããŸãã
- 10,000åã®ã¿ã°ãäœæããã¯ã©ã¹ã¿ãªã³ã°ããã«ãããã«è¿œå ãããšã2000åã衚瀺ãããŸãã
- 5,000åã®ã¿ã°ãäœæããã¯ã©ã¹ã¿ãªã³ã°ããã«ãããã«è¿œå ãããšã1,000åã衚瀺ãããŸãã
éèŠãªãç¥ããã ãããã®çµ±èšã¯ãã¹ãŠãææ°ã®ãã©ãŠã¶ãŒã«æå¹ã§ãã IE8ã¯ãããã®ãã©ãŠã¶ãŒã«ã¯å«ãŸããŠããŸããã ãããã£ãŠã圌ã«ãšã£ãŠæ°åã¯ã¯ããã«æªããªããŸããã倧å€æ°ã«ãšã£ãŠããã¯éèŠã§ã¯ãªããšæããŸãã
ãªããžã§ã¯ãã®äœæãšã¬ã³ããªã³ã°ãçŽæ¥å éããããšã«æåããããã«å ããŠããœãããŠã§ã¢ãšã³ãã£ãã£ã®åæåãå¯èœãªéãæé©åããŸããã ããã§ãããšãã°ãã¯ã©ã€ã¢ã³ãäžã§50,000ãã€ã³ããã¯ã©ã¹ã¿ãŒåã§ãããããã§ã®äœæ¥ãå¿«é©ã«ãªããŸãã
éçºè
ã¬ã€ãã§ã¢ãžã¥ãŒã«ã®è©³çŽ°ã確èªãã
ãµã³ãããã¯ã¹ã§ã¢ãžã¥ãŒã«ã®å®äŸãã芧ãã ããã
ããã§ãã¯ã©ã€ã¢ã³ãäžã§ãã€ã³ãããã°ãããã°ããæç»ããŠã¯ã©ã¹ã¿ãŒåããæ¹æ³ãåŠã³ãŸããã 次ã¯ïŒ
ãã€ã³ã3.ããŒã¿ã®æé©ãªããŒã
Zenitãã¡ã³ã®äŸãèŠããŠããŸããïŒ ã¯ã©ã€ã¢ã³ãã§ããŒã¿ãã¬ã³ããªã³ã°ããåé¡ã¯è§£æ±ºããŸãããããã®ããŒã¿ã®æé©ãªããŒãã«é¢é£ããåé¡ã¯è§£æ±ºããŸããã§ããã å
žåçãªAPIãŠãŒã¶ãŒã¿ã¹ã¯ã®åéãéå§ããŸããã ç 究ã®çµæã«ãããšãç§ãã¡ã¯2ã€ã®å
žåçãªã±ãŒã¹ãåãåããŸããïŒ
- ãµãŒããŒäžã®ãŠãŒã¶ãŒã¯å€§éã®ããŒã¿ãæã£ãŠãããããã¯ã©ã€ã¢ã³ãã§è¡šç€ºãããããå¿
èŠã«å¿ããŠããŒã¿ãããŒããããã
- éçºè
ã¯ããµãŒããŒäžã§ããŒã¿ãæºåãïŒãµãŒããŒã¯ã©ã¹ã¿ãªã³ã°ãå®è£
ãããªã©ïŒããã®åŠçã®çµæãã¯ã©ã€ã¢ã³ãã§è¡šç€ºããããšèããŠããŸãã
ã©ã¡ãã®ã¢ãžã¥ãŒã«ãåºæ¬çã«
ObjectManagerã®å®è£
ã«åºã¥ããŠããŸãããããŠã³ããŒãããããŒã¿ã®ããŒããšãã£ãã·ã¥ã®ã¢ã«ãŽãªãºã ã«ã¯å€ãã®éãããããŸãã
ãã®çµæããŠãŒã¶ãŒãã«ãŒããæäœãããšããŠãŒã¶ãŒã¯ããŒã¿ããŒã¹ããããŒã¿ãåãåããŸãã ããæç¹ã§ãããŒã¿ã®ãã¹ãŠãŸãã¯å¿
èŠãªéšåãããŒãããããµãŒããŒãªã¯ãšã¹ãã¯éä¿¡ãããªããªããŸãã
ããŒã¿ã¯pr-treeã®ã¯ã©ã€ã¢ã³ãã«ä¿åãããããã倧éã®ããŒã¿ã§ãã£ãŠããµã³ãã«ã¯éåžžã«è¿
éã«äœæãããŸãã
次ã«ããªãã·ã§ã³2ã«ã€ããŠèª¬æããŸã-ã¯ã©ã€ã¢ã³ãã§ã®ãµãŒããŒã¯ã©ã¹ã¿ãªã³ã°ã®çµæã®è¡šç€ºã ãµãŒããŒåŽã®ã©ãã«ã¯ã©ã¹ã¿ãªã³ã°ãäœæãããšããŸãã ãŸããã¯ã©ã€ã¢ã³ãããã®èŠæ±ã«å¿ããŠãã¯ã©ã¹ã¿ãŒãšã¯ã©ã¹ã¿ãŒã«å«ãŸããªãåäžã®ã©ãã«ãæäŸã§ããã¹ã¯ãªãããäœæããŸããã
RemoteObjectManagerã€ã³ã¹ã¿ã³ã¹ãäœæãããã®çŽ æŽãããã¹ã¯ãªãããžã®ãã¹ãç»é²ããã ãã§ãã
RemoteObjectManagerã¯ã
LoadingObjectManagerãšã»ãŒåãããã«
æ©èœããŸãã éãã¯ããºãŒã ãå€æŽãããã³ã«ãµãŒããŒã«ããŒã¿ãåèŠæ±ããããšã ãã§ãã
ããŒã¿ã¯ãµãŒããŒäžã§ã¯ã©ã¹ã¿ãŒåãããããããµãŒããŒãšãµãŒããŒã®ã¿ããã©ã®ããŒã¿ãå¿
èŠã§ãã©ã®ããŒã¿ãçŸæç¹ã§ãããã«è¡šç€ºããå¿
èŠããªãããç¥ãããšãã§ããŸãã ãããã£ãŠããªããžã§ã¯ãã«é¢ããæ
å ±ã¯ãæåã®ãºãŒã ãå€æŽããããŸã§ã®ã¿ã¯ã©ã€ã¢ã³ãã«ä¿åããããã®åŸãã¹ãŠãå床èŠæ±ãããŸãã
ã¯ã©ã¹ã¿ãŒã©ãã«ã®èª¬æããµãŒããŒããéä¿¡ãããå Žåãã¯ã©ã€ã¢ã³ãäžã§ãããã®ã©ãã«ã¯APIããã€ã³ãã©ã¹ãã©ã¯ãã£å
šäœãååŸããŸã-ã¯ã©ã¹ã¿ãŒã«ç¹å¥ãªã¢ã€ã³ã³ãæç»ããããã¹ãŠã®æšæºçãªåäœãåäœããŸãã
ãã€ã³ã4.ãµãŒããŒå®è£
ã«é¢ããèå¯
ãã®ã»ã¯ã·ã§ã³ã§ã¯ãã¯ã©ã€ã¢ã³ãéšåã®èšèšæã«æ³å®ãããµãŒããŒäžã®ããŒã¿ã®ä¿åããã³åŠçã®æŠå¿µããªã¹ãããŸãã åçŽãªãã®ããè€éãªãã®ã«ç§»ããŸãããã
1.ãµãŒããŒäžã®ãªããžã§ã¯ãã«é¢ããæ
å ±ã®éçãã¡ã€ã«ãžã®ä¿å
ã¯ã©ã€ã¢ã³ãã³ãŒãã¯ããŒã¿ã«å¯ŸããŠã®ã¿åäœããŸãã ã¿ã€ã«ã¯ããããäžã®ç¹å®ã®çªå·ä»ããšãªã¢ã§ãã ã¿ã€ã«ã®çªå·ä»ãã®è©³çŽ°ã«ã€ããŠã¯ãããã¥ã¡ã³ããã芧ãã ããã
ãããã®ç¹å®ã®é åãããŒãžã«è¡šç€ºããããšãã¯ã©ã€ã¢ã³ãã¢ãžã¥ãŒã«ã¯ãã®è¡šç€ºé åã«ããã¿ã€ã«ãèšç®ããå¿
èŠãªããŒã¿ã®ååšã確èªããå¿
èŠã«å¿ããŠããŒã¿ã®èŠæ±ãéä¿¡ããŸãã
ã¯ã©ã€ã¢ã³ãã¢ãžã¥ãŒã«ã«ã¯ãæ°ããã¿ã€ã«ããšã«åå¥ã«ãªã¯ãšã¹ããéä¿¡ããèšå®ããããŸãã ãªãããã貎éãªã®ã§ããïŒ ã¯ãããµãŒããŒãžã®ã¯ã©ã€ã¢ã³ãèŠæ±ãªãã·ã§ã³ã®æéæ°ãååŸããŸãã
ãºãŒã = 0ãã¿ã€ã«= [0ã0]
ãºãŒã = 1ãã¿ã€ã«= [0ã0]
ãºãŒã = 1ãã¿ã€ã«= [0ã1]
ãºãŒã = 1ãã¿ã€ã«= [1ã0]
ãºãŒã = 1ãã¿ã€ã«= [1ã1]
ãºãŒã = 2ãã¿ã€ã«= [0ã0]
...
ãªã¯ãšã¹ãã¯äºåã«ããã£ãŠããããããªã¯ãšã¹ãã«å¯Ÿããã¬ã¹ãã³ã¹ãäºåã«çæã§ããŸãã ãµãŒããŒäžã§äœããã®ãã¡ã€ã«æ§é ãæŽçããŸãããã
次ã®ã³ãŒãããã¡ã€ã«ã«ä¿åãããŸãã
myCallback_x_1_y_2_z_5({ "type": "FeatureCollection", "features": [ { "type": "Feature", "id": 0, "geometry": { "type": "Point", "coordinates": [55.831903, 37.411961] }, "properties": { "balloonContent": " ", "clusterCaption": " 1", "hintContent": " " } }, ... ] }
ãã®ãããªãã¡ã€ã«ãã¯ã©ã€ã¢ã³ãã«ããŒããããšããã¡ã€ã«ã«ç»é²ãããŠããJSONPã³ãŒã«ããã¯ãåŒã³åºãããŸãã ããŒã¿ã¯LoadingObjectManagerã®è
žã«èœã¡ãå¿
èŠã«å¿ããŠãã£ãã·ã¥ããã³ã¬ã³ããªã³ã°ãããŸãã
ãã®çµæããµãŒããŒäžã®ããŒã¿ã»ããã䜿çšããŠéçãã¡ã€ã«ãä¿åããã ãã§æžã¿ãã¯ã©ã€ã¢ã³ãããŒãã¯ãã€ãããèŠæ±ããŠè¡šç€ºããããèªã決å®ããŸãã
2.éçãã¡ã€ã«ããã®åçå¿ççæ
äžèšã®ãœãªã¥ãŒã·ã§ã³ã®é倧ãªæ¬ ç¹ã¯ãã¯ã©ã€ã¢ã³ããããµãŒããŒãžã®ããŒã¿ã«å¯Ÿããå€æ°ã®ãªã¯ãšã¹ãã§ãã ã¿ã€ã«ããšã«åå¥ã«ããŒã¿ãèŠæ±ããããããè€æ°ã®ã¿ã€ã«ã®çŽåŸã«èŠæ±ãéä¿¡ããããšããå§ãããŸãããã¿ã€ã«ã®ã°ã«ãŒãã«å¯ŸããèŠæ±ãåŠçããã«ã¯ãæ¢ã«ãµãŒããŒã³ãŒããèšè¿°ããå¿
èŠããããŸãã
ãã®å ŽåãããŒã¿ã¯åŒãç¶ãå¥ã®ãã¡ã€ã«ã«ä¿åã§ããŸãã ã¯ã©ã€ã¢ã³ããç¹å®ã®é·æ¹åœ¢ã®é åã§ããŒã¿ã®ãªã¯ãšã¹ããåä¿¡ãããšãè€æ°ã®ãã¡ã€ã«ã®å
容ã1ã€ã®åçã«æ¥çããŠã¯ã©ã€ã¢ã³ãã«éãè¿ãã ãã§ååã§ãã
3.ããŒã¿ããŒã¹ã䜿çšããåçå¿ççæ
ç§ãã¡ã®æèŠã§ã¯ãæã確å®ãªæ¹æ³ã¯ãå°çåç
§ããŒã¿ã«ã€ã³ããã¯ã¹ãä»ããããšãã§ããäœããã®ããŒã¿ããŒã¹ã䜿çšããŠãµãŒããŒéšåãå®è£
ããããšã§ãã 空éã€ã³ããã¯ã¹ããµããŒãããªãããŒã¿ããŒã¹ã®å Žå
ã空éããŒã®æŠå¿µã䜿çšããŠèªåã§åæ§ã®ã€ã³ããã¯ã¹ãäœæã§ã
ãŸã ã
äžè¬ã«ãå°çåç
§ããŒã¿ããµãŒããŒã«ä¿åããŠã¯ã©ã¹ã¿ãªã³ã°ããããšã¯ãå¥ã®è°è«ã®ãããã¯ã§ãã ãã®ãããå¥ã®æ©äŒã«ãããè°è«ããŸãã
ãã®ãªããžããªã«ã¯ãnode.js + mongo.dbã§èšè¿°ããããµãŒããŒã°ãªããã¯ã©ã¹ã¿ãªã³ã°ã䜿çšãããµãŒããŒããŒãã®å®è£
äŸããããŸãã 誰ãã圹ã«ç«ã€ãããããŸããïŒ
ã㢠ïŒã
ãããã«
æ°ããã¢ãžã¥ãŒã«ã®æ¯èŒè¡šã
ã¢ãžã¥ãŒã« | ã¡ãªãã | æ¬ ç¹ |
---|
ãªããžã§ã¯ããããŒãžã£ãŒ | ã¯ã©ã€ã¢ã³ãäžã®ãªããžã§ã¯ãã®ã¯ã©ã¹ã¿ãªã³ã°ãèš±å¯ããŸãã
ã¬ã³ããªã³ã°ã¯ããããã®å¯èŠé åã«åãŸããªããžã§ã¯ãã«å¯ŸããŠã®ã¿è¡ãããŸãã
ãªããžã§ã¯ãã衚瀺ããããšãã«ãã£ã«ã¿ãŒããããšãã§ããŸãã
ãã¹ãŠã®ããŒã¿åŠçã¯ã¯ã©ã€ã¢ã³ãåŽã§å®è¡ãããããããµãŒããŒåŽãå®è£
ããå¿
èŠã¯ãããŸããã
| ãµããŒãã¯ã¿ã°ã§ã®ã¿åäœããŸãã
ããŒã¿ã¯ããã¹ãŠã®ãªããžã§ã¯ãã«ã€ããŠäžåºŠã«ããŠã³ããŒããããŸãïŒãããã®è¡šç€ºé åã«è©²åœããªããã®ãå«ããŠïŒã
ãªããžã§ã¯ãã®ã¯ã©ã¹ã¿ãªã³ã°ã¯ã¯ã©ã€ã¢ã³ãåŽã§è¡ãããŸãã |
LoadingObjectManager | ã¯ã©ã€ã¢ã³ãäžã®ãªããžã§ã¯ãã®ã¯ã©ã¹ã¿ãªã³ã°ãèš±å¯ããŸãã ãããã®è¡šç€ºé åã®ããŒã¿ã®ã¿ãããŒãããŸãã
ã¢ããããŒããããããŒã¿ãä¿åããŸãã ãªããžã§ã¯ãããšã«ãããŒã¿ã¯1åã ãããŠã³ããŒããããŸãã
ãªããžã§ã¯ãã衚瀺ããããšãã«ãã£ã«ã¿ãŒããããšãã§ããŸãã
| ãµããŒãã¯ã¿ã°ã§ã®ã¿åäœããŸãã
ãªããžã§ã¯ãã®ã¯ã©ã¹ã¿ãªã³ã°ã¯ã¯ã©ã€ã¢ã³ãåŽã§è¡ãããŸãã
ãµãŒããŒåŽãå®è£
ããå¿
èŠããããŸãã
|
RemoteObjectManager | ãµãŒããŒåŽã®ããŒã¿ã¯ã©ã¹ã¿ãªã³ã°ã䜿çšããŸãã
ãªããžã§ã¯ãããŒã¿ã¯ãµãŒããŒã«ä¿åãããŸãã æ¯åãããŒã¿ã¯ãããã®è¡šç€ºé åã«è©²åœãããªããžã§ã¯ãã«å¯ŸããŠã®ã¿ããŒããããŸãã
| ãµããŒãã¯ã¿ã°ã§ã®ã¿åäœããŸãã
åçãå€æŽãããšãããŒã¿ã¯åã³ããŠã³ããŒããããŸãïŒããŒã¿ãæ¢ã«ããŠã³ããŒããããŠãããªããžã§ã¯ãã§ãïŒã
ç¬èªã®ã¯ã©ã¹ã¿ãªã³ã°ãå®è£
ããå¿
èŠããããŸãã
ãµãŒããŒåŽãå®è£
ããå¿
èŠããããŸãã
|
çŸæç¹ã§ã¯ããã€ã³ããã£ãŒãã£ã䜿çšããäœæ¥ã®ã¿ããµããŒãããŠããŸãã ããªãŽã³ãããªã©ã€ã³ããã®ä»ã®çŸãã圢ç¶ã®ãµããŒãã¯èšç»å
ã«ãããå°æ¥ã®ãªãªãŒã¹ã§æäŸãããäºå®ã§ãã
ãããã®ã¢ãžã¥ãŒã«ã®äœ¿çšãæ€èšããå Žå ãããäžã«å€ãã®ãã€ã³ããã£ãŒãã£ãæç»ããå¿
èŠãããã»ãšãã©ãã¹ãŠã®ç¶æ³ã
䟿å©ãªãªã³ã¯ïŒ
- åçä»ãã®æã詳现ãªéçºè
ã¬ã€ãã¯tech.yandex.ru/maps/doc/jsapi/2.1/dg/concepts/many-objects-docpageã§ãã
- ãµã³ãããã¯ã¹ã®äŸ-tech.yandex.ru/maps/jsbox/2.1/object_manager
- RemoteObjectManagerã®ãµãŒããŒéšåã®å®è£
äŸãå«ãgithubãããžã§ã¯ãã¯github.com/dimik/geohosting-serverã§ãã
- Yandex.Map API Developers Clubã質åããããŸã-clubs.ya.ru/mapsapi