opscale-co/nova-geospatial-fields
Composer 安装命令:
composer require opscale-co/nova-geospatial-fields
包简介
Laravel Nova fields for geospatial data — render Location pins, Addresses with geocoding, Geofence polygons, Area circles, and Routes on interactive Leaflet maps.
README 文档
README
At Opscale, we're passionate about contributing to the open-source community by providing solutions that help businesses scale efficiently. If you've found our tools helpful, here are a few ways you can show your support:
⭐ Star this repository to help others discover our work and be part of our growing community. Every star makes a difference!
💬 Share your experience by leaving a review on Trustpilot or sharing your thoughts on social media. Your feedback helps us improve and grow!
📧 Send us feedback on what we can improve at feedback@opscale.co. We value your input to make our tools even better for everyone.
🙏 Get involved by actively contributing to our open-source repositories. Your participation benefits the entire community and helps push the boundaries of what's possible.
💼 Hire us if you need custom dashboards, admin panels, internal tools or MVPs tailored to your business. With our expertise, we can help you systematize operations or enhance your existing product. Contact us at hire@opscale.co to discuss your project needs.
Thanks for helping Opscale continue to scale! 🚀
Description
Storing latitude/longitude pairs, street addresses, or delivery routes in a database is easy. Seeing them on a map inside Nova is not — until now. This package ships five purpose-built Nova fields backed by an interactive Leaflet map, so your admin panel shows the shape of your geodata, not just the numbers. Compatible with Nova 5.
| Field | Purpose | Storage |
|---|---|---|
Location |
Single pin — a lat/lng point picked from the map. | GeoJSON Point |
Address |
Text box that geocodes (via Nominatim or Photon) to a pin. | GeoJSON Point + formatted address |
Geofence |
Closed polygon — draw the perimeter of a zone. | GeoJSON Polygon |
Area |
Circle defined by a center point + radius (meters). | GeoJSON Point + radius |
Route |
Multi-waypoint polyline for paths or delivery routes. | GeoJSON LineString |
Installation
composer require opscale-co/nova-geospatial-fields
The package auto-registers its service provider.
Back each field with a json column (or text) — the payload is stored as GeoJSON so you can query it with your database's native geo support if present, or as plain JSON otherwise.
Schema::create('places', function (Blueprint $table) { $table->id(); $table->string('name'); $table->json('location')->nullable(); // Location field $table->json('address')->nullable(); // Address field $table->json('geofence')->nullable(); // Geofence field $table->json('area')->nullable(); // Area field $table->json('route')->nullable(); // Route field $table->timestamps(); });
Usage
use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\Text; use Laravel\Nova\Http\Requests\NovaRequest; use Laravel\Nova\Resource; use Opscale\Fields\Geospatial\Address; use Opscale\Fields\Geospatial\Area; use Opscale\Fields\Geospatial\Geofence; use Opscale\Fields\Geospatial\Location; use Opscale\Fields\Geospatial\Route; class Place extends Resource { public static $model = \App\Models\Place::class; public function fields(NovaRequest $request): array { return [ ID::make()->sortable(), Text::make('Name')->rules('required', 'max:255'), Location::make('Location') ->defaultCenter(40.4168, -3.7038) // Madrid ->defaultZoom(13), Address::make('Address') ->geocoder('nominatim'), // or 'photon' Geofence::make('Geofence'), Area::make('Area') ->defaultRadius(500), // meters Route::make('Route'), ]; } }
Field behavior
| View | Behavior |
|---|---|
| Create / Update | Interactive Leaflet map with drawing tools (marker / polygon / circle / polyline). Address shows a search input that geocodes on submit. |
| Detail | Read-only map showing the stored shape, centered and fit to the data. |
| Index | Compact text summary (e.g. 40.42, -3.70 for a point, 6 vertices for a polygon). |
| API | fillAttributeFromRequest accepts raw GeoJSON strings as well as the internal JSON payload. |
Configuration
// config/nova-geospatial-fields.php (publishable) return [ 'tile_layer' => [ 'url' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'attribution' => '© OpenStreetMap contributors', ], 'geocoder' => [ 'driver' => env('NOVA_GEOSPATIAL_GEOCODER', 'nominatim'), 'nominatim' => [ 'url' => 'https://nominatim.openstreetmap.org', 'user_agent' => env('APP_NAME', 'Laravel').' / nova-geospatial-fields', ], 'photon' => [ 'url' => 'https://photon.komoot.io', ], ], 'routing' => [ 'osrm_url' => 'https://router.project-osrm.org/route/v1', ], ];
Under the hood
| Layer | Dependency |
|---|---|
| Map | Leaflet |
| Drawing | Leaflet.draw |
| Routing | Leaflet Routing Machine + OSRM |
| Geocoding | Nominatim or Photon |
| Circle → GeoJSON | @turf/circle |
Testing
npm run test # Unit + feature npm run test:web # Dusk browser tests — verifies the map renders
License
MIT
opscale-co/nova-geospatial-fields 适用场景与选型建议
opscale-co/nova-geospatial-fields 是一款 基于 Shell 开发的 Composer 扩展包,目前已累计 26 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「route」 「geocoding」 「address」 「map」 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 opscale-co/nova-geospatial-fields 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 opscale-co/nova-geospatial-fields 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 opscale-co/nova-geospatial-fields 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Maps in minutes. Powered by the Google Maps API.
Redirects TYPO3 visitors automatic or with a suggestlink to another language and/or root page.
Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.
GISCO Geocoding Provider for Geocoder PHP.
Module adding custom shipping attribute for what3words address
Provide a way to secure accesses to all routes of an symfony application.
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 38
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-04