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

패키지 상세v0.1.1+2

google_maps_flutter_heatmap

iOS 및 Android 애플리케이션에서 Google Maps를 통합하기 위한 Flutter 플러그인입니다. 히트맵 지원 기능 포함.

30일 다운로드
5
좋아요
21
Pub 점수
40

패키지 설치

flutter pub add google_maps_flutter_heatmap

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

iOS 및 Android 앱에서 Google Maps를 통합할 수 있는 플러터 플러그인으로, 내장된 히트맵 시각화 기능을 지원합니다. 이 플러그인은 데이터 포인트를 사용하여 지도 위에 밀도 기반의 히트맵을 표시할 수 있게 해 주며, 지리공간 데이터 표현을 향상시킵니다. 플러터 애플리케이션 내에서 원활하게 작동하도록 설계되었으며 최적의 성능을 위해 네이티브 Google Maps SDK를 활용합니다. 히트맵은 교통 밀도, 사용자 활동 또는 이벤트 클러스터링과 같은 패턴을 시각화하는 데 유용합니다. 이 패키지는 GitHub에서 유지 관리되며 pub를 통해 추가할 수 있습니다.

사용 사례

  • 지리 데이터 밀도 시각화
  • 사용자 활동 핫스팟 표시
  • 교통 또는 이동 패턴 분석
  • 이벤트 농도 매핑
  • 위치 기반 분석 향상

주요 기능

  • 히트맵 레이어 렌더링을 지원합니다
  • Google Maps SDK와 통합
  • 실시간 히트맵 업데이트
  • 사용자 지정 가능한 히트맵 색상 및 강도
  • 가볍고 구현하기 쉬움

적합한 대상

  • 위치 기반 앱에서의 데이터 시각화
  • 공간 분석이 필요한 모바일 앱
  • 고밀도 점 데이터를 가진 애플리케이션
  • Flutter에서 Google Maps를 사용하는 개발자
  • 인터랙티브 지도 레이어가 필요한 프로젝트

고려 사항

  • Google Maps API 키가 필요합니다
  • iOS 및 안드로이드 플랫폼에 제한됨
  • 매우 큰 데이터 세트에서는 히트맵 성능이 저하될 수 있습니다
  • 외부 Google Maps SDK에 종속됨
  • 생산 배포를 위해 추가 구성이 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Google Maps for Flutter (Developers Preview)

Find and sponsor issues pub package Flutter CI

A Flutter plugin that provides a Google Maps widget with heatmap support.

Developers Preview Status

The plugin relies on Flutter's new mechanism for embedding Android and iOS views. As that mechanism is currently in a developers preview, this plugin should also be considered a developers preview.

Known issues are tagged with the platform-views and/or maps labels.

To use this plugin on iOS you need to opt-in for the embedded views preview by adding a boolean property to the app's Info.plist file, with the key io.flutter.embedded_views_preview and the value YES.

The API exposed by this plugin is not yet stable, and we expect some breaking changes to land soon.

Usage

To use this plugin, add google_maps_flutter_heatmap as a dependency in your pubspec.yaml file.

Getting Started

Get an API key at https://cloud.google.com/maps-platform/.

Android

Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml:

<manifest ...
  <application ...
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="YOUR KEY HERE"/>
iOS

Specify your API key in the application delegate ios/Runner/AppDelegate.m:

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GMSServices provideAPIKey:@"YOUR KEY HERE"];
  [GeneratedPluginRegistrant registerWithRegistry:self];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end

Or in your swift code, specify your API key in the application delegate ios/Runner/AppDelegate.swift:

import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Opt-in to the embedded views preview by adding a boolean property to the app's Info.plist file with the key io.flutter.embedded_views_preview and the value YES.

Both

You can now add a GoogleMap widget to your widget tree.

The map view can be controlled with the GoogleMapController that is passed to the GoogleMap's onMapCreated callback.

Sample Usage
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:google_maps_flutter_heatmap/google_maps_flutter_heatmap.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Google Maps Demo',
      home: MapSample(),
    );
  }
}

class MapSample extends StatefulWidget {
  @override
  State<MapSample> createState() => MapSampleState();
}

class MapSampleState extends State<MapSample> {
  Completer<GoogleMapController> _controller = Completer();
  final Set<Heatmap> _heatmaps = {};
  static final CameraPosition _kGooglePlex = CameraPosition(
    target: LatLng(37.42796133580664, -122.085749655962),
    zoom: 14.4746,
  );
  LatLng _heatmapLocation = LatLng(37.42796133580664, -122.085749655962);
  static final CameraPosition _kLake = CameraPosition(
      bearing: 192.8334901395799,
      target: LatLng(37.43296265331129, -122.08832357078792),
      tilt: 59.440717697143555,
      zoom: 19.151926040649414);

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: GoogleMap(
        mapType: MapType.hybrid,
        initialCameraPosition: _kGooglePlex,
        heatmaps: _heatmaps,
        onMapCreated: (GoogleMapController controller) {
          _controller.complete(controller);
        },
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: _goToTheLake,
        label: Text('To the lake!'),
        icon: Icon(Icons.directions_boat),
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: _addHeatmap,
        label: Text('Add Heatmap'),
        icon: Icon(Icons.add_box),
      ),
    );
  }
  void _addHeatmap(){
    setState(() {
      _heatmaps.add(
        Heatmap(
          heatmapId: HeatmapId(_heatmapLocation.toString()),
          points: _createPoints(_heatmapLocation),
          radius: 20,
          visible: true,
          gradient:  HeatmapGradient(
            colors: <Color>[Colors.green, Colors.red], startPoints: <double>[0.2, 0.8]
          )
        )
      );
    });
  }
  //heatmap generation helper functions
  List<WeightedLatLng> _createPoints(LatLng location) {
    final List<WeightedLatLng> points = <WeightedLatLng>[];
    //Can create multiple points here
    points.add(_createWeightedLatLng(location.latitude,location.longitude, 1));
    points.add(_createWeightedLatLng(location.latitude-1,location.longitude, 1)); 
    return points;
  }

  WeightedLatLng _createWeightedLatLng(double lat, double lng, int weight) {
    return WeightedLatLng(point: LatLng(lat, lng), intensity: weight);
  }

  Future<void> _goToTheLake() async {
    final GoogleMapController controller = await _controller.future;
    controller.animateCamera(CameraUpdate.newCameraPosition(_kLake));
  }
}

See the example directory for a complete sample app.

카테고리

소스 저장소

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

아직 데이터가 없습니다.