Skip to content

Marker outside the map #28

@gabboraron

Description

@gabboraron

I want to place markers dynamically from a JSON file, but some of them appear outside the map as this screenshot shows: https://pasteboard.co/J3WZVcR.png

My code:

	def add_map_markers(self):
		for line in range(0,len(data['positions'])):	
			print(str(line)+" - ")
			for idx in range(0,len(data['positions'][line]['poslist'])):
				print("\tX:"+str(data['positions'][line]['poslist'][idx]['X']))
				print("\tY:"+str(data['positions'][line]['poslist'][idx]['Y']))
				
				marker = MapMarkerPopup(lat= data['positions'][line]['poslist'][idx]['X'], lon=data['positions'][line]['poslist'][idx]['Y'] )
				marker.add_widget(Button(text="Description: "+data['positions'][line]['description']))
				self.add_widget(marker)

with this JSON:

{
"last modification date": timestamp, 
"positions": [
	
		{"poslist": [{"X": 1, "Y": 2}], "photos": [], "description": "", "name": ""},
		{"poslist": [{"X": 3, "Y": 4}, {"X": 5, "Y": 6}], "photos": [], "description": "", "name": ""}
	
]}

How can I block this bad behaviour of the map?

Metadata

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