trueclou
Posts: 7
Joined: Wed May 15, 2024 9:19 pm

How to fit map to points in mappoint series?

Hi,

my apologies, if the following is a totally newbie question.

I have a map with a tiledwebmap series as map background and a bunch of points (actually an array of geolocation datapoints from several sources) in serval mappoint series.
My goal is to simply fit the mapView to the data in the mappoint series and eventually dynamically adjust the view if new points are added to the series.

I, of course, searched the documentation and did some google on the problem. I tried to use fitToBounds, fitToGeometry, setExtremes, but with no success. The recommendMapView method sounds good, but I didn't find any example how to properly use it.

Is there any example how I could achieve this 'auto adjust to data' behavior?

Best, Christoph
User avatar
dawid.d
Site Moderator
Posts: 960
Joined: Thu Oct 06, 2022 11:31 am

Re: How to fit map to points in mappoint series?

Hello,

Welcome to our forum and thanks for contacting us with your question!

See the demo below with examples of how the fit-methods can be applied. If this does not help you, please prepare a demo, e.g. in jsfiddle, so that I can help you with a specific example.

Demo: https://jsfiddle.net/gh/get/library/pur ... togeometry

Let me know if that was what you were looking for!
Kind regards
Dawid Draguła
Highcharts Developer
trueclou
Posts: 7
Joined: Wed May 15, 2024 9:19 pm

Re: How to fit map to points in mappoint series?

Thanks a lot, this was very helpful! :-)

Return to “Highcharts Maps”