Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distances in export are written in exponential notation instead of regular notation #33

Open
serviax opened this issue Feb 10, 2016 · 4 comments
Assignees
Labels

Comments

@serviax
Copy link

serviax commented Feb 10, 2016

Hi,

When creating an export of shapes there is an optional field called shape_dist_traveled, this field does not allow exponential notation, however by default this library does use exponential notation when the value is rather small (default behaviour of .Net)

Can this be changed so that it does never use exponentation notation?
Hint : the location where this occurs is in GTFSWriter.cs in method Write(IGTFSTargetFile file, IEnumerable entities) on the following line :
data[4] = this.WriteFieldDouble("shapes", "shape_dist_traveled", entity.DistanceTravelled);

hereunder is the warning stated that you will get when exporting data with this library and validating it with the feed validator from google :

Invalid numeric value 9.49307305463114E-05. Please ensure that the number includes an explicit whole number portion (ie. use 0.5 instead of .5), that you do not use the exponential notation (ie. use 0.001 instead of 1E-3), and that it is a properly formated decimal value.
in line 7 of shapes.txt

@serviax serviax changed the title distances in GTFS are written distances in export are written in exponential notation instead of regular notation Feb 10, 2016
@xivk
Copy link
Contributor

xivk commented Feb 11, 2016

Thanks for checking and reporting 👍 will have a look first thing next time I work on this. Should not take too long to fix.

@xivk xivk self-assigned this Feb 11, 2016
@xivk xivk added the bug label Feb 11, 2016
@serviax
Copy link
Author

serviax commented Feb 11, 2016

great!
By the way I expect that the same issue occurs with any other value that can be a double ( latitude, longitude, distance, .... )

@xivk
Copy link
Contributor

xivk commented Feb 11, 2016

Ah, ok, thanks... will check the spec again first before fixing.

@rorlic
Copy link

rorlic commented Feb 26, 2016

I have a fix ready. See my fork.
I took precision 1E-9. Tune it as you see fit.

rorlic pushed a commit to rorlic/GTFS that referenced this issue Feb 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants