MCPcopy
hub / github.com/django/django / add_georss_point

Method add_georss_point

django/contrib/gis/feeds.py:19–30  ·  view source on GitHub ↗

Adds a GeoRSS point with the given coords using the given handler. Handles the differences between simple GeoRSS and the more popular W3C Geo specification.

(self, handler, coords, w3c_geo=False)

Source from the content-addressed store, hash-verified

17 return " ".join("%f %f" % (coord[1], coord[0]) for coord in coords)
18
19 def add_georss_point(self, handler, coords, w3c_geo=False):
20 """
21 Adds a GeoRSS point with the given coords using the given handler.
22 Handles the differences between simple GeoRSS and the more popular
23 W3C Geo specification.
24 """
25 if w3c_geo:
26 lon, lat = coords[:2]
27 handler.addQuickElement("geo:lat", "%f" % lat)
28 handler.addQuickElement("geo:lon", "%f" % lon)
29 else:
30 handler.addQuickElement("georss:point", self.georss_coords((coords,)))
31
32 def add_georss_element(self, handler, item, w3c_geo=False):
33 """Add a GeoRSS XML element using the given item and handler."""

Callers 1

add_georss_elementMethod · 0.95

Calls 2

georss_coordsMethod · 0.95
addQuickElementMethod · 0.80

Tested by

no test coverage detected