Skip to content

Example doesn't work #48

Open
Open
@k3rne1pan1c

Description

Describe the bug
Using the example in the documentation throws an error due to a negative value used as a parameter.

To Reproduce
`
from kivy.garden.mapview import MapView, MapMarker
from kivy.app import App

class FirstKivy(App):

def build(self):

    map = MapView(zoom=13, lat=50.6394, lon=3.057)
    m1 = MapMarker(lon=50.6394, lat=3.057)  # Lille
    m2 = MapMarker(lon=-33.867, lat=151.206)

    map.add_marker(m1)
    map.add_marker(m2)

    return map

FirstKivy().run()
`

Expected behavior
Should work if you use it as an example

Logs/output

Traceback (most recent call last):
File "/home/k3rne1pan1c/Documents/projects/wherRu/main.py", line 15, in
FirstKivy().run()
File "/home/k3rne1pan1c/Documents/projects/wherRu/lib/python3.9/site-packages/kivy/app.py", line 949, in run
self._run_prepare()
File "/home/k3rne1pan1c/Documents/projects/wherRu/lib/python3.9/site-packages/kivy/app.py", line 919, in _run_prepare
root = self.build()
File "/home/k3rne1pan1c/Documents/projects/wherRu/main.py", line 12, in build
map.add_marker(m2)
File "/home/k3rne1pan1c/.kivy/garden/garden.mapview/mapview/view.py", line 464, in add_marker
layer.set_marker_position(self, marker)
File "/home/k3rne1pan1c/.kivy/garden/garden.mapview/mapview/view.py", line 247, in set_marker_position
x, y = mapview.get_window_xy_from(marker.lat, marker.lon, mapview.zoom)
File "/home/k3rne1pan1c/.kivy/garden/garden.mapview/mapview/view.py", line 361, in get_window_xy_from
y = ms.get_y(zoom, lat) - vy
File "/home/k3rne1pan1c/.kivy/garden/garden.mapview/mapview/source.py", line 94, in get_y
return ((1.0 - log(tan(lat) + 1.0 / cos(lat)) / pi) /
ValueError: math domain error

If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • OS: Pop!_OS 21.04
  • Python version: 3.9.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions