Right, that must be it! Thanks for the clarification
and the testing,

best regards,
Michael


> Looks like it's a known issue, and fixed 3 months ago:
> http://hub.qgis.org/issues/8332.
>
>
> On Sat, May 10, 2014 at 11:08 AM, Michael Nolde <
> no...@geographie.uni-kiel.de> wrote:
>
>> Dear Sean,
>>
>> this is weird. You're right, I also get rounded values in Open Office,
>> ogrinfo and in
>> GRASS. However, when I open the file in QGIS (both version 2.0 and 2.2),
>> I
>> see decimal places (as is supposedly correct).
>> See this screenshot: http://www.flatpolar.org/floatval_qgis22.png
>> So the information was not lost during creation of the shapefile.
>> And funny enough, if I don't use OpenOffice calc but 'Gnumeric', I also
>> see
>> the correct entries with deciamal places
>> (http://www.flatpolar.org/floatval_gnumeric.png).
>> This leaves me somewhat confused.
>>
>> I originally created the file from an XLS-Spreadsheet using the QGIS csv
>> import tool. My guess now is that the different output originates from
>> some country specific settings inside the software packages used, maybe
>> some issue with dot or comma being used as seperator. However, the
>> original file is displayed correctly in both Open Office and Gnumeric.
>>
>> Well, whatever it is, it is pretty obvious that the problem does not lie
>> with fiona. I'm not sure how to proceed. Any suggestions?
>>
>> Have a nice weekend!
>> Michael
>>
>>
>> > Michael,
>> >
>> > I see what you mean. GDAL's ogrinfo reports the same as Fiona:
>> >
>> >   LEISTUNG (Real) = 1.000000000000000
>> >   EINHEIT (String) = MW
>> >   BEZUG (String) = FWL
>> >   POINT (506130.0 6071821.0)
>> >
>> > OGRFeature(test):1
>> >   fid (String) =
>> Nolde_Uni_Kiel_Biogas_WKA_Tabelle_Febr_2014_BGA_25832.93
>> >   BST_NR (Real) = 54001325650.000000000000000
>> >   ANL_NR (String) = 0001
>> >   ANLAGENBEZ (String) = Biogasanlage
>> >   VIERTE_BIM (String) = 1.2.2.2V
>> >   AN_RW (Integer) = 32503337
>> >   AN_HW (Integer) = 6073281
>> >   LEISTUNG (Real) = 613.000000000000000
>> >   EINHEIT (String) = kW
>> >   BEZUG (String) = elektr. Leistung
>> >   POINT (503337.000000000116415 6073281.0)
>> >
>> > OGRFeature(test):2
>> >   fid (String) =
>> Nolde_Uni_Kiel_Biogas_WKA_Tabelle_Febr_2014_BGA_25832.94
>> >   BST_NR (Real) = 54001325650.000000000000000
>> >   ANL_NR (String) = 0001
>> >   ANLAGENBEZ (String) = Biogasanlage
>> >   VIERTE_BIM (String) = 1.2.2.2V
>> >   AN_RW (Integer) = 32503337
>> >   AN_HW (Integer) = 6073281
>> >   LEISTUNG (Real) = 1.000000000000000
>> >   EINHEIT (String) = MW
>> >   BEZUG (String) = FWL
>> >   POINT (503337.000000000116415 6073281.0)
>> >
>> > I opened the test.dbf file in OpenOffice and also saw rounded values.
>> >
>> > What software did you use to create the shapefile? With what software
>> are
>> > you seeing the values [1.5, 613.0, 1.5]? Is it possible that precision
>> is
>> > being lost when writing the shapefile?
>> >
>> >
>> >
>> > On Fri, May 9, 2014 at 4:34 PM, Michael Nolde
>> > <mno...@gis.uni-kiel.de>wrote:
>> >
>> >> Hi Sean,
>> >>
>> >> I uploaded the shapefile together with a demo script here:
>> >> http://flatpolar.org/floatval.zip
>> >>
>> >> Executing the script produces the following output with my setup:
>> >> Item Nr. 0 :  1.0
>> >> Item Nr. 1 :  613.0
>> >> Item Nr. 2 :  1.0
>> >> Item Nr. 3 :  0.0
>> >> Item Nr. 4 :  1.0
>> >> Item Nr. 5 :  1.0
>> >> Item Nr. 6 :  0.0
>> >> Item Nr. 7 :  1.0
>> >> Item Nr. 8 :  1.0
>> >> Item Nr. 9 :  500.0
>> >>
>> >> while the output should be:
>> >> Item Nr. 0 :  1.5
>> >> Item Nr. 1 :  613.0
>> >> Item Nr. 2 :  1.5
>> >> Item Nr. 3 :  0.94
>> >> ...
>> >>
>> >> The attribute field used is named 'LEISTUNG'.
>> >> I'm probably just doing something wrong here, but I'm really stuck.
>> >> Thank you very much for your support, this is highly appreciated!
>> >>
>> >>
>> >> Best regards (and since this is my first post here, hello to
>> everybody).
>> >>
>> >> Michael
>> >>
>> >>
>> >> > Hi Michael,
>> >> >
>> >> > I can't reproduce this error with any data I have. Can you put your
>> >> > shapefile up for download and tell me which field(s) are the ones
>> >> being
>> >> > rounded? I'll take a look if you can.
>> >> >
>> >> > Yours,
>> >> >
>> >> >
>> >> > On Fri, May 9, 2014 at 6:14 AM, Michael Nolde
>> >> > <no...@geographie.uni-kiel.de>wrote:
>> >> >
>> >> >>  Hi there,
>> >> >>
>> >> >> I noticed some strange behavior when reading float values from
>> >> shapefile
>> >> >> attributes with fiona.
>> >> >> In the attribute table, I have the following values (type of
>> column
>> >> is
>> >> >> 'float'):
>> >> >> 1.5, 613.0, 0.9
>> >> >>
>> >> >> but when I open the shapefile with fiona and read the attributes
>> with
>> >> >> something like:
>> >> >>
>> >> >> somevar = float(item['properties']['VAR'])
>> >> >> I get: 1.0, 613.0, 0.0
>> >> >>
>> >> >> So the values seem to be rounded down. Am I missing something?
>> Could
>> >> >> this
>> >> >> be a bug?
>> >> >> The fiona version I use is: 1.1.4 (Python 2.7.6 on Ubuntu 14.04 64
>> >> bit).
>> >> >>
>> >> >> Best regards,
>> >> >> Michael
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Dr. rer. nat. Michael Nolde
>> >> >> Christian-Albrechts-Universität zu Kiel
>> >> >> Geographisches Institut (Sektion Geographie)
>> >> >> Neufeldtstraße 10, Laurispark - Geb. 32, 24118 Kiel
>> >> >> Tel.: 0431 880-4909
>> >> >> E-Mail:    no...@geographie.uni-kiel.de
>> >> >>
>> >> >> _______________________________________________
>> >> >> Community mailing list
>> >> >> Community@lists.gispython.org
>> >> >> http://lists.gispython.org/mailman/listinfo/community
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Sean Gillies
>> >> > _______________________________________________
>> >> > Community mailing list
>> >> > Community@lists.gispython.org
>> >> > http://lists.gispython.org/mailman/listinfo/community
>> >> >
>> >>
>> >>
>> >> --
>> >>
>> >>
>> >> _______________________________________________
>> >> Community mailing list
>> >> Community@lists.gispython.org
>> >> http://lists.gispython.org/mailman/listinfo/community
>> >>
>> >
>> >
>> >
>> > --
>> > Sean Gillies
>> >
>>
>>
>> --
>> Dipl.-Geogr. Michael Nolde
>>
>> Zentrum f�r Geoinformation (ZfG)
>> Christian-Albrechts-Universit�t zu Kiel
>> Boschstr. 1
>> 24118 Kiel
>>
>> Telefon: (0431) 23952115
>> E-Mail: mno...@gis.uni-kiel.de
>>
>> _______________________________________________
>> Community mailing list
>> Community@lists.gispython.org
>> http://lists.gispython.org/mailman/listinfo/community
>>
>
>
>
> --
> Sean Gillies
>


-- 
Dipl.-Geogr. Michael Nolde

Zentrum f�r Geoinformation (ZfG)
Christian-Albrechts-Universit�t zu Kiel
Boschstr. 1
24118 Kiel

Telefon: (0431) 23952115
E-Mail: mno...@gis.uni-kiel.de

_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

Reply via email to