pankaj7590/geoplot
Composer 安装命令:
composer require pankaj7590/geoplot
包简介
A lightweight PHP library for plotting geographic coordinates with optional Yii2 integration.
README 文档
README
A lightweight PHP library for plotting geographic coordinates on an interactive canvas without relying on external map tile providers.
GeoPlot is designed for applications that need to visualize latitude and longitude datasets such as hotels, tourist attractions, offices, warehouses, or custom geographic points. It provides a fast, dependency-free plotting engine with optional Yii2 integration.
Features
- 📍 Plot latitude and longitude coordinates on an interactive canvas
- 🗺️ No dependency on Google Maps, OpenStreetMap, or other tile providers
- 🔍 Built-in zoom and pan controls
- 🎯 Highlight individual points with custom styling
- 🎨 Custom marker colors, labels, and tooltips
- ⚡ Lightweight and fast rendering
- 🔌 Optional Yii2 widget integration
- 🧩 PSR-4 compliant and Composer installable
Requirements
- PHP 7.4 or later
Optional:
- Yii2 (only if using the provided widget)
Installation
Install via Composer:
composer require geoplot/geoplot
If Yii2 integration is required:
composer require yiisoft/yii2
Quick Start
use GeoPlot\Plot; $dataset = Dataset::make('Hotels') ->style([ 'color' => '#2196f3', 'size' => 7, ]); foreach($points as $point){ $point = Point::make($point->latitude, $point->longitude, $point->name); if(condition){ $point->mark('#e53935', 10); } $dataset->add($point); } echo Plot::widget([ 'datasets' => $dataset, 'height' => '600px', 'maxZoom' => 5000, ]);
Example Output
GeoPlot renders an interactive plotting canvas where users can:
- Zoom in and out
- Pan the view
- Highlight selected locations
Features in Detail
Coordinate Plotting
Plot thousands of latitude and longitude points efficiently.
Interactive Navigation
- Mouse wheel zoom
- Drag to pan
- Adjustable zoom limits
Marker Styling
Customize markers individually.
Examples include:
- Different colors
- Different sizes
- Labels
City Center Detection
GeoPlot can determine a representative city center based on the distribution of plotted coordinates.
This is particularly useful for:
- Hotel clusters
- Property listings
- Delivery hubs
- Tourist destinations
Yii2 Integration
GeoPlot includes optional Yii2 support for seamless integration into existing Yii2 applications.
Configuration
GeoPlot allows customization of various rendering options, including:
- Canvas dimensions
- Zoom limits
- Marker colors
- Marker radius
- Labels
Typical Use Cases
GeoPlot is suitable for applications such as:
- Hotel booking platforms
- Travel portals
- Property listing websites
- Logistics and fleet management
- Delivery routing
- Warehouse visualization
- Educational GIS projects
- Business location mapping
Roadmap
Future enhancements may include:
- Polygon support
- Polyline rendering
- Heatmap visualization
- Cluster rendering
- Distance measurement tools
- SVG export
- GeoJSON import/export
- Additional framework integrations
Contributing
Contributions, feature requests, and bug reports are welcome.
Please open an issue before submitting significant changes to discuss the proposed implementation.
License
GeoPlot is licensed under the MIT License.
See the LICENSE file for details.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-03