libgd-gis 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +78 -31
  3. data/examples/{a-world_peaks.rb → america-peaks.rb} +4 -4
  4. data/examples/asia-peaks.rb +42 -0
  5. data/examples/av_ramirez.rb +34 -0
  6. data/examples/europe-peaks.rb +42 -0
  7. data/examples/heladerias.json +47 -0
  8. data/examples/heladerias.rb +40 -0
  9. data/examples/ice-cream.jpg +0 -0
  10. data/examples/ice-cream.png +0 -0
  11. data/examples/output/america.png +0 -0
  12. data/examples/output/asia.png +0 -0
  13. data/examples/output/europe.png +0 -0
  14. data/examples/output/heladerias_parana.png +0 -0
  15. data/examples/output/museos_parana.png +0 -0
  16. data/examples/output/world_peaks-s.png +0 -0
  17. data/examples/parana_museos.rb +49 -0
  18. data/examples/street/1.osm +207517 -0
  19. data/examples/street/av-ramirez.osm +207517 -0
  20. data/examples/street/av-ramirez.png +0 -0
  21. data/examples/street/av_ramirez-0.1346843780815251.png +0 -0
  22. data/examples/street/av_ramirez-3.png +0 -0
  23. data/examples/street/av_ramirez.png +0 -0
  24. data/examples/street/av_ramirez.rb +46 -0
  25. data/examples/street/avramirez.geojson +9 -0
  26. data/examples/street/dot.png +0 -0
  27. data/examples/street/download.sh +18 -0
  28. data/examples/street/draw.rb +46 -0
  29. data/examples/street/map.osm +9158 -0
  30. data/examples/street/mark.png +0 -0
  31. data/examples/street/parana.json +100 -0
  32. data/examples/street/parana.rb +30 -0
  33. data/examples/street/parana_areas.png +0 -0
  34. data/examples/street/query.overpass +8 -0
  35. data/examples/street/ramirez.geojson +355 -0
  36. data/examples/street/ramirez_big.geojson +9959 -0
  37. data/examples/street/ramirez_full.geojson +76 -0
  38. data/examples/street/ramirez_full.png +0 -0
  39. data/examples/street/ramirez_gis.png +0 -0
  40. data/examples/street/ramirez_osm.png +0 -0
  41. data/examples/street/ramirez_osm_full.png +0 -0
  42. data/examples/street/ramirez_polyline.png +0 -0
  43. data/examples/street/ramirez_road.png +0 -0
  44. data/examples/street/test_carto_dark.png +0 -0
  45. data/examples/street/test_osm_fr.png +0 -0
  46. data/examples/street/test_polygon.png +0 -0
  47. data/examples/street/tmp/tiles/carto_dark_15_10874_19433.png +0 -0
  48. data/examples/street/tmp/tiles/carto_dark_15_10874_19434.png +0 -0
  49. data/examples/street/tmp/tiles/carto_dark_15_10874_19435.png +0 -0
  50. data/examples/street/tmp/tiles/carto_dark_15_10874_19436.png +0 -0
  51. data/examples/street/tmp/tiles/carto_dark_15_10875_19433.png +0 -0
  52. data/examples/street/tmp/tiles/carto_dark_15_10875_19434.png +0 -0
  53. data/examples/street/tmp/tiles/carto_dark_15_10875_19435.png +0 -0
  54. data/examples/street/tmp/tiles/carto_dark_15_10875_19436.png +0 -0
  55. data/examples/street/tmp/tiles/carto_dark_15_10876_19433.png +0 -0
  56. data/examples/street/tmp/tiles/carto_dark_15_10876_19434.png +0 -0
  57. data/examples/street/tmp/tiles/carto_dark_15_10876_19435.png +0 -0
  58. data/examples/street/tmp/tiles/carto_dark_15_10876_19436.png +0 -0
  59. data/examples/street/tmp/tiles/esri_satellite_15_10874_19433.jpg +0 -0
  60. data/examples/street/tmp/tiles/esri_satellite_15_10874_19434.jpg +0 -0
  61. data/examples/street/tmp/tiles/esri_satellite_15_10874_19435.jpg +0 -0
  62. data/examples/street/tmp/tiles/esri_satellite_15_10874_19436.jpg +0 -0
  63. data/examples/street/tmp/tiles/esri_satellite_15_10875_19433.jpg +0 -0
  64. data/examples/street/tmp/tiles/esri_satellite_15_10875_19434.jpg +0 -0
  65. data/examples/street/tmp/tiles/esri_satellite_15_10875_19435.jpg +0 -0
  66. data/examples/street/tmp/tiles/esri_satellite_15_10875_19436.jpg +0 -0
  67. data/examples/street/tmp/tiles/esri_satellite_15_10876_19433.jpg +0 -0
  68. data/examples/street/tmp/tiles/esri_satellite_15_10876_19434.jpg +0 -0
  69. data/examples/street/tmp/tiles/esri_satellite_15_10876_19435.jpg +0 -0
  70. data/examples/street/tmp/tiles/esri_satellite_15_10876_19436.jpg +0 -0
  71. data/examples/street/tmp/tiles/osm_fr_15_10874_19433.png +0 -0
  72. data/examples/street/tmp/tiles/osm_fr_15_10874_19434.png +0 -0
  73. data/examples/street/tmp/tiles/osm_fr_15_10874_19435.png +0 -0
  74. data/examples/street/tmp/tiles/osm_fr_15_10874_19436.png +0 -0
  75. data/examples/street/tmp/tiles/osm_fr_15_10875_19433.png +0 -0
  76. data/examples/street/tmp/tiles/osm_fr_15_10875_19434.png +0 -0
  77. data/examples/street/tmp/tiles/osm_fr_15_10875_19435.png +0 -0
  78. data/examples/street/tmp/tiles/osm_fr_15_10875_19436.png +0 -0
  79. data/examples/street/tmp/tiles/osm_fr_15_10876_19433.png +0 -0
  80. data/examples/street/tmp/tiles/osm_fr_15_10876_19434.png +0 -0
  81. data/examples/street/tmp/tiles/osm_fr_15_10876_19435.png +0 -0
  82. data/examples/street/tmp/tiles/osm_fr_15_10876_19436.png +0 -0
  83. data/examples/tmp/tiles/15_10871_19430.png +0 -0
  84. data/examples/tmp/tiles/15_10871_19431.png +0 -0
  85. data/examples/tmp/tiles/15_10871_19432.png +0 -0
  86. data/examples/tmp/tiles/15_10871_19433.png +0 -0
  87. data/examples/tmp/tiles/15_10871_19434.png +0 -0
  88. data/examples/tmp/tiles/15_10871_19435.png +0 -0
  89. data/examples/tmp/tiles/15_10872_19430.png +0 -0
  90. data/examples/tmp/tiles/15_10872_19431.png +0 -0
  91. data/examples/tmp/tiles/15_10872_19432.png +0 -0
  92. data/examples/tmp/tiles/15_10872_19433.png +0 -0
  93. data/examples/tmp/tiles/15_10872_19434.png +0 -0
  94. data/examples/tmp/tiles/15_10872_19435.png +0 -0
  95. data/examples/tmp/tiles/15_10873_19430.png +0 -0
  96. data/examples/tmp/tiles/15_10873_19431.png +0 -0
  97. data/examples/tmp/tiles/15_10873_19432.png +0 -0
  98. data/examples/tmp/tiles/15_10873_19433.png +0 -0
  99. data/examples/tmp/tiles/15_10873_19434.png +0 -0
  100. data/examples/tmp/tiles/15_10873_19435.png +0 -0
  101. data/examples/tmp/tiles/15_10874_19430.png +0 -0
  102. data/examples/tmp/tiles/15_10874_19431.png +0 -0
  103. data/examples/tmp/tiles/15_10874_19432.png +0 -0
  104. data/examples/tmp/tiles/15_10874_19433.png +0 -0
  105. data/examples/tmp/tiles/15_10874_19434.png +0 -0
  106. data/examples/tmp/tiles/15_10874_19435.png +0 -0
  107. data/examples/tmp/tiles/15_10875_19430.png +0 -0
  108. data/examples/tmp/tiles/15_10875_19431.png +0 -0
  109. data/examples/tmp/tiles/15_10875_19432.png +0 -0
  110. data/examples/tmp/tiles/15_10875_19433.png +0 -0
  111. data/examples/tmp/tiles/15_10875_19434.png +0 -0
  112. data/examples/tmp/tiles/15_10875_19435.png +0 -0
  113. data/examples/tmp/tiles/15_10876_19430.png +0 -0
  114. data/examples/tmp/tiles/15_10876_19431.png +0 -0
  115. data/examples/tmp/tiles/15_10876_19432.png +0 -0
  116. data/examples/tmp/tiles/15_10876_19433.png +0 -0
  117. data/examples/tmp/tiles/15_10876_19434.png +0 -0
  118. data/examples/tmp/tiles/15_10876_19435.png +0 -0
  119. data/examples/tmp/tiles/15_10877_19430.png +0 -0
  120. data/examples/tmp/tiles/15_10877_19431.png +0 -0
  121. data/examples/tmp/tiles/15_10877_19432.png +0 -0
  122. data/examples/tmp/tiles/15_10877_19433.png +0 -0
  123. data/examples/tmp/tiles/15_10877_19434.png +0 -0
  124. data/examples/tmp/tiles/15_10877_19435.png +0 -0
  125. data/examples/tmp/tiles/7_27_43.png +0 -0
  126. data/examples/tmp/tiles/7_27_44.png +0 -0
  127. data/examples/tmp/tiles/7_27_45.png +0 -0
  128. data/examples/tmp/tiles/7_27_46.png +0 -0
  129. data/examples/tmp/tiles/7_27_47.png +0 -0
  130. data/examples/tmp/tiles/7_27_48.png +0 -0
  131. data/examples/tmp/tiles/7_27_49.png +0 -0
  132. data/examples/tmp/tiles/7_27_50.png +0 -0
  133. data/examples/tmp/tiles/7_28_43.png +0 -0
  134. data/examples/tmp/tiles/7_28_44.png +0 -0
  135. data/examples/tmp/tiles/7_28_45.png +0 -0
  136. data/examples/tmp/tiles/7_28_46.png +0 -0
  137. data/examples/tmp/tiles/7_28_47.png +0 -0
  138. data/examples/tmp/tiles/7_28_48.png +0 -0
  139. data/examples/tmp/tiles/7_28_49.png +0 -0
  140. data/examples/tmp/tiles/7_28_50.png +0 -0
  141. data/examples/tmp/tiles/7_29_43.png +0 -0
  142. data/examples/tmp/tiles/7_29_44.png +0 -0
  143. data/examples/tmp/tiles/7_29_45.png +0 -0
  144. data/examples/tmp/tiles/7_29_46.png +0 -0
  145. data/examples/tmp/tiles/7_29_47.png +0 -0
  146. data/examples/tmp/tiles/7_29_48.png +0 -0
  147. data/examples/tmp/tiles/7_29_49.png +0 -0
  148. data/examples/tmp/tiles/7_29_50.png +0 -0
  149. data/examples/tmp/tiles/7_30_43.png +0 -0
  150. data/examples/tmp/tiles/7_30_44.png +0 -0
  151. data/examples/tmp/tiles/7_30_45.png +0 -0
  152. data/examples/tmp/tiles/7_30_46.png +0 -0
  153. data/examples/tmp/tiles/7_30_47.png +0 -0
  154. data/examples/tmp/tiles/7_30_48.png +0 -0
  155. data/examples/tmp/tiles/7_30_49.png +0 -0
  156. data/examples/tmp/tiles/7_30_50.png +0 -0
  157. data/examples/tmp/tiles/7_31_43.png +0 -0
  158. data/examples/tmp/tiles/7_31_44.png +0 -0
  159. data/examples/tmp/tiles/7_31_45.png +0 -0
  160. data/examples/tmp/tiles/7_31_46.png +0 -0
  161. data/examples/tmp/tiles/7_31_47.png +0 -0
  162. data/examples/tmp/tiles/7_31_48.png +0 -0
  163. data/examples/tmp/tiles/7_31_49.png +0 -0
  164. data/examples/tmp/tiles/7_31_50.png +0 -0
  165. data/examples/tmp/tiles/7_32_43.png +0 -0
  166. data/examples/tmp/tiles/7_32_44.png +0 -0
  167. data/examples/tmp/tiles/7_32_45.png +0 -0
  168. data/examples/tmp/tiles/7_32_46.png +0 -0
  169. data/examples/tmp/tiles/7_32_47.png +0 -0
  170. data/examples/tmp/tiles/7_32_48.png +0 -0
  171. data/examples/tmp/tiles/7_32_49.png +0 -0
  172. data/examples/tmp/tiles/7_32_50.png +0 -0
  173. data/examples/tmp/tiles/7_37_71.png +0 -0
  174. data/examples/tmp/tiles/7_37_72.png +0 -0
  175. data/examples/tmp/tiles/7_37_73.png +0 -0
  176. data/examples/tmp/tiles/7_37_74.png +0 -0
  177. data/examples/tmp/tiles/7_37_75.png +0 -0
  178. data/examples/tmp/tiles/7_37_76.png +0 -0
  179. data/examples/tmp/tiles/7_37_77.png +0 -0
  180. data/examples/tmp/tiles/7_37_78.png +0 -0
  181. data/examples/tmp/tiles/7_37_79.png +0 -0
  182. data/examples/tmp/tiles/7_37_80.png +0 -0
  183. data/examples/tmp/tiles/7_37_81.png +0 -0
  184. data/examples/tmp/tiles/7_37_82.png +0 -0
  185. data/examples/tmp/tiles/7_37_83.png +0 -0
  186. data/examples/tmp/tiles/7_37_84.png +0 -0
  187. data/examples/tmp/tiles/7_37_85.png +0 -0
  188. data/examples/tmp/tiles/7_37_86.png +0 -0
  189. data/examples/tmp/tiles/7_37_87.png +0 -0
  190. data/examples/tmp/tiles/7_38_71.png +0 -0
  191. data/examples/tmp/tiles/7_38_72.png +0 -0
  192. data/examples/tmp/tiles/7_38_73.png +0 -0
  193. data/examples/tmp/tiles/7_38_74.png +0 -0
  194. data/examples/tmp/tiles/7_38_75.png +0 -0
  195. data/examples/tmp/tiles/7_38_76.png +0 -0
  196. data/examples/tmp/tiles/7_38_77.png +0 -0
  197. data/examples/tmp/tiles/7_38_78.png +0 -0
  198. data/examples/tmp/tiles/7_38_79.png +0 -0
  199. data/examples/tmp/tiles/7_38_80.png +0 -0
  200. data/examples/tmp/tiles/7_38_81.png +0 -0
  201. data/examples/tmp/tiles/7_38_82.png +0 -0
  202. data/examples/tmp/tiles/7_38_83.png +0 -0
  203. data/examples/tmp/tiles/7_38_84.png +0 -0
  204. data/examples/tmp/tiles/7_38_85.png +0 -0
  205. data/examples/tmp/tiles/7_38_86.png +0 -0
  206. data/examples/tmp/tiles/7_38_87.png +0 -0
  207. data/examples/tmp/tiles/7_39_71.png +0 -0
  208. data/examples/tmp/tiles/7_39_72.png +0 -0
  209. data/examples/tmp/tiles/7_39_73.png +0 -0
  210. data/examples/tmp/tiles/7_39_74.png +0 -0
  211. data/examples/tmp/tiles/7_39_75.png +0 -0
  212. data/examples/tmp/tiles/7_39_76.png +0 -0
  213. data/examples/tmp/tiles/7_39_77.png +0 -0
  214. data/examples/tmp/tiles/7_39_78.png +0 -0
  215. data/examples/tmp/tiles/7_39_79.png +0 -0
  216. data/examples/tmp/tiles/7_39_80.png +0 -0
  217. data/examples/tmp/tiles/7_39_81.png +0 -0
  218. data/examples/tmp/tiles/7_39_82.png +0 -0
  219. data/examples/tmp/tiles/7_39_83.png +0 -0
  220. data/examples/tmp/tiles/7_39_84.png +0 -0
  221. data/examples/tmp/tiles/7_39_85.png +0 -0
  222. data/examples/tmp/tiles/7_39_86.png +0 -0
  223. data/examples/tmp/tiles/7_39_87.png +0 -0
  224. data/examples/tmp/tiles/7_40_71.png +0 -0
  225. data/examples/tmp/tiles/7_40_72.png +0 -0
  226. data/examples/tmp/tiles/7_40_73.png +0 -0
  227. data/examples/tmp/tiles/7_40_74.png +0 -0
  228. data/examples/tmp/tiles/7_40_75.png +0 -0
  229. data/examples/tmp/tiles/7_40_76.png +0 -0
  230. data/examples/tmp/tiles/7_40_77.png +0 -0
  231. data/examples/tmp/tiles/7_40_78.png +0 -0
  232. data/examples/tmp/tiles/7_40_79.png +0 -0
  233. data/examples/tmp/tiles/7_40_80.png +0 -0
  234. data/examples/tmp/tiles/7_40_81.png +0 -0
  235. data/examples/tmp/tiles/7_40_82.png +0 -0
  236. data/examples/tmp/tiles/7_40_83.png +0 -0
  237. data/examples/tmp/tiles/7_40_84.png +0 -0
  238. data/examples/tmp/tiles/7_40_85.png +0 -0
  239. data/examples/tmp/tiles/7_40_86.png +0 -0
  240. data/examples/tmp/tiles/7_40_87.png +0 -0
  241. data/examples/tmp/tiles/7_41_71.png +0 -0
  242. data/examples/tmp/tiles/7_41_72.png +0 -0
  243. data/examples/tmp/tiles/7_41_73.png +0 -0
  244. data/examples/tmp/tiles/7_41_74.png +0 -0
  245. data/examples/tmp/tiles/7_41_75.png +0 -0
  246. data/examples/tmp/tiles/7_41_76.png +0 -0
  247. data/examples/tmp/tiles/7_41_77.png +0 -0
  248. data/examples/tmp/tiles/7_41_78.png +0 -0
  249. data/examples/tmp/tiles/7_41_79.png +0 -0
  250. data/examples/tmp/tiles/7_41_80.png +0 -0
  251. data/examples/tmp/tiles/7_41_81.png +0 -0
  252. data/examples/tmp/tiles/7_41_82.png +0 -0
  253. data/examples/tmp/tiles/7_41_83.png +0 -0
  254. data/examples/tmp/tiles/7_41_84.png +0 -0
  255. data/examples/tmp/tiles/7_41_85.png +0 -0
  256. data/examples/tmp/tiles/7_41_86.png +0 -0
  257. data/examples/tmp/tiles/7_41_87.png +0 -0
  258. data/examples/tmp/tiles/7_42_71.png +0 -0
  259. data/examples/tmp/tiles/7_42_72.png +0 -0
  260. data/examples/tmp/tiles/7_42_73.png +0 -0
  261. data/examples/tmp/tiles/7_42_74.png +0 -0
  262. data/examples/tmp/tiles/7_42_75.png +0 -0
  263. data/examples/tmp/tiles/7_42_76.png +0 -0
  264. data/examples/tmp/tiles/7_42_77.png +0 -0
  265. data/examples/tmp/tiles/7_42_78.png +0 -0
  266. data/examples/tmp/tiles/7_42_79.png +0 -0
  267. data/examples/tmp/tiles/7_42_80.png +0 -0
  268. data/examples/tmp/tiles/7_42_81.png +0 -0
  269. data/examples/tmp/tiles/7_42_82.png +0 -0
  270. data/examples/tmp/tiles/7_42_83.png +0 -0
  271. data/examples/tmp/tiles/7_42_84.png +0 -0
  272. data/examples/tmp/tiles/7_42_85.png +0 -0
  273. data/examples/tmp/tiles/7_42_86.png +0 -0
  274. data/examples/tmp/tiles/7_42_87.png +0 -0
  275. data/examples/tmp/tiles/7_43_71.png +0 -0
  276. data/examples/tmp/tiles/7_43_72.png +0 -0
  277. data/examples/tmp/tiles/7_43_73.png +0 -0
  278. data/examples/tmp/tiles/7_43_74.png +0 -0
  279. data/examples/tmp/tiles/7_43_75.png +0 -0
  280. data/examples/tmp/tiles/7_43_76.png +0 -0
  281. data/examples/tmp/tiles/7_43_77.png +0 -0
  282. data/examples/tmp/tiles/7_43_78.png +0 -0
  283. data/examples/tmp/tiles/7_43_79.png +0 -0
  284. data/examples/tmp/tiles/7_43_80.png +0 -0
  285. data/examples/tmp/tiles/7_43_81.png +0 -0
  286. data/examples/tmp/tiles/7_43_82.png +0 -0
  287. data/examples/tmp/tiles/7_43_83.png +0 -0
  288. data/examples/tmp/tiles/7_43_84.png +0 -0
  289. data/examples/tmp/tiles/7_43_85.png +0 -0
  290. data/examples/tmp/tiles/7_43_86.png +0 -0
  291. data/examples/tmp/tiles/7_43_87.png +0 -0
  292. data/examples/tmp/tiles/7_44_71.png +0 -0
  293. data/examples/tmp/tiles/7_44_72.png +0 -0
  294. data/examples/tmp/tiles/7_44_73.png +0 -0
  295. data/examples/tmp/tiles/7_44_74.png +0 -0
  296. data/examples/tmp/tiles/7_44_75.png +0 -0
  297. data/examples/tmp/tiles/7_44_76.png +0 -0
  298. data/examples/tmp/tiles/7_44_77.png +0 -0
  299. data/examples/tmp/tiles/7_44_78.png +0 -0
  300. data/examples/tmp/tiles/7_44_79.png +0 -0
  301. data/examples/tmp/tiles/7_44_80.png +0 -0
  302. data/examples/tmp/tiles/7_44_81.png +0 -0
  303. data/examples/tmp/tiles/7_44_82.png +0 -0
  304. data/examples/tmp/tiles/7_44_83.png +0 -0
  305. data/examples/tmp/tiles/7_44_84.png +0 -0
  306. data/examples/tmp/tiles/7_44_85.png +0 -0
  307. data/examples/tmp/tiles/7_44_86.png +0 -0
  308. data/examples/tmp/tiles/7_44_87.png +0 -0
  309. data/examples/tmp/tiles/7_75_64.png +0 -0
  310. data/examples/tmp/tiles/7_75_65.png +0 -0
  311. data/examples/tmp/tiles/7_75_66.png +0 -0
  312. data/examples/tmp/tiles/7_75_67.png +0 -0
  313. data/examples/tmp/tiles/7_75_68.png +0 -0
  314. data/examples/tmp/tiles/7_76_64.png +0 -0
  315. data/examples/tmp/tiles/7_76_65.png +0 -0
  316. data/examples/tmp/tiles/7_76_66.png +0 -0
  317. data/examples/tmp/tiles/7_76_67.png +0 -0
  318. data/examples/tmp/tiles/7_76_68.png +0 -0
  319. data/examples/tmp/tiles/7_77_64.png +0 -0
  320. data/examples/tmp/tiles/7_77_65.png +0 -0
  321. data/examples/tmp/tiles/7_77_66.png +0 -0
  322. data/examples/tmp/tiles/7_77_67.png +0 -0
  323. data/examples/tmp/tiles/7_77_68.png +0 -0
  324. data/lib/gd/gis/basemap.rb +116 -9
  325. data/lib/gd/gis/geometry.rb +40 -0
  326. data/lib/gd/gis/layer_lines.rb +36 -0
  327. data/lib/gd/gis/layer_points.rb +31 -1
  328. data/lib/gd/gis/layer_polygons.rb +38 -0
  329. data/lib/gd/gis/map.rb +53 -33
  330. data/lib/gd/gis/projection.rb +14 -0
  331. metadata +339 -17
  332. /data/examples/{fonts → street/fonts}/DejaVu Fonts License.txt +0 -0
  333. /data/examples/{fonts → street/fonts}/DejaVuSans-Bold.ttf +0 -0
  334. /data/examples/{fonts → street/fonts}/DejaVuSans-BoldOblique.ttf +0 -0
  335. /data/examples/{fonts → street/fonts}/DejaVuSans-ExtraLight.ttf +0 -0
  336. /data/examples/{fonts → street/fonts}/DejaVuSans-Oblique.ttf +0 -0
  337. /data/examples/{fonts → street/fonts}/DejaVuSans.ttf +0 -0
  338. /data/examples/{fonts → street/fonts}/DejaVuSansCondensed-Bold.ttf +0 -0
  339. /data/examples/{fonts → street/fonts}/DejaVuSansCondensed-BoldOblique.ttf +0 -0
  340. /data/examples/{fonts → street/fonts}/DejaVuSansCondensed-Oblique.ttf +0 -0
  341. /data/examples/{fonts → street/fonts}/DejaVuSansCondensed.ttf +0 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -5,6 +5,7 @@ module GD
5
5
  module GIS
6
6
  class Basemap
7
7
  TILE_SIZE = 256
8
+ attr_reader :origin_x, :origin_y
8
9
 
9
10
  def initialize(zoom, bbox, provider=:carto_light)
10
11
  @zoom = zoom
@@ -12,8 +13,93 @@ module GD
12
13
  @provider = provider
13
14
  end
14
15
 
15
- def url(z,x,y)
16
- "https://tile.openstreetmap.org/#{z}/#{x}/#{y}.png"
16
+ def url(z, x, y, style = :osm)
17
+ case style
18
+
19
+ # ==============================
20
+ # OpenStreetMap
21
+ # ==============================
22
+ when :osm
23
+ "https://tile.openstreetmap.org/#{z}/#{x}/#{y}.png"
24
+
25
+ when :osm_hot
26
+ "https://tile.openstreetmap.fr/hot/#{z}/#{x}/#{y}.png"
27
+
28
+ when :osm_fr
29
+ "https://a.tile.openstreetmap.fr/osmfr/#{z}/#{x}/#{y}.png"
30
+
31
+ # ==============================
32
+ # CARTO
33
+ # ==============================
34
+ when :carto_light
35
+ "https://a.basemaps.cartocdn.com/light_all/#{z}/#{x}/#{y}.png"
36
+
37
+ when :carto_light_nolabels
38
+ "https://a.basemaps.cartocdn.com/light_nolabels/#{z}/#{x}/#{y}.png"
39
+
40
+ when :carto_dark
41
+ "https://a.basemaps.cartocdn.com/dark_all/#{z}/#{x}/#{y}.png"
42
+
43
+ when :carto_dark_nolabels
44
+ "https://a.basemaps.cartocdn.com/dark_nolabels/#{z}/#{x}/#{y}.png"
45
+
46
+ # ==============================
47
+ # ESRI / ArcGIS (Satellite, terrain, hybrid)
48
+ # ==============================
49
+ when :esri_satellite
50
+ "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/#{z}/#{y}/#{x}"
51
+
52
+ when :esri_streets
53
+ "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/#{z}/#{y}/#{x}"
54
+
55
+ when :esri_terrain
56
+ "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/#{z}/#{y}/#{x}"
57
+
58
+ when :esri_hybrid
59
+ "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/#{z}/#{y}/#{x}"
60
+
61
+ # ==============================
62
+ # STAMEN
63
+ # ==============================
64
+ when :stamen_toner
65
+ "https://stamen-tiles.a.ssl.fastly.net/toner/#{z}/#{x}/#{y}.png"
66
+
67
+ when :stamen_toner_lite
68
+ "https://stamen-tiles.a.ssl.fastly.net/toner-lite/#{z}/#{x}/#{y}.png"
69
+
70
+ when :stamen_terrain
71
+ "https://stamen-tiles.a.ssl.fastly.net/terrain/#{z}/#{x}/#{y}.png"
72
+
73
+ when :stamen_watercolor
74
+ "https://stamen-tiles.a.ssl.fastly.net/watercolor/#{z}/#{x}/#{y}.jpg"
75
+
76
+ # ==============================
77
+ # OpenTopoMap
78
+ # ==============================
79
+ when :topo
80
+ "https://a.tile.opentopomap.org/#{z}/#{x}/#{y}.png"
81
+
82
+ # ==============================
83
+ # Wikimedia
84
+ # ==============================
85
+ when :wikimedia
86
+ "https://maps.wikimedia.org/osm-intl/#{z}/#{x}/#{y}.png"
87
+
88
+ # ==============================
89
+ # OpenRailwayMap
90
+ # ==============================
91
+ when :railway
92
+ "https://tiles.openrailwaymap.org/standard/#{z}/#{x}/#{y}.png"
93
+
94
+ # ==============================
95
+ # CyclOSM
96
+ # ==============================
97
+ when :cyclosm
98
+ "https://a.tile-cyclosm.openstreetmap.fr/cyclosm/#{z}/#{x}/#{y}.png"
99
+
100
+ else
101
+ raise "Unknown basemap style: #{style}"
102
+ end
17
103
  end
18
104
 
19
105
  def lon2tile(lon)
@@ -36,30 +122,51 @@ module GD
36
122
  @x_min = x_min
37
123
  @y_min = y_min
38
124
 
125
+ @origin_x = x_min * TILE_SIZE
126
+ @origin_y = y_min * TILE_SIZE
127
+
39
128
  FileUtils.mkdir_p("tmp/tiles")
40
129
 
41
130
  tiles = []
42
131
 
43
132
  (x_min..x_max).each do |x|
44
133
  (y_min..y_max).each do |y|
45
- path = "tmp/tiles/#{@zoom}_#{x}_#{y}.png"
46
- unless File.exist?(path)
47
- uri = URI(url(@zoom,x,y))
134
+ path = nil
135
+
136
+ unless File.exist?("tmp/tiles/#{@provider}_#{@zoom}_#{x}_#{y}.png") ||
137
+ File.exist?("tmp/tiles/#{@provider}_#{@zoom}_#{x}_#{y}.jpg")
138
+
139
+ uri = URI(url(@zoom, x, y, @provider))
48
140
 
49
141
  Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
50
142
  req = Net::HTTP::Get.new(uri)
51
143
  req["User-Agent"] = "libgd-gis/0.1 (Ruby)"
52
144
 
53
145
  res = http.request(req)
146
+ raise "Tile fetch failed #{res.code}" unless res.code == "200"
147
+
148
+ content_type = res["content-type"]
54
149
 
55
- unless res.code == "200"
56
- raise "Tile fetch failed #{res.code}"
57
- end
150
+ ext =
151
+ if content_type&.include?("png")
152
+ "png"
153
+ elsif content_type&.include?("jpeg") || content_type&.include?("jpg")
154
+ "jpg"
155
+ else
156
+ raise "Unsupported tile type: #{content_type}"
157
+ end
58
158
 
159
+ path = "tmp/tiles/#{@provider}_#{@zoom}_#{x}_#{y}.#{ext}"
59
160
  File.binwrite(path, res.body)
60
161
  end
61
-
162
+ else
163
+ if File.exist?("tmp/tiles/#{@provider}_#{@zoom}_#{x}_#{y}.png")
164
+ path = "tmp/tiles/#{@provider}_#{@zoom}_#{x}_#{y}.png"
165
+ else
166
+ path = "tmp/tiles/#{@provider}_#{@zoom}_#{x}_#{y}.jpg"
167
+ end
62
168
  end
169
+
63
170
  tiles << [x,y,path]
64
171
  end
65
172
  end
@@ -0,0 +1,40 @@
1
+ module GD
2
+ module GIS
3
+ module Geometry
4
+ def self.buffer_line(coords, meters)
5
+ left = []
6
+ right = []
7
+
8
+ coords.each_cons(2) do |a,b|
9
+ x1,y1 = a
10
+ x2,y2 = b
11
+
12
+ dx = x2 - x1
13
+ dy = y2 - y1
14
+
15
+ len = Math.sqrt(dx*dx + dy*dy)
16
+ next if len == 0
17
+
18
+ # normal vector
19
+ nx = -dy / len
20
+ ny = dx / len
21
+
22
+ # offset in degrees (approx)
23
+ # 1 meter ≈ 1 / 111_320 degrees
24
+ off = meters / 111_320.0
25
+
26
+ left << [x1 + nx*off, y1 + ny*off]
27
+ right << [x1 - nx*off, y1 - ny*off]
28
+ end
29
+
30
+ # add last point
31
+ x2,y2 = coords.last
32
+ left << [x2, y2]
33
+ right << [x2, y2]
34
+
35
+ polygon = left + right.reverse
36
+ polygon
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,36 @@
1
+ module GD
2
+ module GIS
3
+ class LinesLayer
4
+ def initialize(features, stroke:, width:)
5
+ @features = features
6
+ @stroke = stroke
7
+ @width = width
8
+ end
9
+
10
+ def render!(img, projection)
11
+ @features.each do |f|
12
+ geom = f["geometry"]
13
+
14
+ case geom["type"]
15
+ when "LineString"
16
+ draw_line(geom["coordinates"], img, projection)
17
+ when "MultiLineString"
18
+ geom["coordinates"].each do |line|
19
+ draw_line(line, img, projection)
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ def draw_line(coords, img, projection)
26
+ pts = coords.map { |p| projection.call(p[0], p[1]) }
27
+
28
+ (0...pts.size-1).each do |i|
29
+ x1,y1 = pts[i]
30
+ x2,y2 = pts[i+1]
31
+ img.line(x1,y1,x2,y2,@stroke, thickness: @width)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -5,7 +5,12 @@ module GD
5
5
  @data = data
6
6
  @lon = lon
7
7
  @lat = lat
8
- @icon = GD::Image.open(icon)
8
+
9
+ if icon
10
+ @icon = GD::Image.open(icon)
11
+ else
12
+ @icon = build_default_marker
13
+ end
9
14
 
10
15
  @label = label
11
16
  @font = font
@@ -16,6 +21,31 @@ module GD
16
21
  @icon.save_alpha = true
17
22
  end
18
23
 
24
+ def build_default_marker
25
+ size = 32
26
+ img = GD::Image.new(size, size)
27
+ img.alpha_blending = true
28
+ img.save_alpha = true
29
+
30
+ transparent = GD::Color.rgba(0,0,0,0)
31
+ img.filled_rectangle(0,0,size,size,transparent)
32
+
33
+ white = GD::Color.rgb(255,255,255)
34
+ black = GD::Color.rgb(0,0,0)
35
+
36
+ cx = size / 2
37
+ cy = size / 2
38
+ r = 12
39
+
40
+ # borde blanco
41
+ img.arc(cx, cy, r*2+4, r*2+4, 0, 360, white)
42
+
43
+ # relleno negro
44
+ img.filled_arc(cx, cy, r*2, r*2, 0, 360, black)
45
+
46
+ img
47
+ end
48
+
19
49
  def render!(img, projector)
20
50
  w = @icon.width
21
51
  h = @icon.height
@@ -0,0 +1,38 @@
1
+ module GD
2
+ module GIS
3
+ class PolygonsLayer
4
+ def initialize(polygons, fill:, stroke: nil, width: nil)
5
+ @polygons = polygons
6
+ @fill = fill
7
+ @stroke = stroke
8
+ @width = width
9
+ end
10
+
11
+ def self.from_lines(features, stroke:, fill:, width:)
12
+ polys = []
13
+
14
+ features.each do |f|
15
+ coords = f["geometry"]["coordinates"]
16
+ poly = Geometry.buffer_line(coords, width)
17
+ polys << poly
18
+ end
19
+
20
+ new(polys, fill: fill, stroke: stroke)
21
+ end
22
+
23
+ def render!(img, projection)
24
+ @polygons.each do |poly|
25
+ pts = poly.map { |p| projection.call(p[0], p[1]) }
26
+
27
+ img.filled_polygon(pts, @fill)
28
+
29
+ if @stroke
30
+ pts.each_cons(2) do |a,b|
31
+ img.line(a[0],a[1],b[0],b[1],@stroke, thickness: 1)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end