Skip to content
This repository has been archived by the owner on Nov 13, 2019. It is now read-only.

Commit

Permalink
Declare TID as FID in VRT
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed May 17, 2017
1 parent 37c9860 commit 3acb83f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ogrtools/pyogr/singlegeomvrt.py
Expand Up @@ -80,6 +80,10 @@ def vrt_layer(layer,
vrt += ' <GeometryType>%s</GeometryType>\n' % gFldType
# Add FeatureCount for QGIS layer selection
vrt += ' <FeatureCount>%d</FeatureCount>\n' % layer.GetFeatureCount()
# OGR sometimes doesn't detect FID of source (Ili2 only?).
# Workaround: We explicitly add TID as FID, when available
if layer.GetFIDColumn() == '' and layerdef.GetFieldIndex("TID") != -1:
vrt += ' <FID>TID</FID>\n'
if poGFldDefn is not None:
vrt += ' <GeometryField name="%s"/>\n' % gFldName
if poGFldDefn.GetSpatialRef() is not None:
Expand Down

0 comments on commit 3acb83f

Please sign in to comment.