Skip to content

Commit

Permalink
Make KML more valid osm-fr#466
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Jul 16, 2023
1 parent cd0d969 commit 25be502
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions api/issues_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def kml_issue(
)
return E.Placemark(
E.name(name),
E.url(map_url),
ElementMaker(namespace="https://www.w3.org/2005/Atom").link(href=map_url),
E.description(desc),
E.styleUrl("#placemark-purple"),
E.Point(
Expand Down Expand Up @@ -224,18 +224,26 @@ def kml(
title, _, url = xml_header(params, title, website, lang, query, i18n)
if len(issues) > 0:
title += " (" + issues[0]["timestamp"].strftime("%Y-%m-%dT%H:%M:%SZ") + ")"
return E.kml(
return ElementMaker(
nsmap={
"atom": "https://www.w3.org/2005/Atom",
}
).kml(
E.Document(
E.name(title),
E.Style(
E.IconStyle(
E.Icon(E.href("https://maps.me/placemarks/placemark-purple.png")),
E.Icon(
E.href(
"https://osmose.openstreetmap.fr/images/markers/marker-b-1070.png"
)
),
),
id="placemark-purple",
),
E.name(title),
E.url(url),
ElementMaker(namespace="https://www.w3.org/2005/Atom").link(href=url),
*content,
),
*content,
xmlns="https://www.opengis.net/kml/2.2",
)

Expand Down

0 comments on commit 25be502

Please sign in to comment.