1 2 3 4 5 6 7 8 9 10 11 12 13 | import os
from django.contrib.gis.utils import LayerMapping
class GPXMapping(LayerMapping):
def __init__(self, *args, **kwargs):
# Setting this environment variable tells OGR to use the elevation
# attribute as the Z coordinate value on the geometries. See:
# http://www.gdal.org/ogr/drv_gpx.html
os.environ['GPX_ELE_AS_25D'] = 'YES'
super(GPXMapping, self).__init__(*args, **kwargs)
# Unset the environment variable, so it doesn't affect other
# GPX DataSource objects.
os.environ.pop('GPX_ELE_AS_25D')
|
More like this
- Google v3 geocoding for Geodjango admin site by samhag 7 months, 2 weeks ago
- GeoDjango maps in admin TabularInlines by alanB 2 years, 8 months ago
- GoogleAdmin: GMaps base layer in Geographic Admin (GeoDjango) by jbronn 4 years, 8 months ago
- GeoJSON Serializer for GeoDjango (gis) by danielsokolowski 2 years, 1 month ago
- Updated: GeoJSON Serializer for GeoDjango (gis) by danielsokolowski 1 year, 7 months ago
Comments
Great, thanks for this great recipe. Is there any way to plot it on a GoogleMap widget which seems to only accept LineStrings, or I'm overlooking something ?
Keep up the good work.
#