Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev1.0.8

flutter_map_geojson

Este pacote analisa dados espaciais no formato GeoJson e cria arrays de objetos do Mapa do Flutter usando funções de criação padrão ou definidas pelo usuário.

AndroidiOSWebmacOSWindowsLinux
Downloads em 30 dias
2,4 mil
Curtidas
25
Pontos Pub
130

Instalar pacote

flutter pub add flutter_map_geojson

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

flutter_map_geojson é um pacote Dart que permite o parsing de dados espaciais GeoJSON e sua conversão em objetos compatíveis com Flutter Map. Ele suporta funções de criação padrão e personalizadas, permitindo que desenvolvedores integrem dados geográficos de forma transparente em seus aplicativos Flutter. O pacote funciona em todas as principais plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux, tornando-o ideal para visualização geoespacial multiplataforma. Ele aprimora a funcionalidade do flutter_map ao simplificar a integração de conjuntos de dados geográficos do mundo real.

Casos de uso

  • Integrando mapas GeoJSON em aplicativos móveis
  • Visualização de dados geográficos na web
  • Renderização de camadas personalizadas de mapa a partir do GeoJSON
  • Criar painéis baseados em localização
  • Exibindo dados espaciais de APIs
  • Criando mapas interativos com recursos dinâmicos

Principais recursos

  • Suporta análise de GeoJSON
  • Criação de objeto personalizável
  • Compatibilidade multiplataforma
  • Funciona com flutter_map
  • Integração fácil por meio do pub
  • Extensível para geometrias personalizadas

Indicado para

  • Desenvolvedores usando flutter_map
  • Aplicativos que exigem suporte a GeoJSON
  • Aplicações de mapa multiplataforma
  • Visualização de dados geoespaciais
  • conteúdo de mapa impulsionado por backend

Considerações

  • Requer o flutter_map estar instalado
  • Criadores personalizados precisam de implementação
  • Arquivos GeoJSON grandes podem afetar o desempenho
  • Limitado a tipos de geometria suportados pelo flutter_map
  • Nenhuma opção de estilização embutida além das funções fornecidas

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

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.

Categorias

Dependências

Lista de dependências 2 itens

Repositório-fonte

Projetos que usam este pacote