Un ejemplo práctico =================== Supongamos que nos interesa un mapa turístico de una página web. La mayoría están elaborados con *Google Maps API*, pero no se nos facilita ningún mecanismo para exportarlos a nuestra cuenta y verlos en `Google Maps`_ o *Google Earth*. Sin embargo, sí que podemos examinar el código fuente y buscar las coordenadas: .. image:: ../img/japan-guide-code-mod.png En el mapa aparecen globos indicando los lugares principales en rojo, y los secundarios en azul. En este mismo color, un camino que los recorre. Pues bien, copiamos las coordenadas y escribimos unas instrucciones tal que así:: putAttraction ( ( "Ginkakuji" "45 minutes - Ginkaku-ji (銀閣寺, Silver Pavilion) is a Zen temple..." (35.027167445406256,135.7973027229309) ) ("Honenin" (35.02399577177208,135.79739391803741)) ( "Along the Philosopher's Path" "90 minutes - The Philosopher's Path (哲学の道, Tetsugaku no michi) starts just outside the approach to Ginkakuji..." (35.022941448576944,135.79561293125153) ) ) putAddition ( ( "Gion" "Gion (祇園). Check out the historical Gion entertainment district..." (35.00270020093859,135.77486336231232) ) ( "Sanjusangendo" "Sanjusangendo (三十三間堂, Sanjūsangendō) is an interesting temple that houses 1001 statues of the Buddhist goddess..." (34.987868671665495,135.77174127101898) ) ) drawPath ( "Eastern Kyoto Full Day" "The following is a suggested full day itinerary for medium paced travelers that leads..." (35.0271718382207,135.79727590084076) (35.02717623103489,135.79579532146454) (35.02722894478686,135.79511940479279) (35.027220159163896,135.79498529434204) ) He omitido muchos lugares para que no interrumpan la lectura de este texto. Los lugares más interesantes se crean mediante la instrucción putAttraction, y los secundarios con putAddition. La última, drawPath, dibuja el camino. Guardamos lo anterior como *input-instructions.txt*, y ejecutamos *pymappu*:: D:\>pymappu-windows -i input-instructions.txt -ienc utf-8 -o mymap lat_lon --path_ends_placemark_merge Warning: --path_ends_placemark_merge is present but --merge_limit is absent. Assigning default value of 10.000000 meters. Expr rule correctly parsed En entornos Unix utilizaríamos *pymappu-unix* en lugar de *pymappu-windows*. Se genera una salida KML (en el ejemplo, el fichero *mymap.kml*):: Ginkakuji 45 minutes - Ginkaku-ji (銀閣寺, Silver Pavilion) is a Zen temple... #pathStartStyle 135.797275901,35.0271718382,0 Honenin #attractionStyle 135.797393918,35.0239957718,0 Along the Philosopher's Path 90 minutes - The Philosopher's Path (哲学の道, Tetsugaku no michi) starts just outside the approach to Ginkakuji... #attractionStyle 135.795612931,35.0229414486,0 Gion Gion (祇園). Check out the historical Gion entertainment district... #additionStyle 135.774863362,35.0027002009,0 Sanjusangendo Sanjusangendo (三十三間堂, Sanjūsangendō) is an interesting temple that houses 1001 statues of the Buddhist goddess... #additionStyle 135.771741271,34.9878686717,0 Eastern Kyoto Full Day The following is a suggested full day itinerary for medium paced travelers that leads... #pathStyle 135.797275901,35.0271718382,0 135.795795321,35.027176231,0 135.795119405,35.0272289448,0 135.794985294,35.0272201592,0 Importamos este fichero KML desde *Google Maps* (o *Earth*), y el resultado es el siguiente: .. image:: ../img/resultado-google-maps-mod.png Tenemos el mismo mapa de la página web, importado en nuestra cuenta. Esto es ventajoso: * La ventana es más grande, y por tanto, más cómoda. * Modificaciones: cambio de colores y posiciones, adición de otros puntos.. * Uso como guía turística y orientación en un móvil *Android* / *iOS* con GPS. Probablemente lo más interesante. .. _Google Maps: https://maps.google.com