Linux 软件免费装
Banner图

Leaflet Map

开发者 bozdoz
remigr
gerital
sal0max
thibault-barrat
hupe13
sardylan
AK-digital
jannefleischer
更新时间 2024年7月22日 10:54
捐献地址: 去捐款
PHP版本: 4.6 及以上
WordPress版本: 6.6
版权: GPLv2
版权网址: 版权信息

标签

interactive javascript mobile leaflet map openstreetmap mapquest

下载

3.2.0 3.4.0 3.3.1 2.16.2 3.3.0 2.10.0 3.4.1 2.11.1 2.11.2 2.11.3 2.11.4 2.11.5 2.12.0 2.13.0 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.2 2.17.3 2.18.0 2.19.0 2.19.1 2.20.0 2.21.0 2.22.0 2.23.0 2.23.1 2.23.2 2.23.3 3.0.0 3.0.1 2.10.1 2.11.0 2.22.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1.0

详情介绍:

Add a map generated with LeafletJS: an open-source JavaScript library for mobile-friendly interactive maps. Map tiles are provided by default through OpenStreetMap, or MapQuest (with an app key). Can be set per map with shortcode attributes or through the dashboard settings. Maps Simply create a map with: [leaflet-map] Lookup an address with: [leaflet-map address="chicago"] Know the latitude and longitude of a location? Use them (and a zoom level) with: [leaflet-map lat=44.67 lng=-63.61 zoom=5] Add a marker under your map shortcode, like so: [leaflet-map] [leaflet-marker] Want more? Make more (and fit the map to contain all of them): [leaflet-map fitbounds] [leaflet-marker address="tokyo"] [leaflet-marker address="oslo"] [leaflet-marker address="cairo"] [leaflet-marker address="toronto"] You can even add popups (to any shape) with their names: [leaflet-map fitbounds] [leaflet-marker address="tokyo"]Tokyo[/leaflet-marker] [leaflet-marker address="oslo"]Oslo[/leaflet-marker] ... Add a link to the popup messages the same way you would add any other link with the WordPress editor. Other Shapes, GeoJSON, and KML Add a line to the map by adding [leaflet-line]. You can specify the postions with a list separated by semi-colon ; or bar | using lat/lng: [leaflet-line latlngs="41, 29; 44, 18"] or addresses: [leaflet-line addresses="Istanbul; Sarajevo"], or x/y coordinates for image maps. Add a circle to the map by adding [leaflet-circle]. You can specify the position using lat and lng and the radius in meters using radius. You can also customize the style using Leaflet's Path options. Example: [leaflet-circle message="max distance" lng=5.117909610271454 lat=52.097914814706094 radius=17500 color="#0DC143" fillOpacity=0.1]. Or you can add a geojson shape via a url (make sure you are allowed to access it if it's not hosted on your own server): [leaflet-geojson src="https://example.com/path/to.geojson"]. Add custom popups with field names; try out the default src file and fields like so: [leaflet-map fitbounds] [leaflet-geojson]{name}[/leaflet-geojson] name is a property on that GeoJSON, and it can be accessed with curly brackets and the property name. Image Maps Alternatively, you could use a plain image for visitors to zoom and pan around with [leaflet-image src="path/to/image/file.jpg"]. See screenshots 3 - 5 for help setting that up. More Check out other examples on the Shortcode Helper page in the Leaflet Map admin section. Check out the source code and more details on GitHub!

安装:

  1. Choose to add a new plugin, then click upload
  2. Upload the leaflet-map zip
  3. 通过 WordPress 的的“Plugins”菜单激活插件
  4. Use the shortcodes in your pages or posts: e.g. [leaflet-map] and [leaflet-marker]

屏幕截图:

  • See the shortcode play out on the front end.
  • For `[leaflet-image]` upload an image, and copy the URL from the right-hand side
  • For `[leaflet-image]` paste that image URL into an attribute titled `source`: example: `src="https://picsum.photos/1000/1000/"`.
  • See the `[leaflet-image]` on the front end.
  • If you use `[leaflet-marker draggable]`, then you can drag the marker where you want it, open a developers console, and see the specific shortcode to use.
  • Add geojson via URL: `[leaflet-geojson src="https://example.com/path/to.geojson"]`
  • MapQuest requires an app key, get it from their website; alternatively, you can use OpenStreetMap as a free tile service (remember to add an attribution where necessary).

升级注意事项:

3.3.1
  • Escapes geojson popup properties to prevent XSS attacks
3.2.0
  • Fixes error if geocoder fails to get a lat/lng
  • Fixes deprecated warnings in php 8.1
  • Fixes detect retina and maxzoom issues
3.1.0 Reduces php warnings by checking for lat and lon in osm_geocode with isset(). Adds min, max, step to inputs for zoom, minZoom, and maxZoom. Obfuscates base tileurl with base64_encode in map-shortcode to deter crawlers. Allows for comma-separated tile server subdomains, as opposed to 'abc' turning into 'a','b','c' automatically (i.e. you can now use something like "cache-1,cache2" as default subdomains). New Shortcodes: [leaflet-image-overlay] and [leaflet-video-overlay] (examples in the shortcode-helper page, or README.md). 3.0.5 Fixes ampersands/querystrings in geojson/gpx/kml urls 3.0.4 Fixes markers so that they can accept 0 as a value for x/y and lat/lng coordinates 3.0.3 Fixes using popupAnchor without passing iconUrl 3.0.2 Another fix for commas in float coordinates. Fix validation of tile urls. Fix for php 5.6 using static function methods. 3.0.1 Fixes some issues with float coordinates that use commas instead of decimals, and fixes some quotes in addresses for geocoding 3.0.0 Fixes security issues in admin and in shortcode attributes. Escapes and filters many inputs. 2.23.3 Changes 'leaflet_map_enqueue' action to fire for each map 2.23.2 Actual bugfix to multiple or missing enqueue map scripts 2.23.1 Possible bugfix to ensuring javascript is enqueued when map is rendered 2.23.0 Minor bugfix to number-type inputs in admin that couldn't switch types between decimals and integers 2.21.0 Fixes issues with tilelayers when min_zoom and max_zoom are identical and detect_retina is true 2.19.1 Bumps leaflet version to 1.7.1 Removes "\r\n" from default attribution Uses min and max zoom in tileurl as well as map 2.18.0 Changes the way maps are rendered: Now creates map containers before creating maps, in the same order the containers are rendered. This should help with ajax, caching, and script-altering plugins. 2.17.3 Bugfix to detect retina breaking MapQuest maps since 2.17.0 2.17.1 Lazy-loading svg and geojson scripts so that it can wait for Leaflet to be loaded under some circumstances (deferred scripts) 2.17.0 Makes shortcode in excerpts conditional (enable it in admin->leaflet-map->settings) 2.16.2 Fixes missing maps by removing spaces in the JavaScript which some themes turn into paragraphs 2.16.1 Updates default Leaflet to 1.6.0 Changes map generation from a pre-defined randomly identified div element to a JavaScript generated div which is created (insertBefore) each inserted script tag 2.16.0 Adds [leaflet-polygon] Allows author roles to see shortcodes page 2.15.0 Adds referer to file_get_contents, in case curl is disabled Updates default Leaflet to 1.5.1 Fixes reset default values button in settings Requires at least WordPress 4.6 2.12.0 Fixed links in shortcode helper page; fixed issue with marker popups that had single quotes; loading leaflet scripts and styles only when a map shortcode is used 2.11.4 Fix to a race condition issue with custom scripts changing leaflet rendering methods 2.11.3 Fix for rendering circles (fix to 2.11.2) 2.10.1 Fix for plugin settings not being included (somehow) 2.9.1 Fix for PHP7.2; added minified JavaScript files 2.8.6 Added [leaflet-gpx] for GPX format 2.8.6 Fix image shortcode ratio 2.8.5 Fix to missing files in 2.8.4 2.8.4 Fixed issues with css and js CDN; removed version from querystring 2.8.3 Fixed issues with leaflet-kml 2.8.2 Fixed issues with image maps and geocoder addresses 2.7.6 added optional cURL to get geolocations if file_get_contents is not allowed on a server (cURL needs to be enabled, obviously) 2.7.5 fixed filter_var_array throwing errors in old PHP 2.7.3 Fixed array_filter on some older PHP versions 2.7.2 Fixed possible JavaScript error "Unexpected token <"; fix was to remove spaces 2.6.0 Changes to map creation which may solve an occasional marker creation JavaScript error 2.0.2 OpenStreetMap.org has an SSL certificate (osm.org didn't) 2.0.1 GeoJSON ajax requests now work with Internet Explorer (some versions) 2.0 MapQuest tiles will no longer work without an app key! 1.15 Fixed incompatibility with plugins that execute recursive shortcodes 1.14 Fixed slashes in optional map attribution 1.12 Added htmlspecialchars in admin.php, and custom attributions. Bugfix : removed position in admin menu so it doesn't overwrite or be overwritten (thanks to @ziodave) 1.6 Removed windows onload functions and created a construct and init js file for initiating the maps when Leaflet is ready (other plugins were overwriting windows.onload). 1.5 Improved stability for multiple plugins with windows onload functions. 1.0 First Version. Tested with 3.8.1.

常见问题:

Can I have an SVG Marker?

Yes! Convert the default marker into an svg with a shortcode like this: [leaflet-marker svg color="white" iconClass="fab fa-wordpress-simple" background="red"] The iconClass is perfect for adding a font-awesome icon.

How do I change the style for lines/geojson?

Pass the style attributes to the respective shortcodes (see all options on LeafletJS): [leaflet-line color="red" weight=10 dasharray="2,15" addresses="Halifax, NS; Tanzania" classname=marching-ants]

Can I add geojson?

Yes, just give it a source URL: [leaflet-geojson src="https://example.com/path/to.geojson"] It will also support leaflet geojson styles or geojson.io styles. Add a popup message with [leaflet-geojson popup_text="hello!"], or add HTML by adding it to the content of the shortcode: [leaflet-geojson]<a href="#">Link here, or use text from a feature property, like {title}</a>[/leaflet-geojson] or identify a geojson property with popup_property, and each shape will use its own popup text if available.

Can I add kml/gpx?

Sure!? Use the same attributes as leaflet-geojson (above), but use the [leaflet-kml] or [leaflet-gpx] shortcode.

Can I add wms?

Sure. Use the same attributes as leaflet-map, but use the [leaflet-wms] shortcode; attributes include: src, layer, and crs.

Can I add a message to a marker?

Yes: [leaflet-marker visible]Hello there![/leaflet-marker], where visible designates if it is visible on page load. Otherwise it is only visible when clicked.

Can I use your plugin with a picture instead of a map?

Yes: Use [leaflet-image src="path/to/image/file.jpg"]. See screenshots 3 - 5 for help setting that up.

Can I use my own self-hosted Leaflet files?

Yes: Add your custom URL to the options in the admin page.

How can I add a link to a marker?

Use the marker format [leaflet-marker]Click here![/leaflet-marker] and add a hyperlink like you normally would with the WordPress editor. = I need more functions! Take a look at the functions of Extensions for Leaflet Map.

Additional questions?

For more FAQs, please visit the FAQ section on GitHub here.

更新日志:

3.4.0 3.4.0 3.3.1 3.3.0 3.2.0 3.1.0 3.0.5 3.0.4 3.0.3 3.0.2 3.0.1 3.0.0 2.23.3 2.23.2 2.23.1 2.23.0 2.22.1 2.22.0 2.21.0 2.20.0 2.19.1 2.19.0 2.18.0 2.17.3 2.17.2 2.17.1 2.17.0 2.16.2 2.16.1 2.16.0 2.15.0 2.14.0 2.13.0 2.12.0 2.11.5 2.11.4 2.11.3 2.11.2 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.8.6 2.8.6 2.8.5 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.8 2.7.7 2.7.6 2.7.5 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.0 2.0.2 2.0.1 2.0 1.16 1.15 1.14 1.13 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0