2 Summary: Create links to various map sites from provided gps coordinates.
6 Maintainer: [[~Anomen]]
7 Users: {{$FullName}-Users$Rating2} ([[{$FullName}-Users|View]] / [[{$FullName}-Users?action=edit|Edit]])
9 Discussion: [[{$Name}-Talk]]
11 !! Questions answered by this recipe
12 How to automatically create links for given gps coordinates to various map sites.
16 Recipe creates links to various map sites from provided gps coordinates.
20 Download [[(Attach:)geobox.php]].
22 In config.php, add the following line:
25 include_once("$FarmD/cookbook/geobox.php");
31 [@ (:geo 49°43.996 14°27.665 :) @]
34 ''49°43.996' 014°27.665'' [[http://www.mapy.cz/?query=49.73327N%2014.46108E | mapy.cz]] [[http://maps.google.com/?q=49.73327%2014.46108|gmaps]] [[http://www.geocaching.com/map/default.aspx?lat=49.73327&lng=14.46108|geocaching.com/maps]] [[http://www.geocaching.com/seek/nearest.aspx?lat=49.73327&lng=14.46108&f=1|geocaching.com/near]]
36 !!! Coordinate input format
37 *Coordinates consists of latitude and logitude values separated by space character(s).
38 * Values can pre prefixed or postfixed with N or S for lat. and E or W for lon.
39 * Decimal dot or coma can be used.
40 * several different characters can be used as degree sign ( * ° ˚ º ). This simpifies usage across various keyboard layouts. Note: PmWiki must be setup to use Unicode.
41 * all three formats are recognised (degrees only and mixed formats with arcmin or arcmin+arcsec)
42 * degree sign is mandatory only for mixed formats (to separate degrees and arcminutess)
44 !!!Coordinate display format
45 You can change format of displayed coordinates by using ''format'' paremater.
47 Possible values and meanings are:
52 For example, following line will produce coordinates displayed as degrees:
53 [@ (:geo format=d 49°43.996 14°27.665 :) @]
56 You can perform point projection using parameters ''azimuth'' (value in degrees) and ''distance'' (value in meters).
57 Result of projection will be displayed (together with proper links) instead of original given coordinates.
59 For example, following line will produce coordinates @@ 50.00949 15.18703 @@:
61 [@ (:geo format=d azimuth=45 distance=2703 49.99232 15.16031 :) @]
68 You can modify list of links by changing @@$GeoBoxLinks@@ array.
70 : disable list : @@$GeoBoxLinks = array();@@
71 : remove link : @@unset($GeoBoxLinks['mapy.cz']);@@
72 : add link : @@SDVA($GeoBoxLinks, array('title'=>'http://example.com/maps'));@@
73 : replace list: @@$GeoBoxLinks = array('title'=>'http://example.com/maps');@@
75 In link address you can use these variables (prefixed by @@$@@ sign):
76 : LAT : hemisphere N / S
79 : Nd : latitude (absolute value)
80 : Ni : latitude (integer part only)
81 : Ndi : latitude (absolute value, integer part only)
82 : NSig : sign for N (empty for north, - for south)
83 : Nm : minutes of N (absolute value)
84 : Nmi : minutes of N (absolute value, integer part only)
85 : Ns : : seconds of N (absolute value)
86 : Nsi : seconds of N (absolute value, integer part only)
88 : LON : hemisphere E / W
89 : E : longitude - ''all values analogical to latitude''
100 -> Note: Either apostrophes must be used as string delimiters instead of double quotes or proper @@$@@ escaping must be used to avoid expanding of variables by PHP.
103 * print coordinates and link to google maps
106 include_once("$FarmD/cookbook/geobox.php");
107 $GeoBoxLinks = array('maps.google.com'=>'http://maps.google.com/?q=$N%20$E');
110 * add link to mapquest.com
113 include_once("$FarmD/cookbook/geobox.php");
114 SDVA($GeoBoxLinks, array('mapquest'=>'http://www.mapquest.com/?q=$N,$E&zoom=15'));
119 !! Change log / Release notes
120 * 2010-06-12 - added to PmWiki Cookbook
121 * 2011-08-22 - point projection, configurable link list and various improvements
122 * 2011-10-05 - utf8 handling, various fixes
126 : git repository : http://repo.or.cz/w/anomen-overlay.git/tree/HEAD:/www-apps/pmwiki/cookbook/Geobox
129 * http://transition.fcc.gov/mb/audio/bickel/sprong.html
130 * http://www.movable-type.co.uk/scripts/latlong.html
131 * [[http://handygeocaching.googlecode.com/svn/trunk/src/gps/Gps.java | Handy Geocaching sources]]
135 * [[~Anomen]] (original author)
139 See discussion at [[{$Name}-Talk]].