When creating latitude and longitude fields, the map view show wrong pin position because Geolocation JSON wants the point defined has [longitude,latitude] instead of [latitude,longitude].
Original code.
def create_gps_markers(coords):
"""Build Marker based on latitude and longitude."""
geojson_dict = []
for i in coords:
node = {"type": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": None}}
node["properties"]["name"] = i.name
node["geometry"]["coordinates"] = [i.latitude, i.longitude]
geojson_dict.append(node.copy())
return geojson_dict
Edited code (inverted latitude and longitude)
def create_gps_markers(coords):
"""Build Marker based on latitude and longitude."""
geojson_dict = []
for i in coords:
node = {"type": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": None}}
node["properties"]["name"] = i.name
node["geometry"]["coordinates"] = [i.longitude, i.latitude]
geojson_dict.append(node.copy())
return geojson_dict