[gdal-dev] OGR 1.11 upgrade -> Geometry gone after layer.SetFeature() (MSSQL)

Niels Kjøller Hansen niels.k.h at gmail.com
Thu May 15 05:01:58 PDT 2014


Hi Even,

Thank you for responding so fast. I am not sure, however, how to use
ogr2ogr and ogrinfo to further diagnose my problem.

I have tried stepping through batch file, where the Python script is a part..

Ogr2ogr loads the file into dbo.table_name as it should (although with
wrong character set)
The I run the python script:

C:\> python fix_mssql_encoding.py --schema=dbo --table=table_name --quiet

Afterwards, the encoding is fixed, but the geometry is all
NULL-values. I use SQL Manager from Microsoft to monitor the table
while doing the read/write.

It took me a bit of time isolating the problem to my script.

It seems that handling the geometry changed from 1.10 to 1.11? Should
I do some 'transaction-stuff' instead of JUST doing the
layer.SetFeature(feature)?

- Niels


2014-05-15 13:39 GMT+02:00 Even Rouault <even.rouault at mines-paris.org>:
> Niels,
>
> you could use ogr2ogr and ogrinfo to check where the issue appears in your
> processing.
>
> Even
>
>> Hello all
>>
>> I have been running a python script daily, which takes a table from a
>> MSSQL database, identifies which fields are strings, and does some
>> character set fixing (utf8 to latin1)
>>
>> The trouble is, that after an upgrade to GDAL/OGR 1.11, the table ends
>> up with an empty geometry column. When I try to run through the script
>> in the python terminal, a call to 'feature.GetGeomFieldCount()'
>> returns 0
>>
>> And this is before doing something to the feature. It is my guess that
>> the feature doesn't get the geometry, and when I write it (using
>> layer.SetFeature(feature)), It empties the column.
>>
>> Am I doing something wrong? The entire script is here:
>> http://osgeo.codepad.org/Yn5xAdE6 (mostly, comments are in Danish,
>> sorry about that)
>>
>> Other ways of succesfully importing utf8 sources (gml) in to a
>> MSSQL-database (latin1) is also greatly appreciated, although I would
>> still like to be able to do string manipulation in the database :)
>>
>> Regards,
>> Niels
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>


More information about the gdal-dev mailing list