Linux 软件免费装
Banner图

CartoBlocks for Leaflet

开发者 glycymeris
更新时间 2026年7月7日 18:35
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

block gutenberg leaflet map openstreetmap

下载

1.2.4 1.2.5

详情介绍:

CartoBlocks for Leaflet adds a native Gutenberg block that wraps the Leaflet Map plugin shortcodes. Configure your map visually in the block editor — the plugin generates the correct shortcodes automatically, and the frontend is rendered entirely by Leaflet Map. Core map features: Markers ([leaflet-marker]): Lines and polygons ([leaflet-line]): Circles ([leaflet-circle]): Data layers ([leaflet-geojson], [leaflet-gpx], [leaflet-kml]): Image and video overlays ([leaflet-image-overlay], [leaflet-video-overlay]): Developer-friendly: Requirements:

安装:

  1. Upload the cartoblocks-for-leaflet folder to /wp-content/plugins/, or install the plugin through the WordPress plugins screen.
  2. Activate the plugin through the Plugins screen. If the Leaflet Map plugin is not yet installed and active, WordPress prompts you to install and activate it first (it is a required dependency).
  3. In the block editor, search for "Map for Leaflet" and add it to your page or post.

屏幕截图:

  • Map block in the editor with a circle, a polygon, and three markers.
  • Map block showing the Shortcode Viewer popover with the shortcodes Leaflet Map will use to render the map.

常见问题:

Does this plugin replace the Leaflet Map plugin?

No. Leaflet Map is wonderful. This plugin requires Leaflet Map to be installed and active. It provides a Gutenberg block interface for creating maps, but the actual map rendering on the frontend is handled entirely by Leaflet Map's shortcodes.

Can I use multiple map blocks on the same page?

Yes. Each block is fully independent — different coordinates, zoom levels, markers, layers, and settings.

Does the editor preview show real map tiles?

Yes. The editor preview renders the map using the Leaflet Map plugin's own shortcode processing via an iframe, so it looks identical to the frontend.

What map tile provider does it use?

Whatever you have configured in the Leaflet Map plugin settings. By default, OpenStreetMap tiles.

Can I use a WMS tile source?

Yes. Toggle "Use WMS tile source" in the Tile Layer panel and enter the WMS URL, layer name, and CRS. The WMS source must be CORS-enabled for the editor preview to load (same requirement as the frontend). Note: if you leave the WMS Source field empty, the Leaflet Map plugin falls back to a free public demo WMS service (ows.mundialis.de, operated by terrestris GmbH), which displays a "terrestris" watermark and QR code overlay on the map. This is not added by CartoBlocks for Leaflet — enter your own WMS URL to remove it.

Can I load GeoJSON, GPX, or KML files?

Yes. Use the "Data Layers" panel in the block inspector. Add one or more layers, choose the type (GeoJSON, GPX, KML), and enter the file URL. Style options and popup configuration are available per layer.

Can I use a floor plan or custom image as the map?

Yes. Toggle "Image map mode" in the Location panel and select an image from the Media Library (or enter a URL). The map switches to L.CRS.Simple — markers, lines, circles, and polygons remain usable, and coordinates become pixel positions.

Can I overlay an image or video on a geo map?

Yes. Use the "Overlays" panel to pin raster images or videos to geographic coordinates using SW/NE bounds.

Can I use custom marker icons?

Yes. Each marker has a "Custom Icon" subsection where you can select an image from the Media Library, set size and anchor with aspect-ratio lock, and choose from nine anchor presets. You can also use SVG markers with background color, icon color, and an icon-font CSS class.

Where can I see the shortcode the block generates?

Click the <> button in the block toolbar to open the Shortcode Viewer. It shows the exact shortcode that will be rendered on the frontend, with a one-click copy button.

Does it support translations?

Yes. All user-facing strings are wrapped in __() with the cartoblocks-for-leaflet textdomain. A .pot file is included in the languages/ directory.

更新日志:

1.2.5 1.2.4 1.2.3 1.2.2 1.2.1 1.2.0 1.1.1 1.1.0 1.0.7 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0 0.10.0 0.9.0 0.8.0 0.7.1 0.7.0 0.6.0 0.5.0 0.4.3 0.4.2 0.4.1 0.4.0 0.3.x 0.2.0