README.txt 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. GMap Module
  2. ===========
  3. GMap is an API and a related set of modules which allows the integration of
  4. Google Maps with a Drupal site.
  5. gmap.module: The main module. Contains the API, the basic map functions, Views
  6. integration and an text filter to create macros into working maps with minimal
  7. effort.
  8. gmap_location.module: Provides map features for Location.module (v2 and v3).
  9. gmap_macro_builder.module: End-user UI for easily creating GMap macros.
  10. gmap_taxonomy.module: API and utility for changing map markers of for points
  11. from Location.module based on taxonomy terms.
  12. Installation
  13. ------------
  14. To install, follow the general directions available at:
  15. https://drupal.org/documentation/install/modules-themes
  16. In order to use this module, you need a (free) Google Maps API key. Here is how
  17. to get one:
  18. 1. Login using a Google account to https://code.google.com/apis/console
  19. 2. Create project
  20. 3. Go to 'Services' and turn on 'Google Maps API v2' and 'Google Maps API v3'.
  21. 4. Go to 'API Access' and copy the API Key from the "Simple API Access" section.
  22. 5. Paste the API Key into the GMap settings page at admin/config/services/gmap.
  23. You may need to make changes to your theme so that Google Maps can display
  24. correctly. See the section on "Google Maps and Quirks Mode" below.
  25. If you would like to use GMap macros directly in nodes, you will need to add
  26. the GMap Macro filter to an text format (or create a new text format that
  27. includes it). Read http://drupal.org/node/213156 for more information on text
  28. formats.
  29. If you are using the HTML filter, it will need to appear BEFORE the GMap filter;
  30. otherwise the HTML filter will remove the GMap code. To modify the order of
  31. filters in an text format, go to the "Rearrange" tab on the text format's
  32. configuration page (Administer > Configuration > Content authoring > Text
  33. formats, then click "configure" by your format).
  34. If you would like to use third party functionality such as custom marker
  35. libraries read thirdparty/README.txt for download links and instructions.
  36. If you are translating this module to a different language also see the
  37. gmap.strings.php file for further installation instructions. This is required
  38. for translation of marker type strings to work.
  39. Google Maps and Quirks Mode
  40. ---------------------------
  41. Google Maps may have rendering issues when a doctype is not declared on your
  42. site. Specifically, Google Maps will have problems when the browser is using
  43. "quirks mode". To render pages in "standards compliant mode", use either an
  44. HTML5 doctype or XHTML Strict doctype as the first line of your HTML:
  45. HTML5 doctype:
  46. <!DOCTYPE html>
  47. XHTML Strict doctype:
  48. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  49. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  50. Views Integration
  51. -----------------
  52. The GMap module includes built-in integration with the Views module. You can use
  53. this to turn any list of nodes, users, or other content into a Google Map that
  54. plots each item on a map.
  55. To make a GMap-based view, create or edit a view under Administer > Structure >
  56. Views. Under the "Format" section, change the format by clicking on the current
  57. format type (usually "Unformatted list"). Then change the format type to either
  58. "GMap" or "Extended GMap".
  59. For each view you create that uses a GMap format, you may either use a custom
  60. configuration or inherit the site-wide defaults. To make an advanced map
  61. configuration, you may type or copy/paste a GMap macro into the "Macro" textarea
  62. at the top of the GMap format configuration settings. See the section on
  63. "Macros" for more information about how to customize the configuration of your
  64. map using these powerful tools. If you don't want a custom configuration for
  65. this view, just leave the default value for the Macro field.
  66. The only other critically important setting when configuring a GMap format in
  67. Views is the "Data Source" field. GMap can accept data from several different
  68. sources, but ultimately it comes down to acquiring a latitude and longitude pair
  69. for each item being displayed in the list. GMap module can acquire the lat/long
  70. pair from any of the following sources:
  71. - Location.module
  72. - Geofield.module
  73. - Geolocation.module
  74. - or a pair of simple text or number fields
  75. If you use the pair of text fields, you must also change your view to use a list
  76. of fields. To do this, under the "Format" section of the view configuration,
  77. click on the current row display style (usually the word "Content") and change
  78. it to "Fields". Then under the "Fields" section of the view configuration, add
  79. the fields you're using to store the latitude and longitude (they must be two
  80. separate fields). It may be a good idea to use the "Exclude from display" option
  81. on each of these fields, so they aren't shown in the actual GMap marker popups.
  82. Macros
  83. ------
  84. "GMap macros" are text-based representations of Google Maps. A GMap macro can be
  85. created with the GMap Macro Builder tool or by hand. Any map parameter not
  86. specified by a macro will use the defaults from the GMap settings page
  87. (Administer > Site configuration > Web services > GMap). There are several
  88. places where you may use Gmap macros, including:
  89. 1) GMap settings, like the GMap Location module's settings page.
  90. 2) Any node where the GMap filter is enabled (as part of the text format).
  91. A GMap macro will look something like this (see the advanced help pages (or the
  92. files in help/ in the module folder) for syntax details):
  93. [gmap markers=blue::41.902277040963696,-87.6708984375 |zoom=5 |center=42.94033923363183,-88.857421875 |width=300px |height=200px |control=Small |type=Map]
  94. The GMap Macro Builder is a GUI for creating GMap macros; you may use it to
  95. create a map with points, lines, polygons, and circles, and then copy and paste
  96. the resulting macro text. After you insert the macro into a node, you can edit
  97. it using raw values that you get from elsewhere to create a different set of
  98. points or lines on the map.
  99. If you've enabled the gmap_macro_builder.module, you can access the GMap macro
  100. builder at the 'map/macro' path (there will be "Build a GMap macro" link in your
  101. Navigation menu).
  102. Note that there are many more options you can set on your maps if you are
  103. willing to edit macros by hand. For example, you may add KML or GeoRSS overlays
  104. to GMaps, but this option isn't available through the macro builder. Again, see
  105. the advanced help pages for syntax details.
  106. User and node maps
  107. ------------------
  108. User and node location maps are made available by gmap_location.module, and work
  109. in conjunction with location.module. Any user that has the 'view user map' or
  110. 'view node map' permission can see the user or node maps, respectively. These
  111. are maps with a marker for every user or node, and are located at the 'map/user'
  112. and 'map/node' paths (links to these maps are placed in the Navigation menu).
  113. Users with the 'view user location details' permission can click markers on the
  114. User map to see information on individual users.
  115. GMap Location also provides two map blocks that work with node locations: a
  116. "Location map" block that displays the location markers associated with the node
  117. being viewed, and an "Author map" block that displays a marker representing the
  118. node author's location.
  119. GMap Location provides an interactive Google Map to the Location module for
  120. setting the latitude and longitude; users must have Location's
  121. "submit latitude/longitude" to use this feature.
  122. Markers
  123. -------
  124. The 'markers' directory contains many useful markers, and you can add custom
  125. markers by placing PNG files (markers must be in PNG format) in the markers
  126. directory and creating a ".ini" file for them. Use the existing .ini files as a
  127. guide--start with "markers/colors.ini".
  128. Support
  129. -------
  130. For feature requests and bug reports, please file an issue in the GMap module
  131. issue tracker at http://drupal.org/project/issues/gmap