1
0
Fork 0

Compare commits

...

8 Commits

Author SHA1 Message Date
Tobias Leupold b8b0d32602 Added a README.md for the gitlab mirror 2020-03-25 20:08:22 +01:00
Tobias Leupold 95e0b1a68c No need to walk through all points 2018-07-23 09:24:56 +02:00
Tobias Leupold 0355fd54ce Updated the ChangeLog for the upcoming 0.1.5 release 2018-07-22 17:14:48 +02:00
Tobias Leupold 10a0b253bc make_release: Don't include the make_release script itself 2018-07-22 16:02:42 +02:00
Tobias Leupold e96fa10725 Updated the ChangeLog's format 2018-07-22 16:01:04 +02:00
Emiel Brommer 5e0bdabc35 Added a function to join all segments in the order of the GPX file
This will produce a non-scattered output (only) if the GPX file's
segment order is correct, but the segments don't share points at the
beginning and the end so that the default combining algorithm won't
work.
2018-07-22 15:58:09 +02:00
Tobias Leupold 4ff6618faf Added a make_release script 2018-07-22 15:56:30 +02:00
Tobias Leupold 47d2251d84 Fixed the ChangeLog ;-) 2017-08-19 00:09:50 +02:00
4 changed files with 84 additions and 31 deletions

View File

@ -1,46 +1,47 @@
2015-01-04 Tobias Leupold <tobias.leupold@web.de>
====================== gpx2svg 0.1.5 released (22.07.2018) ======================
* Release: Version 0.1.3
* New: Added a function to join all segments of a GPX file in the (chronologically) given order of
the GPS data. This can help to create an un-scattered output if the segments don't share points
at the beginning and end and thus, the default combining algorithm won't work.
Thanks to Emiel Brommer for the initial patch!
- Replaced the function creating a coordinate string for a segment by a generator. Now, segments
drawing instructions are created step by step instead of assembling a (probably huge) single
string.
* Change: Updated the ChangeLog to a more meaningful format.
2014-09-03 Tobias Leupold <tobias.leupold@web.de>
====================== gpx2svg 0.1.4 released (04.01.2015) ======================
* Release: Version 0.1.3
* Improvement: Replaced the function creating a coordinate string for a segment by a generator. Now,
segments drawing instructions are created step by step instead of assembling a (probably huge)
single string.
- Changed the shebang line so that gpx2svg now also runs on Mac
====================== gpx2svg 0.1.3 released (09.03.2014) ======================
- Changed the use of the literal "/dev/stdin" and "/dev/stdout" to sys.stdin and sys.stdout.
Hopefully, gpx2svg will now also work on Windows (not tested).
* Bugfix: Changed the shebang line so that gpx2svg now also runs on Mac
- Overall code cleanup
* Bugfix: Changed the use of the literal "/dev/stdin" and "/dev/stdout" to sys.stdin and sys.stdout.
Hopefully, gpx2svg will now also work on Windows (not tested).
2013-11-07 Tobias Leupold <tobias.leupold@web.de>
* Generally: Overall code cleanup
* Release: Version 0.1.2
====================== gpx2svg 0.1.2 released (07.11.2013) ======================
- Fixed crash when processing GPX files with empty or no path segments.
Thanks to Fabian Seitz for the bug report!
* Bugfix: Fixed crash when processing GPX files with empty or no path segments.
Thanks to Fabian Seitz for the bug report!
- Added exception handler for non-readable or non-existant files or files with no valid GPX
data.
* Improvement: Added exception handler for non-readable or non-existant files or files with no valid
GPX data.
2012-08-26 Tobias Leupold <tobias.leupold@web.de>
====================== gpx2svg 0.1.1 released (26.08.2012) ======================
* Relase: Version 0.1.1
* Improvement: Made the internal data structure simpler. Don't store the IDs of the tracks.
- Made the internal data structure simpler. Don't store the IDs of the tracks.
* Improvement/Bugfix: Combine path segments before doing the Mercator projection, so that rounding
errors can't affect the search.
- Combine path segments before doing the Mercator projection, so that rounding errors can't
affect the search.
* Improvement: Made the algorithm to search for combinable paths more effective.
- Made the algorithm to search for combinable paths more effective.
* New: Draw circles instead of single points (that will not be shown). Added a command line option
to drop such single points.
- Draw circles instead of single points (that will not be shown). Added a command line option
to drop such single points.
====================== gpx2svg 0.1 released (25.08.2012) ======================
2012-08-25 Tobias Leupold <tobias.leupold@web.de>
* Release: Version 0.1 (Initial release)
* New: Initial release

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# gpx2svg
## Convert GPX data to SVG
gpx2svg does, as the name implies, convert a GPX dataset to a SVG file, using the Mercator projection. It's implemented in pure Python 3, only using the standard library.
## Homepage
The project's official homepage with further information is <https://nasauber.de/opensource/gpx2svg/>.
## Sources
The official source repository is `git.l3u.de/gpx2svg.git` (can be checked out anonymously using `git://`).

24
gpx2svg
View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright (c) 2012-2015 Tobias Leupold <tobias.leupold@web.de>
# Copyright (c) 2012-2018 Tobias Leupold <tobias.leupold@gmx.de>
#
# gpx2svg - Convert GPX formatted geodata to Scalable Vector Graphics (SVG)
#
@ -17,7 +17,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
__version__ = '0.1.4'
__version__ = '@VERSION@'
import argparse
import sys
@ -184,6 +184,13 @@ def combineSegments(gpsData):
return circularSegments + remainingSegments
def chronologyJoinSegments(gpsData):
"""Join all segments to a big one in the order defined by the GPX file."""
joinedSegment = []
for segment in gpsData:
joinedSegment += segment
return [joinedSegment]
def scaleCoords(coord, height, scale):
"""Return a scaled pair of coordinates"""
return coord[0] * scale, (coord[1] * -1 + height) * scale
@ -305,6 +312,12 @@ def main():
help = ('"Raw" conversion: Create one SVG path per track segment, don\'t try to combine '
'paths that end with the starting point of another path')
)
cmdArgParser.add_argument(
'-j', action = 'store_true',
help = ('Join all segments to a big one in the order of the GPX file. This can create an '
'un-scattered path if the default combining algorithm does not work because there '
'are no matching points across segments (implies -r)')
)
# Get the given arguments
cmdArgs = cmdArgParser.parse_args()
@ -331,8 +344,13 @@ def main():
print('No data to convert. Terminating.', file = sys.stderr)
sys.exit(1)
# Join all segments if requested by "-j"
if cmdArgs.j:
gpsData = chronologyJoinSegments(gpsData)
# Try to combine all track segments that can be combined if not requested otherwise
if not cmdArgs.r:
# Don't execute if all segments are already joined with "-j"
if not cmdArgs.r and not cmdArgs.j:
gpsData = combineSegments(gpsData)
# Calculate a plane projection for a GPS dataset

21
make_release Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# Get the version we're releasing
version=$(git describe)
version=${version##*v}
# Create snapshot
mkdir gpx2svg-$version
git archive HEAD | tar -xC gpx2svg-$version
cd gpx2svg-$version
# Update the project version
sed -i -e "s/@VERSION@/$version/" gpx2svg
# Remove the "make_release" script
rm make_release
# Create the release tarball
cd ..
tar -cJf gpx2svg-$version.tar.xz gpx2svg-$version
rm -r gpx2svg-$version