anvildevxyz/craft-cartograph 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

anvildevxyz/craft-cartograph

最新稳定版本:1.0.0

Composer 安装命令:

composer require anvildevxyz/craft-cartograph

包简介

Craft CMS map field foundation using OpenFreeMap vector tiles and MapLibre GL JS.

README 文档

README

Map fields for Craft 5 using OpenFreeMap-compatible styles and MapLibre GL JS. No API keys.

Requirements

Craft 5.x, PHP 8.2+, MySQL ≥ 8.0.17 / MariaDB (same check) or PostgreSQL ≥ 13 (proximity needs JSON support in elements_sites.content).

Install

composer require anvildevxyz/craft-cartograph
./craft plugin/install cartograph

For a path / Git package, add a Composer repositories entry in your Craft project, then composer require as usual.

Usage

Add Cartograph · Map Point or Map GeoJSON under Settings → Fields, attach to an entry type, then in templates:

{% include 'cartograph/map' with {
  height: '420px',
  geojson: craft.cartograph.pointFeature(entry.venueMap ?? null),
} %}

Map GeoJSON (FeatureCollection or normalizable geometry):

{% include 'cartograph/map' with {
  geojson: craft.cartograph.featureCollection(entry.routes ?? null),
} %}

Embed preset (default, compact, hero): {% include 'cartograph/map-embed' with { preset: 'compact', geojson: … } %}. Many entries → one map: craft.cartograph.mergeMapPoints(entries, ['handle']).

Proximity (anchor [lat, lng]):

{% set q = craft.cartograph.near(craft.entries.section('venues'), 'venueMap', [47.3769, 8.5417], 5, { orderByDistance: true }) %}
{% for e in q.all() %}{{ e.title }} — {{ e.distance|number_format(1) }} km{% endfor %}

GraphQL: fields are JSON strings (GeoJSONPoint / GeoJSONFeatureCollection); JSON.parse on the client. Use your Map Point handle as a filter: venueMap: { lat, lng, radius, orderByDistance }. Send Authorization: Bearer <token> and grant the schema site, section, and entry type read access. Endpoint: Craft’s graphql/api action (see Craft GraphQL).

Plugin and field options: docs/SETTINGS.md. PHP/JS hooks: docs/EXTENSIONS.md.

Self-hosted MapLibre

Default: MapLibre 4.7.1 from jsDelivr (SRI). To self-host, copy maplibre-gl.js / .css from the same version to your origin and set Self-hosted MapLibre asset base in plugin settings (folder URL, no trailing slash).

Multisite

Geometry is not localized per site row. For per-site locations use separate fields or structures.

License

See LICENSE.md.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-05-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固