diff --git a/doc/tutorials/writing.rst b/doc/tutorials/writing.rst index 3bdbff1..31187ff 100644 --- a/doc/tutorials/writing.rst +++ b/doc/tutorials/writing.rst @@ -1,10 +1,10 @@ -Writing -------- +Converting and Saving +--------------------- Save as GPX file ^^^^^^^^^^^^^^^^ -The :py:meth:`~to_gpx` allows to export a :py:class:`~ezgpx.gpx.GPX` object as a GPX file. +The :py:meth:`~to_gpx` allows to export a :py:class:`~ezgpx.gpx.GPX` object as a `GPX `_ file. :: @@ -16,4 +16,55 @@ The :py:meth:`~to_gpx` allows to export a :py:class:`~ezgpx.gpx.GPX` object as a # Do stuff with GPX object # Save as GPX file - gpx.to_gpx("new_file.gpx") \ No newline at end of file + gpx.to_gpx("new_file.gpx") + +Save as KML file +^^^^^^^^^^^^^^^^ + +The :py:meth:`~to_kml` allows to export a :py:class:`~ezgpx.gpx.GPX` object as a `KML `_ file. + +:: + + from ezgpx import GPX + + # Parse GPX file + gpx = GPX("file.gpx") + + # Do stuff with GPX object + + # Save as KML file + gpx.to_kml("new_file.kml") + +Save as CSV file +^^^^^^^^^^^^^^^^ + +The :py:meth:`~to_csv` allows to export a :py:class:`~ezgpx.gpx.GPX` object as a `CSV `_ file. + +:: + + from ezgpx import GPX + + # Parse GPX file + gpx = GPX("file.gpx") + + # Do stuff with GPX object + + # Save as CSV file + gpx.to_csv("new_file.csv", columns=["lat", "lon", "ele"]) + +Convert to Pandas Dataframe +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The :py:meth:`~to_kml` allows to convert a :py:class:`~ezgpx.gpx.GPX` object as a `Pandas Dataframe `_. + +:: + + from ezgpx import GPX + + # Parse GPX file + gpx = GPX("file.gpx") + + # Do stuff with GPX object + + # Convert to Pandas Dataframe + df = gpx.to_dataframe() \ No newline at end of file diff --git a/examples/conversion.py b/examples/conversion.py index 9a746b4..6228627 100644 --- a/examples/conversion.py +++ b/examples/conversion.py @@ -3,11 +3,14 @@ # Parse GPX file gpx = ezgpx.GPX("file.gpx") -# Convert to Pandas Dataframe -df = gpx.to_dataframe() +# Save as GPX file +gpx.to_gpx("new_file.gpx") + +# Save as KML file +gpx.to_kml("new_file.kml") -# Convert to CSV -gpx.to_csv("file.csv", columns=["lat", "lon", "ele"]) +# Save as CSV file +gpx.to_csv("new_file.csv", columns=["lat", "lon", "ele"]) -# Convert to KML -gpx.to_kml("file.kml") \ No newline at end of file +# Convert to Pandas Dataframe +df = gpx.to_dataframe() \ No newline at end of file diff --git a/ezgpx/gpx/gpx.py b/ezgpx/gpx/gpx.py index 52579cd..78b63ce 100644 --- a/ezgpx/gpx/gpx.py +++ b/ezgpx/gpx/gpx.py @@ -494,7 +494,7 @@ def merge(self, gpx: GPX): if self.gpx.extensions is None: self.gpx.extensions = gpx.gpx.extensions - def to_string(self) -> str: + def to_gpx_string(self) -> str: """ Convert the GPX object to a string. diff --git a/notes.md b/notes.md index 2cbdf47..1be5c80 100644 --- a/notes.md +++ b/notes.md @@ -37,6 +37,7 @@ - [gpxpy](https://github.com/tkrajina/gpxpy) ## 📝 TO DO LIST !! +- Change to project.toml (https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html) - Documentation for conversion + Medium - Sub classes for GPX & KML writers - Merge method