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

graduated classes are altered when saved to qgs #16253

Closed
qgib opened this issue Feb 22, 2013 · 14 comments
Closed

graduated classes are altered when saved to qgs #16253

qgib opened this issue Feb 22, 2013 · 14 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Symbology Related to vector layer symbology or renderers
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Feb 22, 2013

Author Name: Regis Haubourg (@haubourg)
Original Redmine Issue: 7217
Affected QGIS version: master
Redmine category:symbology


confirmed on both 1.8 and master dc074b3.

when classifying continuous numerical data (shp - field type; real ; length 20; precision 5) , classes are generated correctly, but are saved with exponents notation if data exceeds 1000000:
In the following example, the last classe upper value has been converted from 6 034 292 to 6.03429e+06.
real max value is then thrown out of classes because 6.03429e+06 is converted to 6 034 290 when project is reloaded.
All the values close to upper and lower bounds are potentially concerned.

This is a blocker since there is no way to save a project correctly, except modifying classes by hand in a text editor.



@qgib
Copy link
Contributor Author

qgib commented Feb 22, 2013

Author Name: Regis Haubourg (@haubourg)


QML and mapinfo tab are also concerned

@qgib
Copy link
Contributor Author

qgib commented Feb 22, 2013

Author Name: Regis Haubourg (@haubourg)


It could be simple to solve since same problem occured with WMS bounds and scales:
here are some revisions solving thoses problems: [[https://issues.qgis.org/search/index/quantum-gis?q=exponential]]

@qgib
Copy link
Contributor Author

qgib commented Feb 22, 2013

Author Name: Regis Haubourg (@haubourg)


conversion to Double seems to be done here:
[[https://github.com/qgis/Quantum-GIS/blob/master/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp]]
line 888:
double lowerValue = rangeElem.attribute( "lower" ).toDouble();
double upperValue = rangeElem.attribute( "upper" ).toDouble();

use of .toDouble seems to be done everywhere. Any idea ?

@qgib
Copy link
Contributor Author

qgib commented Mar 14, 2013

Author Name: Alexander Bruy (@alexbruy)


Here is patch that should fix such issue. Unfortunately, I can't test it with wide range of datasets, so maybe in some cases it still don't work as expected.


  • pull_request_patch_supplied was changed from 0 to 1
  • 5421 was configured as fix_7217.patch
  • category_id was changed from Map Legend to 83

@qgib
Copy link
Contributor Author

qgib commented Mar 18, 2013

Author Name: Regis Haubourg (@haubourg)


Hi, a little up to commiters: Can anyone test before merge ? This might be a easy-to-solve blocker ;-)
(I can't compile by myself and can only test ith osge4w).
Régis

@qgib
Copy link
Contributor Author

qgib commented May 28, 2013

Author Name: Nathan Woodrow (@NathanW2)


Can we confirm if this still and issue. I can't reproduce here.

@qgib
Copy link
Contributor Author

qgib commented May 28, 2013

Author Name: Mathieu Pellerin - nIRV (Mathieu Pellerin - nIRV)


I can't reproduce this issue either. So what they say is true, time does heal ;o)

@qgib
Copy link
Contributor Author

qgib commented May 28, 2013

Author Name: Nathan Woodrow (@NathanW2)


Regis can you test with the latest build and report back if it is still an issue.


  • resolution was changed from to worksforme
  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented May 28, 2013

Author Name: Regis Haubourg (@haubourg)


Hi, there is no new build on osgeo4w today, I'll try next week (QGIS training by the end of the week!)

@qgib
Copy link
Contributor Author

qgib commented Jun 2, 2013

Author Name: Regis Haubourg (@haubourg)


Hi,
I must reopen, tested in e2bd04f today, problem is still here, qgs is still saved using scientific notation.
see:



<range symbol="2" lower="56" upper="1e+09" label="56.0000 - 1000000389.0000"/>

I join a very simple dataset to build unit tests:


  • 5817 was configured as Grauated_classes_test_sample.zip
  • status_id was changed from Closed to Reopened

@qgib
Copy link
Contributor Author

qgib commented Jun 3, 2013

Author Name: Nathan Woodrow (@NathanW2)


Ok I see it. Will try and fix.

@qgib
Copy link
Contributor Author

qgib commented Jun 27, 2013

Author Name: Minoru Akagi (@minorua)


QVariant::toString() seems to return better results than QString::number(), doesn't it?

In python:

>>> from PyQt4.QtCore import *
>>> val = 6034292.
>>> QString.number(val)
PyQt4.QtCore.QString(u'6.03429e+06')
>>> QVariant(val).toString()
PyQt4.QtCore.QString(u'6034292')

>>> val = 1.000001
>>> QString.number(val)
PyQt4.QtCore.QString(u'1')
>>> QVariant(val).toString()
PyQt4.QtCore.QString(u'1.000001')

@qgib
Copy link
Contributor Author

qgib commented Jun 27, 2013

Author Name: Nathan Woodrow (@NathanW2)


Seems so.

toString is the way to go.

@qgib
Copy link
Contributor Author

qgib commented Jul 5, 2013

Author Name: Jürgen Fischer (@jef-n)


Fixed in changeset "4538cf1593a22c1aba998abfc6f3c730b0943a71".


  • status_id was changed from Reopened to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Symbology Related to vector layer symbology or renderers labels May 24, 2019
@qgib qgib added this to the Version 2.0.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Symbology Related to vector layer symbology or renderers
Projects
None yet
Development

No branches or pull requests

1 participant