-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,40 @@ | ||
# django-gpxpy | ||
Django integration of GpxPy | ||
=========================== | ||
[![Build Status](https://travis-ci.org/PetrDlouhy/django-gpxpy.svg?branch=master)](https://travis-ci.org/PetrDlouhy/django-gpxpy) | ||
|
||
|
||
This module only contains simple code that parses GPX file to MultiLineString using GpxPy. In the future it might also contain GPX model field and GPX form field which would be used to upload GPX file and parse it. | ||
|
||
Installation | ||
------------ | ||
|
||
``` | ||
pip install django-gpxpy | ||
``` | ||
|
||
Example of usage | ||
----- | ||
|
||
``` | ||
from django_gpxpy import gpx_parse | ||
class TrackModel(models.Model): | ||
track = models.MultiLineStringField( | ||
verbose_name=_(u"trasa"), | ||
srid=4326, | ||
null=True, | ||
blank=True, | ||
geography=True, | ||
) | ||
class TrackForm(ModelForm): | ||
gpx_file = forms.FileField(required=False, help_text=_(u"Upload geometry by GPX file")) | ||
class Meta: | ||
model = TrackModel | ||
def clean(self): | ||
if self.gpx_file: | ||
self.track_clean = gpx_parse.parse_gpx_filefield(track_file) | ||
``` | ||
|