[gdal-dev] RE Python ogr GetFieldAsString problem

Even Rouault even.rouault at spatialys.com
Thu May 14 07:16:32 PDT 2015


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


More information about the gdal-dev mailing list