搜索分类、插件与代码仓

插件详情v1.0.3

here_maps_webservice

Flutter 包,提供 Here Maps Web Services API 的封装,可实现从搜索到地理编码等多种功能。

近 30 天下载
25
喜欢数
18
Pub 分数
35

安装插件

flutter pub add here_maps_webservice

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个封装 Here Maps Web Services API 的 Flutter 包,使开发者能够将其应用中的位置功能(如搜索、地理编码和逆地理编码)集成进来。它通过简洁的 Dart 接口简化了对 Here Maps 强大地图和位置数据服务的访问。该包非常适合需要精确地址解析、地点发现或地图相关查询的应用程序。它可通过 pub.dev 无缝集成到 Flutter 项目中。

适合场景

  • 将地址转换为坐标
  • 将坐标反向地理编码为地址
  • 搜索地点和兴趣点
  • 在地图中集成位置数据
  • 使用自动完成构建地址选择器

主要特点

  • Here Maps 的简单 API 包装器
  • 支持地理编码和逆地理编码
  • 放置搜索功能
  • 与 Flutter 的轻松集成
  • 轻量级且专注于核心服务

适合对象

  • 需要精确地理位置的应用
  • 使用 Here Maps API 的开发人员
  • 位置感知应用
  • 地址输入带建议
  • 需要位置数据的地图服务

使用建议

  • 需要 Here Maps API 凭据
  • 仅限网页服务(无离线支持)
  • 依赖网络连接
  • 无内置地图UI渲染
  • 平台特定的行为可能有所不同

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Here

here_maps_webservice

pub package

About

here_maps_webservice provides Here Maps Web Services API wrapper that serve different purposes from search, to geocoding.

Usage

Add here_maps_webserviceas a dependency in your pubspec.yaml

 dependencies:
  flutter:
    sdk: flutter
  here_maps_webservice: 1.0.2

Run flutter pub get in the terminal and import import 'package:here_maps_webservice/here_maps.dart'

Availabel APIs

Generate API KEY

Go to https://developer.here.com/ and create a new account if you don't have one. Create a new project and select Freemium Plan. Under the REST section of your project, click on Create API key.

Example

Nearby Places
    import 'package:here_maps_webservice/here_maps.dart';
    import 'package:location/location.dart' as l; 
    import 'package:flutter/services.dart';
    
    var currentLocation;
    var location = new l.Location();
    List<dynamic> _nearbyPlaces=[]; 

    try {
      currentLocation = await location.getLocation();
      }on PlatformException catch (error) {
      if (error.code == 'PERMISSION_DENIED') {
        print("Permission Dennied");
      }
    }
    
    HereMaps(apiKey: "your apiKey")
          .exploreNearbyPlaces( lat: currentLocation.latitude, lon: currentLocation.longitude,offset: 10)
          .then((response) {
              setState(() {
                  _nearbyPlaces.addAll(response['results']['items']);
              });
          });

Popular Places
    import 'package:here_maps_webservice/here_maps.dart';
    import 'package:location/location.dart' as l; 
    import 'package:flutter/services.dart';
    
    var currentLocation;
    var location = new l.Location();
    List<dynamic> _explorePopularPlace = []; 

    try {
      currentLocation = await location.getLocation();
      }on PlatformException catch (error) {
      if (error.code == 'PERMISSION_DENIED') {
        print("Permission Dennied");
      }
    }
    
    HereMaps(apiKey: "your apiKey")
          .explorePopularPlaces(
              lat: currentLocation.latitude,
              lon: currentLocation.longitude,
              offset: 10)
          .then((response) {
        setState(() {
          _explorePopularPlace.addAll(response['results']['items']);
        });
      });

Geocoding Autocomplete
     import 'package:here_maps_webservice/here_maps.dart';
     
     List<dynamic> _suggestion = [];
     
     HereMaps(apiKey: "your apiKey")
           .geoCodingAutoComplete(query: "YourQuery")
           .then((response) {
         setState(() {
           _suggestion.addAll(response['suggestions']);
         });
       });
Geocoding
    import 'package:here_maps_webservice/here_maps.dart';
    
    Map<String, dynamic> latLon = Map();
    
    HereMaps(apiKey: "your apiKey")
        .geoCode(searchText: _searchController.text)
        .then((response) {
      setState(() {
        latLon = response['Response']['View'][0]['Result'][0]['Location']
            ['DisplayPosition'];
      });
    });
Reverse Geocoding
    import 'package:here_maps_webservice/here_maps.dart';
    import 'package:location/location.dart' as l; 
    import 'package:flutter/services.dart';
    
    var currentLocation;
    var location = new l.Location();

    try {
      currentLocation = await location.getLocation();
      }on PlatformException catch (error) {
      if (error.code == 'PERMISSION_DENIED') {
        print("Permission Dennied");
      }
    }
    
    Map<String,dynamic> response = HereMaps(apiKey: "your apiKey")
      .reverseGeoCode(lat: currentLocation.latitude, lon: currentLocation.longitude)

TODO

  • Add all the parameters in the existing APIs
  • Add tests
  • Make Model class for exisitng APIs
  • Add routing APIs

Feature Requests and Issues

Please file feature requests and bugs at the issue tracker

Contributing

We would love to see you contribute to here_maps_webservice. Do check out our Contributing Guidelines.

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。