Convenience class for generating links to maps.
>>> ml = MapLink("58147N/07720W", "58.235278", "-77.333333")
>>> ml
<MapLink 58.235278, -77.333333>
Return the coordinates stored by this MapLink, separated by optional separator character separator.
Latitude value, converted to a string. Automatically quantized according to input precision.
Longitude value, converted to a string. Automatically quantized according to input precision.
Calls the link generator function passed as link_generator to generate a link to the URL baseurl, with parameters params.
The link text is set to the original string, while the link title is set to the original string followed by the parsed coordinates in parentheses.
Parameters: |
|
---|
>>> ml = MapLink("ABC123", "-10.0", "20.0")
>>> ml.make_link("http://www.example.com/?",
... {'foo': 'bar',
... 'lat': ml.lat_str,
... 'lon': ml.long_str},
... default_link)
u'<a href="http://www.example.com/?lat=-10.0&foo=bar&lon=20.0" title="ABC123 (-10.0, 20.0)">ABC123</a>'
Original string contaning parsed coordinates.
The default link generating function, for generating HTML links as strings. To generate links as Genshi elements, lxml elements, etc., supply an alternate link-generating function which takes the same parameters.
>>> default_link("http://www.google.com", "Google")
u'<a href="http://www.google.com">Google</a>'
>>> default_link("http://www.google.com", "Google", "Google")
u'<a href="http://www.google.com" title="Google">Google</a>'