Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
509 views
in Technique[技术] by (71.8m points)

Zoom HERE maps to show all markers Flutter

I have multiple locations that I am displaying on HERE maps in my Flutter app. There are in all 4 markers, out of which 3 markers are in one city and 1 is in another city. Currently, my map zooms to a level where only the 3 markers in one city are visible, whereas the 4th one is not visible. In order to see that marker, I have to zoom out a considerable level.

Is there a way, I can show all the markers within the bounds of the map?

I have got answer for android but not for Flutter.

Zoom HERE maps to show all markers Android


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

based on this answer on android. I have tried in flutter and it worked.

 GeoBox target = GeoBox.containingGeoCoordinates(geoCoordinateList);
_hereMapController.camera
      .lookAtAreaWithOrientation(target, MapCameraOrientationUpdate(20, 0));

geoCoordinateList is a list of GeoCoordinates of MapMarker visible on HERE map

if you are using it on button click then use it directly. if you are using it directly after adding geocoordinates to geoCoordinateList then use it with delay

Future.delayed(Duration(milliseconds: 10)).then((value) {
  GeoBox target = GeoBox.containingGeoCoordinates(geoCooList);
  _hereMapController.camera
      .lookAtAreaWithOrientation(target, MapCameraOrientationUpdate(20, 0));
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...