パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.8

flutter_map_geojson

このパッケージは、GeoJson形式の空間データを解析し、デフォルトまたはカスタム定義された作成関数を使用してFlutterマップオブジェクトの配列を作成します。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
2430
いいね数
25
Pub ポイント
130

パッケージをインストール

flutter pub add flutter_map_geojson

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

flutter_map_geojson は、GeoJSON の空間データを解析し、Flutter Map 互換のオブジェクトに変換できる Dart パッケージです。デフォルトおよびカスタム作成関数の両方をサポートしており、開発者が Flutter アプリケーションに地理データをスムーズに統合できるようにしています。このパッケージは Android、iOS、Web、macOS、Windows、Linux などの主要プラットフォームすべてで動作するため、クロスプラットフォームでの地理空間可視化に最適です。実世界の地理データセットの統合を簡素化することで、flutter_map の機能を強化しています。

用途

  • モバイルアプリにGeoJSON地図を統合する
  • ウェブ上の地理データの可視化
  • GeoJSONからカスタムマップレイヤーをレンダリングする
  • 場所ベースのダッシュボードの構築
  • API からの空間データの表示
  • 動的機能を備えたインタラクティブマップの作成

主な機能

  • GeoJSONの解析をサポートしています
  • カスタマイズ可能なオブジェクトの作成
  • クロスプラットフォーム互換性
  • flutter_map と連携可能
  • pub を通じた簡単な統合
  • カスタムジオメトリの拡張に対応可能

適している対象

  • flutter_map を使用する開発者
  • GeoJSONサポートを必要とするアプリ
  • クロスプラットフォーム地図アプリケーション
  • 地理空間データの可視化
  • バックエンド駆動のマップコンテンツ

注意事項

  • flutter_map のインストールが必要です
  • カスタム作成者は実装が必要です
  • 大きな GeoJSON ファイルはパフォーマンスに影響を与える可能性があります
  • flutter_map がサポートするジオメトリータイプに限定
  • 提供された関数以外の組み込みスタイルオプションはありません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

GeoJson is becoming defacto standard for retrieving spatial data like points, lines and polygons. GeoJson Format specification is defined in RFC7964 - see https://www.rfc-editor.org/rfc/rfc7946 This package parses GeoJson data and creates spatial objects like [Marker]s, [Polyline]s and [Polygon]s, which are defined in [flutter_map] package.

The creation of these objects is done by default callback functions. However, one can and probably should write his own callback functions which are implementing the necessary customization of creating spatial objects by specifying the color, stroke, label text and other parameters.

Features

The GeoJson parser creates three (four) lists of spatial objects - separate lists of [Marker]s, [Polyline]s and [Polygon]s (and Circles) which are input data for creating layers in flutter_map. The parser supports parsing the following geometries:

  • Point - transformed into [Marker]s
  • Circle - transformed into [CircleMarker]s - not part of the spec, but handy to have. Specify radius in the properties.
  • Multipoint - transformed into multiple [Marker]s with same ID property
  • LineString - tranformed in [Polyline]
  • MultiLineString - transformed into multiple [Polyline]s
  • Polygon - transformed into [Polygon]
  • MultiPolygon - transformed into multiple [Polygon]s with same ID property

Getting started

Add the package in pubspec.yaml file:

flutter_map_geojson ^1.0.8

Import it in the code:

import 'package:flutter_map_geojson/flutter_map_geojson.dart';

Usage

 // initiate parser 
 GeoJsonParser myGeoJson = GeoJsonParser();
 
 // parse GeoJson data - GeoJson is stored as [String]
 myGeoJson.parseGeoJsonAsString(testGeoJson);

 // after parsing the results are stored in 
 // myGeoJson.markers -> List<Marker>
 // myGeoJson.polylines -> List<Polyline>
 // myGeoJson.ploygons -> List<Polygon>

 // now create flutter_map layers

 FlutterMap(
          mapController: MapController(),
          options: MapOptions(
            center: LatLng(45.993807, 14.483972),
            zoom: 14,
          ),
          children: [
            TileLayer(
                urlTemplate:
                    "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
                subdomains: const ['a', 'b', 'c']),
            PolygonLayer(polygons: myGeoJson.polygons),
            PolylineLayer(polylines: myGeoJson.polylines),
            MarkerLayer(markers: myGeoJson.markers)
          ],
        ));

The default [Marker], [Polyline] [CircleMarkers] and [Polygon] creation callback functions can be replaced with user-defined highly customized functions. A good starting point are default callback functions which can be custimized to the needs of the project. The default callback functions have only basic functionality to display the spatial objects on the map. The default callback functions support changing the colors, stroke and fill color and marker icon. All these can be defined in default constructor or via setters. One can also apply a filtering function which returns only spatial features that have certian propertis. The filtering function returns a boolean value. For more details see the example program.

For creating tappable polylines one can use package flutter_map_tappable_polyline.

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

このパッケージを使用しているプロジェクト