Re: [gdal-dev] Inquire mapped column names for conversion to shapefile

2024-04-29 Thread Jan Heckman via gdal-dev
That's pretty cool, you just saved me an awful lot of time! Thanks, Jan On Mon, Apr 29, 2024 at 4:31 PM Even Rouault wrote: > Hi, > > Something like: > > > from osgeo import ogr > original_field_names = [ "toolongforshapefile1", "toolongforshapefile2"] > map_to_shp = {} > tmpfilename = "/vsimem/

Re: [gdal-dev] Inquire mapped column names for conversion to shapefile

2024-04-29 Thread Even Rouault via gdal-dev
Hi, Something like: from osgeo import ogr original_field_names = [ "toolongforshapefile1", "toolongforshapefile2"] map_to_shp = {} tmpfilename = "/vsimem/temp.shp" ds = ogr.GetDriverByName("ESRI Shapefile").CreateDataSource(tmpfilename) lyr = ds.CreateLayer("temp") lyr_defn = lyr.GetLayerDefn()

[gdal-dev] Inquire mapped column names for conversion to shapefile

2024-04-29 Thread Jan Heckman via gdal-dev
Hi everyone, I want to make a map of original (let's say postgresql/postgis) column names to those used in a shapefile after conversion; assuming that at least some column names in postgis will be over 10 characters in length, and shortening may produce conflicts. Basically I know how this is done,