패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.0.8

flutter_map_geojson

이 패키지는 GeoJson 형식의 공간 데이터를 분석하고 기본 또는 사용자 정의된 생성 함수를 사용하여 Flutter 맵 객체 배열을 만듭니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
2.4천
좋아요
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 개

소스 저장소

이 패키지를 사용하는 프로젝트