Awesome
CMB2 Roadway Segments
This plugin adds a new CMB2 fieldtype for drawing roadway segments onto a map and provides a shortcode for display.
Description
This plugin extends CMB2 by adding a new fieldtype called 'snapmap' that allows the user to highlight segments of roadway using Google's snap-to-road API. It also allows the user to drop a map pin in the same field. This data can then be displayed on the front-end using the [snapmap]
shortcode.
This plugin requires CMB2 and a Google Maps API key.
The Google Maps API key must have access to the Google Maps JavaScript API.
Unless you disable the associated features during plugin configutation, you will also need to enable:
- Google Maps Roads API
- Google Places API Web Service
Features
- Allows developers to integrate Google Maps with Wordpress via CMB2.
- Allows site admins to provide custom maps styles and specify which map controls to include on the front-end.
- Provides an option to exclude the Google Maps JS API if already loaded.
Usage
Visit the wiki for documentation about adding the field to CMB2 and displaying maps on your site.
Screenshots
- Plugin settings.
- The CMB2 field.
- Front-end display via shortcode.
Installation
- Upload the
cmb2-roadway-segments
folder to the/wp-content/plugins/
directory - Activate the plugin through the 'Plugins' menu in WordPress
- Add a snapmap field to a CMB2 metabox.
- Place
[snapmap]
anywhere in a post's content to render a map.
Frequently Asked Questions
Does this plugin support custom map markers?
Yes, but only by using the template tag.
Can I display a map of all map markers?
Also yes, but only by using the template tag.
Changelog
1.0.0-beta5
Changes:
- The jQuery UI theme is now loaded from CDN, matching the current bundled version of jQuery UI.
- The encoded polygon string is now fully removed, as encoded polygons now appear to break the map.
1.0.0-beta4
Changes:
- The encoded polygon string is no longer used for display. Instead, the coordinate array is used.
0.9.11
This release includes tweaks to circle geometry opacity and adds support to hide the map marker's tooltip field via a field argument.
0.9.10
This release includes an early release of the CMB2_RS_Map class, which can be used to better build complex maps.
0.9.9
Changes:
- Added a plugin option to disable features in the map editor requiring use of geocoding. If disabled, the Places API Web Service will not need to be enabled for the provided API key.
- Added a plugin option to disable snap-to-road functionality. If disabled, the Roads API will not need to be enabled for the provided key.
- Reformated over 1000 lines of code to adhere to Wordpress core code standards.
0.9.81
Added the capability of attaching content to the map by CSS ID using the snapmap_build_single() function.
0.9.8
Added the capability to display multiple maps on one page using the snapmap_build_single() function by passing a unique ID for additional maps.
0.9.71
Added the ability to enable the terrain overlay for maps generated by the snapmap_build_single() function.
0.9.7
- Added support for including retina map markers when using the snapmap_build_single() function. This is accomplished by including $marker['scaledSize']
0.9.61
GeoJSON copy-and-paste:
- Added a field to paste raw geojson type / coordinate data into (under the Tools panel below the map). If the data type is LineString, pasted data will automatically be converted into a Google Maps compatiable JSON array and overwrite the polyline (Roadway Segment) field value. This functionality will be extended to other geometry types for the 0.9.7 release.
0.9.6
- Added fallbacks for tooltips. When being used for a single post, the title of the post containing the pin is displayed in the tooltip. When using queries, the post title followed by a link to the post is displayed.
0.9.5
- Added the ability to draw polygons on the map when the "limit_drawing" argument is not set. As a result, the geometry library is now required.
- Modified circle stroke and fill lables to reflect the inclusion of polygons.
- Fixed missing fill and stoke variables in output functions.
- Fixed a bug that prevented polylines, polygons, and circles from being rendered on query-based maps.
0.9.4
- Added the ability to draw circles on the map when the "limit_drawing" argument is not set
- Added fields to specify circle stroke and fill colors to the plugin's settings page
- Fixed invalid use of array keys in the shortcode function
0.9.3
- Added new 'disable_snap' field argument. When used, the snapToRoads API will not be called when drawing polylines
- Wrapped conditionals using the limit_drawing array key with isset() to ensure that the editor correctly renders
0.9.2
- Fixed invalid use of array keys
0.9.0
- Initial release.