nathan-gs / ha-map-card

A Map Card for Home Assistant
https://community.home-assistant.io/t/map-card-a-slightly-improved-map-card/693088
MIT License
30 stars 9 forks source link

Cannot zoom in like on a stock map card #71

Closed ildar170975 closed 1 month ago

ildar170975 commented 3 months ago

Compare these cards - ha-map (left) & stock map (right):

image

Same building; on the left card I cannot zoom in more. Seems to be using same OpenStreetMap. Are there any limitations for zooming?

nathan-gs commented 3 months ago

You can override the maxZoom of the tile layer: https://leafletjs.com/reference.html#tilelayer

tile_layer_options:
  maxZoom: 25
nathan-gs commented 3 months ago

@ildar170975 would you mind adding this in the readme in a PR?

ildar170975 commented 3 months ago

I would add details to readme as soon as understand it... See some strange behaviour:

  1. Define maxZoom=20 - a map is not shown: image

  2. Zoom out, zoom in (press "-", then "+") - a map is shown. image

type: custom:map-card
entities:
  - entity: person.ildar
tile_layer_options:
  maxZoom: 20
nathan-gs commented 3 months ago

Odd, can you look at the console and see if there are any issues loading? (especially in the networking tab)

ildar170975 commented 3 months ago

Console: image

As for "Network" - not sure where to find: image

nathan-gs commented 3 months ago

It does mention BadRequest on the zoomed in 20 ones (first screenshot).

ildar170975 commented 3 months ago

As for PR for readme: in a stock map card a value is 20: https://github.com/home-assistant/frontend/blob/76daa2bb7fa0676399d2ec40055deba0db23de9a/src/common/dom/setup-leaflet-map.ts#L50 So may be we should add as an example this "maxZoom: 20" case.

ildar170975 commented 3 months ago

It does mention BadRequest on the zoomed in 20 ones (first screenshot).

Interesting, I wonder are there any differences with a stock map card then. No errors here: image

type: map
entities:
  - entity: person.ildar
default_zoom: 20
theme_mode: auto
nathan-gs commented 1 month ago

Added docs in v1.5.1

ildar170975 commented 1 month ago

@nathan-gs Thanks for a useful example in Readme!

Do you have any idea what could be a reason of a glitch described here?