Code Monkey home page Code Monkey logo

Comments (2)

tkrajina avatar tkrajina commented on July 25, 2024

I'm not on my computer now, but there was a similar issue recently. I
pushed a branch which fixes it and maybe it fixes your one, too. It's not
yet merged in master. Can you try it to see if it works properly there?

On Sat, May 28, 2016, 07:24 tmecha [email protected] wrote:

Using gpxpy 1.1.1, GPX 1.1, and python 3.4
I had some issues where tags were missing, turn out if gpx_point.elevation
= 0 as floating point type then tag doesn't make it through.

A couple locations where elevation = 0 fails comparisons:
gpx.py line 1280 in def has_elevations(self):
if track_point.elevation:
found += 1

I changed this to:
if track_point.elevation is not None:
found += 1

This way the value of 0 is still allowed.
I also believe the following statement in gpxfield.py incorrectly removes
a 0 tag:
def to_xml(self, value, version):
if not value:
return ''

and should be:
def to_xml(self, value, version):
if value is None:
return ''

There must be another location where elevation==0 gets filtered out. I
made it this far then was in time crunch so did my own conversion of float
to string when assigning elevation and it worked.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#62, or mute the thread
https://github.com/notifications/unsubscribe/AAXJa3loAy2tLF1tRLPoatsnknJ8z01sks5qF9GcgaJpZM4Io_9o
.

:wq!

from gpxpy.

tkrajina avatar tkrajina commented on July 25, 2024

Merged to master, it should work now:

$ python -m unittest test.MinidomTests.test_zero_latlng
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/0" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd" version="1.0" creator="gpx.py -- https://github.com/tkrajina/gpxpy">
<trk>
<trkseg>
<trkpt lat="0" lon="0">
<ele>0</ele></trkpt></trkseg></trk></gpx>

from gpxpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.