[gdal-dev] RE Python ogr GetFieldAsString problem

Steve.Toutant at inspq.qc.ca Steve.Toutant at inspq.qc.ca
Thu May 14 07:24:30 PDT 2015


I agree, no patch. 
Actually the patch will be on my side. I might use python re, to replace 
the comma by dot int he WFS response, for numeric field

If others are in the same situation, your suggestions are welcome
thanks





Even Rouault <even.rouault at spatialys.com> 
2015-05-14 10:16

A
Steve.Toutant at inspq.qc.ca
cc
gdal-dev at lists.osgeo.org
Objet
Re: [gdal-dev] RE Python ogr GetFieldAsString problem








Selon Steve.Toutant at inspq.qc.ca:

> Hi Even,
> I don't understand why GetFieldAsString() truncates the value....Should 
it
> reads the value as it is?

To be pedantic, GetFieldAsString() does not truncate the value. The value 
is
truncated before, in the GML reader, when inserting the value from the GML 
as a
real value into the OGR real field.

> Is it because it also use a  GML reader?

The conversion from the XML content to the real value is done with a 
function
(CPLAtof()) that assumes dot as the decimal character, which is the 
correct
behaviour in that instance.

I guess you would have issues with most GML readers, that's why I'm a bit
hesitant into committing the patch.

>
> In this case I should probably use another tool than ogr to parse the 
GML,
> something like preg_match in php....
> Thanks
> steve
> Steve Toutant, M. Sc.
> Analyste en géomatique
> Secteur environnement
> Direction de la santé environnementale et de la toxicologie
> Institut national de santé publique du Québec
> 945, avenue Wolfe
> 4e étage, Québec, Qc
> G1V 5B3
> 418 654-3010 poste 5428
>
> http://www.inspq.qc.ca
> http://www.monclimatmasante.qc.ca


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150514/7d10671a/attachment.html>


More information about the gdal-dev mailing list