GeoFeedMixin
This mixin provides the necessary routines for SyndicationFeed subclasses to produce simple GeoRSS or W3C Geo elements.
Methods
georss_coords()
@classmethod
def georss_coords(
coords: tuple
) - > string
In GeoRSS coordinate pairs are ordered by lat/lon and separated by a single white space. Given a tuple of coordinates, return a string GeoRSS representation.
Parameters
| Name | Type | Description |
|---|---|---|
| coords | tuple | A sequence of coordinate tuples, where each inner tuple contains (longitude, latitude) values to be converted. |
Returns
| Type | Description |
|---|---|
string | A space-separated string of latitude and longitude pairs formatted for GeoRSS. |
add_georss_point()
@classmethod
def add_georss_point(
handler: [SyndicationFeed](../../../utils/feedgenerator/syndicationfeed.md?sid=django_utils_feedgenerator_syndicationfeed),
coords: tuple,
w3c_geo: boolean = False
)
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.
Parameters
| Name | Type | Description |
|---|---|---|
| handler | [SyndicationFeed](../../../utils/feedgenerator/syndicationfeed.md?sid=django_utils_feedgenerator_syndicationfeed) | The feed generator handler used to append the XML elements. |
| coords | tuple | A tuple containing the longitude and latitude of the point. |
| w3c_geo | boolean = False | A flag indicating whether to use the W3C Geo (geo:lat/lon) format instead of the simple GeoRSS (georss:point) format. |
add_georss_element()
@classmethod
def add_georss_element(
handler: [SyndicationFeed](../../../utils/feedgenerator/syndicationfeed.md?sid=django_utils_feedgenerator_syndicationfeed),
item: dict,
w3c_geo: boolean = False
)
Add a GeoRSS XML element using the given item and handler.
Parameters
| Name | Type | Description |
|---|---|---|
| handler | [SyndicationFeed](../../../utils/feedgenerator/syndicationfeed.md?sid=django_utils_feedgenerator_syndicationfeed) | The feed generator handler used to append the XML elements. |
| item | dict | A dictionary representing the feed item, which must contain a 'geometry' key with coordinate data or a geometry object. |
| w3c_geo | boolean = False | A flag indicating whether to use the W3C Geo format; note that W3C Geo only supports Point geometries. |