Google Maps for ExpressionEngine
1273 | 1274 |-
1275 |
- Version 1276 | 1277 |
- 2.5 1278 |
- Last update 1279 |
- 1/31/2012 1280 |
Description
1285 | 1286 |
1287 |
1288 | This plugin combines the familiar syntax of the exp:channel:entries tag
(all of the parameters are available) combined with all the properties used to initialize Google Maps, thus making the process very familiar. This plugin requires no JavaScript or PHP to implement dynamic or static maps. You can plot locations using custom fields from your channels, or just a static address on the contact page right within your EE templates.
Table of Contents
1295 | 1296 | 1446 |Overview
1451 | 1452 | 1453 |1454 | Using ExpressionEngine to manage pages and content saves hours of time, but using it to manage locations can prove to be a bigger challenge than first meets the eye. The possibilities of the clients' desires are endless, but all revolve around publishing and retrieving data from the channels module, and plotting the address' within a Google Map (now using API v3 with mobile support).
1455 |
1456 | This plugin aims to take the pain out of that entire process by using the familiar syntax as the channel:entries
tag (all of the parameters are available) combined with all the properties used to initialize Google Maps, thus making the process very familiar. This plugin requires no JavaScript or PHP to implement and no knew knowledge outside of the channel tag and the desired properties of Google Map.
1458 | 1459 | Note, the Google Maps JavaScript library is required to be included (in the head presumably) on your page. This plugin does not include the file.
1460 | 1461 | 1462 |Features
1466 | 1467 | Combines all thechannel:entries
parameters with all the Google Maps properties
1468 | Use EE backend to plot map coordinates
1469 | Auto zooms and centers map around the points dynamically (if desired)
1470 | Can adapt any channel with address' to plot within the map
1471 | Absolutely no SQL, PHP, or JavaScript knowledge necessary
1472 | Customizable info windows (popups within the map)
1473 | This is the easiest Google Maps implementation out there
1474 | Customizable controls, styles, map types, and more
1475 | No dependent JS files
1476 |
1477 | Installation
1483 | 1484 |-
1486 |
- 1487 | Copy gmap plugin folder to your /system/expressionengine/third_party/ folder. 1488 | 1489 |
- 1490 | If you desire to use the fieldtype, install it by going to Addons > Fieldtypes > Google Maps for ExpressionEngine > Install 1491 |
-
1492 | Include this in the
head
of your document: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
1493 |
1494 | - 1495 | Refer to the Google Maps examples for additional information. 1496 |
1499 |
1500 | 1501 | 1502 |Methods
1508 | 1509 |-
1510 |
1511 |
- {exp:gmap:init} 1512 | 1513 |
- {exp:gmap:marker} 1514 | 1515 |
- {exp:gmap:center} 1516 | 1517 |
- {exp:gmap:zoom} 1518 | 1519 |
{exp:gmap:init}
1526 | 1527 |
1530 | This is the main and primary method used to create Google Maps. This method is also an alias to the exp:channel:entries
method anytime the channel
parameter is defined. Meaning, if the channel
parameter is defined, all of same parameters can that would normally be used with the exp:channel:entries
method can be used with the exp:gmap
method in addition to all the properties used to initialize a Google Map.
1533 | Do not use this method with the channel
attribute if your are nesting the exp:gmap
method inside the exp:channel:entries
method. This will result two nested exp:channel:entries
methods. This is not advisable. However, if the channel
attribute is not present, you may include <code>exp:gmap</code> inside the exp:channel:entries
tag.
-
1539 |
1540 |
-
1541 |
1542 | 1543 | 1544 | id 1545 | 1546 | 1554 | 1555 |1556 | 1557 |1558 | 1559 |1574 | 1575 |
Description
1560 | 1561 | 1562 |1563 | The
1564 | 1565 | 1566 |id
must be a unique string, and is used to create the JavaScript variables for the map, and assigned to the map element (div). You must use only alphabetical and numerical characters with the exception of underscores.Code Examples
1567 | 1568 |1569 | {exp:gmap:init id="map_demo" address="Denver, CO"} 1570 | 1571 |
1572 | 1573 |
1576 |
1577 | -
1578 |
1579 | 1580 | 1581 | class 1582 | 1583 | 1591 | 1592 |1593 | 1594 |1595 | 1596 |1611 | 1612 |
Description
1597 | 1598 | 1599 |1600 | This is the
1601 | 1602 | 1603 |class
attribute that will be appended to the map.Code Examples
1604 | 1605 |1606 | {exp:gmap:init id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" class="map"} 1607 |
1608 | 1609 | 1610 |
1613 |
1614 | -
1615 |
1616 | 1617 | 1618 | style 1619 | 1620 | 1628 | 1629 |1630 | 1631 |1632 | 1633 |1647 | 1648 | 1649 |
Description
1634 | 1635 |1636 | 1637 | This is the
1638 | 1639 | 1640 |style
attribute that will be appended to the map.Code Examples
1641 | 1642 |1643 | {exp:gmap:init id="map_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" style="width:400px; height:300px"} 1644 |
1645 | 1646 |
1650 |
1651 | -
1652 |
1653 | 1654 | 1655 | address 1656 | 1657 | 1665 | 1666 |1667 | 1668 |1669 | 1670 |1685 | 1686 |
Description
1671 | 1672 |1673 | 1674 | The
1675 | 1676 | 1677 |address
is required to create a static map unless you define alatitude
andlongitude
.Code Examples
1678 | 1679 |1680 | 1681 | {exp:gmap:init id="map_demo" address="Denver, CO"} 1682 |
1683 | 1684 |
1687 |
1688 | -
1689 |
1690 | 1691 | 1692 | latitude 1693 | 1694 | 1702 | 1703 |1704 | 1705 |1706 | 1707 | 1708 |1722 | 1723 |
Description
1709 | 1710 |1711 | You can define a single latitude and longitude degree if you don't need to use the geocoder.
1712 | 1713 | 1714 |Code Examples
1715 | 1716 |1717 | {exp:gmap:init id="map_canvas" latitude="0" longitude="0"} 1718 | 1719 |
1720 | 1721 |
1724 |
1725 | -
1726 |
1727 | 1728 | 1729 | longitude 1730 | 1731 | 1739 | 1740 |1741 | 1742 |1743 | 1744 |1759 | 1760 |
Description
1745 | 1746 | 1747 |1748 | You can define a single latitude and longitude degree if you don't need to use the geocoder.
1749 | 1750 | 1751 |Code Examples
1752 | 1753 |1754 | {exp:gmap:init id="map_canvas" latitude="0" longitude="0"} 1755 |
1756 | 1757 | 1758 |
1761 |
1762 | -
1763 |
1764 | 1765 | 1766 | center 1767 | 1768 | 1776 | 1777 |1778 | 1779 |1780 | 1781 |1796 | 1797 |
Description
1782 | 1783 |1784 | 1785 | When the
1786 | 1787 | 1788 |center
is set, it will override the default center location.Code Examples
1789 | 1790 |1791 | {exp:gmap:init id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN"} 1792 |
1793 | 1794 | 1795 |
1798 |
1799 | -
1800 |
1801 | 1802 | 1803 | zoom 1804 | 1805 | 1813 | 1814 |1815 | 1816 |1817 | 1818 |1833 | 1834 |
Description
1819 | 1820 |1821 | 1822 | The
1823 | 1824 | 1825 |zoom
the same field that the Google Maps API implements.Code Examples
1826 | 1827 |1828 | {exp:gmap:init id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" zoom="5"} 1829 |
1830 | 1831 | 1832 |
1835 |
1836 | -
1837 |
1838 | 1839 | 1840 | map_type 1841 | 1842 | 1850 | 1851 |1852 | 1853 |1854 | 1855 |1870 | 1871 |
Description
1856 | 1857 |1858 | 1859 | This attribute is an alias for the
1860 | 1861 | 1862 |mapTypeId
property of the Google Map API.Code Examples
1863 | 1864 |1865 | {exp:gmap id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" map_type="TERRAIN"} 1866 |
1867 | 1868 | 1869 |
1872 |
1873 | -
1874 |
1875 | 1876 | 1877 | address_field 1878 | 1879 | 1887 | 1888 |1889 | 1890 |1891 | 1892 |1908 | 1909 |
Description
1893 | 1894 |1895 | 1896 | The
1897 |address_field
attribute is the first part of the address string. You can use any field in thechannel
attribute is required to use this attribute.1898 | The
1899 | 1900 | 1901 |channel
attribute is required to use this attribute.Code Examples
1902 | 1903 |1904 | {exp:gmap:init id="map_demo" channel="map_demo" address_field="map_address"} 1905 |
1906 | 1907 |
1910 |
1911 | -
1912 |
1913 | 1914 | 1915 | 1916 | city_field 1917 | 1918 | 1926 | 1927 |1928 | 1929 |1930 | 1931 |1948 | 1949 |
Description
1932 | 1933 |1934 | The
1935 | 1936 |city_field
attribute is the second part of the address string. You can use any field in thechannel
attribute is required to use this attribute.1937 | The
1938 | 1939 | 1940 |channel
attribute is required to use this attribute.Code Examples
1941 | 1942 |1943 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city"} 1944 |
1945 | 1946 | 1947 |
1950 |
1951 | -
1952 |
1953 | 1954 | 1955 | state_field 1956 | 1957 | 1965 | 1966 |1967 | 1968 |1969 | 1970 |1987 | 1988 |
Description
1971 | 1972 |1973 | 1974 | The
1975 |state_field
is used for the third part of the address string. You can use any field in thechannel
.1976 | The
1977 | 1978 | 1979 |channel
attribute is required to use this attribute.Code Examples
1980 | 1981 | 1982 |1983 | {exp:gmap:init id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state"} 1984 |
1985 | 1986 |
1989 |
1990 | -
1991 |
1992 | 1993 | 1994 | zipcode_field 1995 | 1996 | 1997 | 2004 | 2005 |2006 | 2007 | 2008 |2009 | 2010 |2025 | 2026 |
Description
2011 | 2012 |2013 | The
2014 |zipcode_field
is used for the fourth part of the address string. You can use any field in thechannel
.2015 | The
2016 | 2017 | 2018 |channel
attribute is required to use this attribute.Code Examples
2019 | 2020 |2021 | {exp:gmap:init id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state" zipcode_field="map_zipcode"} 2022 |
2023 | 2024 |
2027 |
2028 | -
2029 |
2030 |
2031 | 2032 | 2033 | country_field 2034 | 2035 | 2043 | 2044 |2045 | 2046 |2047 | 2048 |2065 | 2066 |
Description
2049 | 2050 |2051 | The
2052 | 2053 |country_field
is used for the final part of the address string. You can use any field in thechannel
attribute is required to use this attribute.2054 | The
2055 | 2056 | 2057 |channel
attribute is required to use this attribute.Code Examples
2058 | 2059 |2060 | {exp:gmap:init id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state" zipcode_field="map_zipcode" country_field="map_zipcode"} 2061 |
2062 | 2063 | 2064 |
2067 |
2068 | -
2069 |
2070 | 2071 | 2072 | latitude_field 2073 | 2074 | 2082 | 2083 |2084 | 2085 |2086 | 2087 |2104 | 2105 |
Description
2088 | 2089 |2090 | 2091 | The
2092 |latitude_field
is used to retrieve the latitude from a channel, just like the address fields.2093 | The
2094 | 2095 | 2096 |channel
attribute is required to use this attribute.Code Examples
2097 | 2098 | 2099 |2100 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude"} 2101 |
2102 | 2103 |
2106 |
2107 | -
2108 |
2109 | 2110 | 2111 | longitude_field 2112 | 2113 | 2114 | 2121 | 2122 |2123 | 2124 | 2125 |2126 | 2127 |2142 | 2143 |
Description
2128 | 2129 |2130 | The
2131 |longitude_field
is used to retrieve the longitude from a channel, just like the address fields.2132 | The
2133 | 2134 | 2135 |channel
attribute is required to use this attribute.Code Examples
2136 | 2137 |2138 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude"} 2139 |
2140 | 2141 |
2144 |
2145 | -
2146 |
2147 |
2148 | 2149 | 2150 | zoom_field 2151 | 2152 | 2160 | 2161 |2162 | 2163 |2164 | 2165 |2182 | 2183 |
Description
2166 | 2167 |2168 | The
2169 | 2170 |zoom_field
is used to retrieve a custom zoom from a channel, just like the address and long/lat fields.2171 | The
2172 | 2173 | 2174 |channel
attribute is required to use this attribute.Code Examples
2175 | 2176 |2177 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude" zoom_field="map_zoom"} 2178 |
2179 | 2180 | 2181 |
2184 |
2185 | -
2186 |
2187 | 2188 | 2189 | gmap_field 2190 | 2191 | 2199 | 2200 |2201 | 2202 |2203 | 2204 |2221 | 2222 |
Description
2205 | 2206 |2207 | 2208 | The
2209 |gmap_field
is used to retrieve the longitude from a channel, just like the address fields. Except the main difference is this field specfically refers the fieldtype that is included with the plugin.2210 | The
2211 | 2212 | 2213 |channel
attribute is required to use this attribute.Code Examples
2214 | 2215 | 2216 |2217 | {exp:gmap:init id="map_canvas" channel="map_demo" gmap_field="map_gmap"} 2218 |
2219 | 2220 |
2223 |
2224 | -
2225 |
2226 | 2227 | 2228 | lat_lng 2229 | 2230 | 2231 | 2238 | 2239 |2240 | 2241 | 2242 |2243 | 2244 |2255 | 2256 | 2257 |
Description
2245 | 2246 | 2247 | 2248 |Code Examples
2249 | 2250 |2251 | {exp:gmap:init id="map_canvas" channel="map_demo" lat_lng="(0, 0)(10, 10)(20, 20)"} 2252 |
2253 | 2254 |
2258 |
2259 | -
2260 |
2261 | 2262 | 2263 | hide_markers 2264 | 2265 | 2273 | 2274 |2275 | 2276 |2277 | 2278 |2290 | 2291 |
Description
2279 | 2280 | 2281 | 2282 |Code Examples
2283 | 2284 | 2285 |2286 | {exp:gmap:init id="map_canvas" latitude="32" longitude="-85" zoom="9" hide_markers="true"} 2287 |
2288 | 2289 |
2292 |
2293 | -
2294 |
2295 | 2296 | 2297 | open_windows 2298 | 2299 | 2300 | 2307 | 2308 |2309 | 2310 | 2311 |2312 | 2313 |2324 | 2325 | 2326 |
Description
2314 | 2315 | 2316 | 2317 |Code Examples
2318 | 2319 |2320 | {exp:gmap:init id="map_canvas" latitude="32" longitude="-85" zoom="9" open_windows="true"} 2321 |
2322 | 2323 |
2327 |
2328 | -
2329 |
2330 | 2331 | 2332 | style_link 2333 | 2334 | 2342 | 2343 |2344 | 2345 |2346 | 2347 |2359 | 2360 |
Description
2348 | 2349 | 2350 | 2351 |Code Examples
2352 | 2353 | 2354 |2355 | {exp:gmap:init id="map_canvas" style_link="/-/script/gmap-styles.js" address="Canada"}Marker 1{/exp:gmap:init} 2356 |
2357 | 2358 |
2361 |
2362 | -
2363 |
2364 | 2365 | 2366 | 2367 | style_object 2368 | 2369 | 2377 | 2378 |2379 | 2380 |2381 | 2382 |2394 | 2395 |
Description
2383 | 2384 | 2385 | 2386 |Code Examples
2387 | 2388 |2389 | {exp:gmap:init id="map_canvas" style_link="/-/script/gmap-styles.js" style_object="myStyles" address="Canada"}Marker 1{/exp:gmap:init} 2390 | 2391 |
2392 | 2393 |
2396 |
2397 | -
2398 |
2399 | 2400 | 2401 | extend_bounds 2402 | 2403 | 2411 | 2412 |2413 | 2414 |2415 | 2416 |2428 | 2429 |
Description
2417 | 2418 | 2419 | 2420 | 2421 |Code Examples
2422 | 2423 |2424 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" extend_bounds="false" zoom="10"} 2425 |
2426 | 2427 |
2430 |
2431 | -
2432 |
2433 | 2434 | 2435 | 2436 | show_one_window 2437 | 2438 | 2446 | 2447 |2448 | 2449 |2450 | 2451 |2463 | 2464 |
Description
2452 | 2453 | 2454 | 2455 |Code Examples
2456 | 2457 |2458 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" show_one_window="true"} 2459 | 2460 |
2461 | 2462 |
2465 |
2466 | -
2467 |
2468 | 2469 | 2470 | icon 2471 | 2472 | 2480 | 2481 |2482 | 2483 |2484 | 2485 |2497 | 2498 |
Description
2486 | 2487 | 2488 | 2489 | 2490 |Code Examples
2491 | 2492 |2493 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" icon="/some/file/path/icon.png"} 2494 |
2495 | 2496 |
2499 |
2500 | -
2501 |
2502 | 2503 | 2504 | 2505 | show_coordinate 2506 | 2507 | 2515 | 2516 |2517 | 2518 |2519 | 2520 |2532 | 2533 |
Description
2521 | 2522 | 2523 | 2524 |Code Examples
2525 | 2526 |2527 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" show_coordinate="true"} 2528 | 2529 |
2530 | 2531 |
2534 |
2535 | -
2536 |
2537 | 2538 | 2539 | add_title_to_dropdown 2540 | 2541 | 2549 | 2550 |2551 | 2552 |2553 | 2554 |2566 | 2567 |
Description
2555 | 2556 | 2557 | 2558 | 2559 |Code Examples
2560 | 2561 |2562 | {exp:gmap:init id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" show_coordinate="true" add_title_to_dropdown="true"} 2563 |
2564 | 2565 |
2568 |
2569 |
{exp:gmap:marker}
2578 | 2579 |
2581 | This method allows you the freedom to initialize a Google Map outside of the exp:channel:entries
tag. You can save coordinates inside a Matrix table, for example, and add them to a map you have initialized.
2584 | Most of the same parameters can be used along with exp:gmap
. You can even use this method to loop through your entries with all the same channel parameters just as a exp:channel:entries
tag.
2586 | Note, if you use this method you must use it in conjunction with the exp:gmap:init
method.
-
2592 |
2593 |
-
2594 |
2595 | 2596 | 2597 | id 2598 | 2599 | 2607 | 2608 |2609 | 2610 |2611 | 2612 |2627 | 2628 |
Description
2613 | 2614 |2615 | 2616 | This should be the same value used as the
2617 | 2618 | 2619 |id
parameter used to initialize the map. This is how the method knows which map to add a marker to. This is also helpful if you have two maps on a page and want to dynamically add them to one or the other. (Why you would want to do that, I don't know, but now you can.)Code Examples
2620 | 2621 |2622 | {exp:gmap:marker id="map1" address="South Africa"}South Africa{/exp:gmap:marker} 2623 | 2624 |
2625 | 2626 |
2629 |
2630 | -
2631 |
2632 | 2633 | 2634 | address 2635 | 2636 | 2644 | 2645 |2646 | 2647 |2648 | 2649 |2664 | 2665 |
Description
2650 | 2651 | 2652 |2653 | The
2654 | 2655 | 2656 |address
is required to create a static map unless you define alatitude
andlongitude
.Code Examples
2657 | 2658 | 2659 |2660 | {exp:gmap id="map_demo" address="Denver, CO"} 2661 |
2662 | 2663 |
2666 |
2667 | -
2668 |
2669 | 2670 | 2671 | latitude 2672 | 2673 | 2674 | 2681 | 2682 |2683 | 2684 | 2685 |2686 | 2687 |2701 | 2702 |
Description
2688 | 2689 |2690 | You can define a single latitude and longitude degree if you don't need to use the geocoder.
2691 | 2692 | 2693 |Code Examples
2694 | 2695 |2696 | 2697 | {exp:gmap id="map_demo" address="Denver, CO"} 2698 |
2699 | 2700 |
2703 |
2704 | -
2705 |
2706 | 2707 | 2708 | longitude 2709 | 2710 | 2718 | 2719 |2720 | 2721 |2722 | 2723 | 2724 |2738 | 2739 |
Description
2725 | 2726 |2727 | You can define a single latitude and longitude degree if you don't need to use the geocoder.
2728 | 2729 | 2730 |Code Examples
2731 | 2732 |2733 | {exp:gmap id="map_canvas" latitude="0" longitude="0"} 2734 | 2735 |
2736 | 2737 |
2740 |
2741 | -
2742 |
2743 | 2744 | 2745 | center 2746 | 2747 | 2755 | 2756 |2757 | 2758 |2759 | 2760 |2775 | 2776 |
Description
2761 | 2762 | 2763 |2764 | When the
2765 | 2766 | 2767 |center
is set, it will override the default center location.Code Examples
2768 | 2769 |2770 | {exp:gmap id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN"} 2771 | 2772 |
2773 | 2774 |
2777 |
2778 | -
2779 |
2780 | 2781 | 2782 | zoom 2783 | 2784 | 2792 | 2793 |2794 | 2795 |2796 | 2797 |2812 | 2813 |
Description
2798 | 2799 | 2800 |2801 | The
2802 | 2803 | 2804 |zoom
the same field that the Google Maps API implements.Code Examples
2805 | 2806 |2807 | {exp:gmap id="center_demo" address="Broadripple Village, Indianapolis" center="Indianapolis, IN" zoom="5"} 2808 | 2809 |
2810 | 2811 |
2814 |
2815 | -
2816 |
2817 | 2818 | 2819 | address_field 2820 | 2821 | 2829 | 2830 |2831 | 2832 |2833 | 2834 |2850 | 2851 |
Description
2835 | 2836 | 2837 |2838 | The
2839 |address_field
attribute is the first part of the address string. You can use any field in thechannel
attribute is required to use this attribute.2840 | The
2841 | 2842 | 2843 |channel
attribute is required to use this attribute.Code Examples
2844 | 2845 |2846 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address"} 2847 |
2848 | 2849 |
2852 |
2853 | -
2854 |
2855 |
2856 | 2857 | 2858 | city_field 2859 | 2860 | 2868 | 2869 |2870 | 2871 |2872 | 2873 |2890 | 2891 |
Description
2874 | 2875 |2876 | The
2877 | 2878 |city_field
attribute is the second part of the address string. You can use any field in thechannel
attribute is required to use this attribute.2879 | The
2880 | 2881 | 2882 |channel
attribute is required to use this attribute.Code Examples
2883 | 2884 |2885 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city"} 2886 |
2887 | 2888 | 2889 |
2892 |
2893 | -
2894 |
2895 | 2896 | 2897 | state_field 2898 | 2899 | 2907 | 2908 |2909 | 2910 |2911 | 2912 |2929 | 2930 |
Description
2913 | 2914 |2915 | 2916 | The
2917 |state_field
is used for the third part of the address string. You can use any field in thechannel
.2918 | The
2919 | 2920 | 2921 |channel
attribute is required to use this attribute.Code Examples
2922 | 2923 | 2924 |2925 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state"} 2926 |
2927 | 2928 |
2931 |
2932 | -
2933 |
2934 | 2935 | 2936 | zipcode_field 2937 | 2938 | 2939 | 2946 | 2947 |2948 | 2949 | 2950 |2951 | 2952 |2967 | 2968 |
Description
2953 | 2954 |2955 | The
2956 |zipcode_field
is used for the fourth part of the address string. You can use any field in thechannel
.2957 | The
2958 | 2959 | 2960 |channel
attribute is required to use this attribute.Code Examples
2961 | 2962 |2963 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state" zipcode_field="map_zipcode"} 2964 |
2965 | 2966 |
2969 |
2970 | -
2971 |
2972 |
2973 | 2974 | 2975 | country_field 2976 | 2977 | 2985 | 2986 |2987 | 2988 |2989 | 2990 |3007 | 3008 |
Description
2991 | 2992 |2993 | The
2994 | 2995 |country_field
is used for the final part of the address string. You can use any field in thechannel
attribute is required to use this attribute.2996 | The
2997 | 2998 | 2999 |channel
attribute is required to use this attribute.Code Examples
3000 | 3001 |3002 | {exp:gmap id="map_demo" channel="map_demo" address_field="map_address" city_field="map_city" state_field="map_state" zipcode_field="map_zipcode" country_field="map_zipcode"} 3003 |
3004 | 3005 | 3006 |
3009 |
3010 | -
3011 |
3012 | 3013 | 3014 | latitude_field 3015 | 3016 | 3024 | 3025 |3026 | 3027 |3028 | 3029 |3046 | 3047 |
Description
3030 | 3031 |3032 | 3033 | The
3034 |latitude_field
is used to retrieve the latitude from a channel, just like the address fields.3035 | The
3036 | 3037 | 3038 |channel
attribute is required to use this attribute.Code Examples
3039 | 3040 | 3041 |3042 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude"} 3043 |
3044 | 3045 |
3048 |
3049 | -
3050 |
3051 | 3052 | 3053 | longitude_field 3054 | 3055 | 3056 | 3063 | 3064 |3065 | 3066 | 3067 |3068 | 3069 |3084 | 3085 |
Description
3070 | 3071 |3072 | The
3073 |longitude_field
is used to retrieve the longitude from a channel, just like the address fields.3074 | The
3075 | 3076 | 3077 |channel
attribute is required to use this attribute.Code Examples
3078 | 3079 |3080 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude"} 3081 |
3082 | 3083 |
3086 |
3087 | -
3088 |
3089 |
3090 | 3091 | 3092 | zoom_field 3093 | 3094 | 3102 | 3103 |3104 | 3105 |3106 | 3107 |3124 | 3125 |
Description
3108 | 3109 |3110 | The
3111 | 3112 |zoom_field
is used to retrieve a custom zoom from a channel, just like the address and long/lat fields.3113 | The
3114 | 3115 | 3116 |channel
attribute is required to use this attribute.Code Examples
3117 | 3118 |3119 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude="map_longitude" zoom_field="map_zoom"} 3120 |
3121 | 3122 | 3123 |
3126 |
3127 | -
3128 |
3129 | 3130 | 3131 | gmap_field 3132 | 3133 | 3141 | 3142 |3143 | 3144 |3145 | 3146 |3163 | 3164 |
Description
3147 | 3148 |3149 | 3150 | The
3151 |gmap_field
is used to retrieve the longitude from a channel, just like the address fields. Except the main difference is this field specfically refers the fieldtype that is included with the plugin.3152 | The
3153 | 3154 | 3155 |channel
attribute is required to use this attribute.Code Examples
3156 | 3157 | 3158 |3159 | {exp:gmap id="map_canvas" channel="map_demo" gmap_field="map_gmap"} 3160 |
3161 | 3162 |
3165 |
3166 | -
3167 |
3168 | 3169 | 3170 | lat_lng 3171 | 3172 | 3173 | 3180 | 3181 |3182 | 3183 | 3184 |3185 | 3186 |3200 | 3201 |
Description
3187 | 3188 |3189 | You can define a custom coordinate string with a specific format. This format is used by the fieldtype to plot the coordinates. If you need to, you can plot the string, rather than the field.
3190 | 3191 | 3192 |Code Examples
3193 | 3194 |3195 | {exp:gmap id="map_canvas" channel="map_demo" lat_lng="(0, 0)(10, 10)(20, 20)"} 3196 | 3197 |
3198 | 3199 |
3202 |
3203 | -
3204 |
3205 | 3206 | 3207 | open_windows 3208 | 3209 | 3217 | 3218 |3219 | 3220 |3221 | 3222 |3236 | 3237 | 3238 |
Description
3223 | 3224 | 3225 |3226 | If you want to open the info windows by default, set this property to true.
3227 | 3228 | 3229 |Code Examples
3230 | 3231 |3232 | {exp:gmap id="map_canvas" latitude="32" longitude="-85" zoom="9" open_windows="true"} 3233 |
3234 | 3235 |
3239 |
3240 | -
3241 |
3242 | 3243 | 3244 | extend_bounds 3245 | 3246 | 3254 | 3255 |3256 | 3257 |3258 | 3259 |3273 | 3274 | 3275 |
Description
3260 | 3261 |3262 | 3263 | By default the plugin extends the map of bounds to automically adjust the center and zoom to fit all the points. If you want to disable this feature, set this parameter
3264 | 3265 | 3266 |false
.Code Examples
3267 | 3268 |3269 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" extend_bounds="false" zoom="10"} 3270 |
3271 | 3272 |
3276 |
3277 | -
3278 |
3279 | 3280 | 3281 | show_one_window 3282 | 3283 | 3291 | 3292 |3293 | 3294 |3295 | 3296 |3310 | 3311 | 3312 |
Description
3297 | 3298 |3299 | 3300 | If you want to limit the amount of windows that are open at a time to one, set this parameter to
3301 | 3302 | 3303 |true
.Code Examples
3304 | 3305 |3306 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" show_one_window="true"} 3307 |
3308 | 3309 |
3313 |
3314 | -
3315 |
3316 | 3317 | 3318 | icon 3319 | 3320 | 3328 | 3329 |3330 | 3331 |3332 | 3333 |3347 | 3348 |
Description
3334 | 3335 |3336 | 3337 | If you want to define a custom image to use for the map icon, use this parameter.
3338 | 3339 | 3340 |Code Examples
3341 | 3342 |3343 | {exp:gmap id="map_canvas" channel="map_demo" latitude_field="map_latitude" longitude_field="map_longitude" icon="/some/file/path/icon.png"} 3344 |
3345 | 3346 |
3349 |
3350 |
3351 | -
3352 |
3353 | 3354 | 3355 | show_coordinate 3356 | 3357 | 3365 | 3366 |3367 | 3368 |
3369 |
3370 |
{exp:gmap:center}
3379 | 3380 |3383 | This is a stand-alone method that allows you to change the map's center after it's been initialized and the markers have been added.
3384 |
3385 | Note, if you intend to change the center point after the map has been initialized and points have been added, make sure you set the extend_bounds
parameter to false
.
-
3391 |
3392 |
-
3393 |
3394 | 3395 | 3396 | id 3397 | 3398 | 3406 | 3407 |3408 | 3409 |3410 | 3411 |3426 | 3427 |
Description
3412 | 3413 |3414 | 3415 | This should be the same value used as the
3416 | 3417 | 3418 |id
parameter used to initialize the map. This is how the method knows which map to add a marker to. This is also helpful if you have two maps on a page and want to dynamically add them to one or the other. (Why you would want to do that, I don't know, but now you can.)Code Examples
3419 | 3420 |3421 | {exp:gmap:center id="map_canvas" address="New Zealand"} 3422 |
3423 | 3424 | 3425 |
3428 |
3429 | -
3430 |
3431 | 3432 | 3433 | address 3434 | 3435 | 3443 | 3444 |3445 | 3446 |3447 | 3448 |3463 | 3464 |
Description
3449 | 3450 |3451 | 3452 | The
3453 | 3454 | 3455 |address
is required to center the map unless you define alatitude
andlongitude
.Code Examples
3456 | 3457 |3458 | 3459 | {exp:gmap:center id="map_canvas" address="New Zealand"} 3460 |
3461 | 3462 |
3465 |
3466 | -
3467 |
3468 | 3469 | 3470 | latitude 3471 | 3472 | 3480 | 3481 |3482 | 3483 |3484 | 3485 | 3486 |3500 | 3501 |
Description
3487 | 3488 |3489 | You can define a single latitude and longitude degree if you don't need to use the geocoder.
3490 | 3491 | 3492 |Code Examples
3493 | 3494 |3495 | {exp:gmap:center id="map_canvas" latitude="50" longitude="-21"} 3496 | 3497 |
3498 | 3499 |
3502 |
3503 |
{exp:gmap:zoom}
3512 | 3513 |3515 | This is a stand-alone method that allows you to change the map's zoom after it's been initialized and the markers have been added.
3516 |
3517 | Note, if you intend to change the zoom after the map has been initialized and points have been added, make sure you set the extend_bounds
parameter to false
.
-
3523 |
3524 |
-
3525 |
3526 | 3527 | 3528 | id 3529 | 3530 | 3538 | 3539 |3540 | 3541 |3542 | 3543 |3555 | 3556 | 3557 |
Description
3544 | 3545 | 3546 |This should be the same value used as the
3547 | 3548 |id
parameter used to initialize the map. This is how the method knows which map to add a marker to. This is also helpful if you have two maps on a page and want to dynamically add them to one or the other. (Why you would want to do that, I don't know, but now you can.)Code Examples
3549 | 3550 |3551 | {exp:gmap:zoom id="map_canvas" zoom="5"} 3552 |
3553 | 3554 |
3558 |
3559 | -
3560 |
3561 | 3562 | 3563 | zoom 3564 | 3565 | 3573 | 3574 |3575 | 3576 |3577 | 3578 |3593 | 3594 |
Description
3579 | 3580 |3581 | 3582 | The
3583 | 3584 | 3585 |zoom
sets the zoom on the map and is the property that can be found in the Google Map's API. Since it's so common, it's listed here for referrence.Code Examples
3586 | 3587 |3588 | {exp:gmap:zoom id="map_canvas" zoom="5"} 3589 | 3590 |
3591 | 3592 |
3595 |
3596 |