Whatever it's doing internally, adding -nln ca_pp makes it work. On Mar 13, 2014, at 1:50 AM, Eli Adam wrote:
> not too sure here are some long shot guesses. > > > On Wed, Mar 12, 2014 at 1:41 PM, William Kyngesburye <[email protected]> > wrote: > I can't get a direct CSV to CSV conversion to work. Taking one of the NGA > geoname country files, I created a csvt for field types and a vrt to assign > the SRS. This: > > ogr2ogr -select "ufi,uni,cc1,adm1,dsg,full_name_ro" \ > -where "fc = 'P' and (nt = 'N' or nt = 'D' or nt = 'P')" \ > -f "CSV" -lco "GEOMETRY=AS_XY" -lco "SEPARATOR=TAB" -lco "CREATE_CSVT=YES" \ > ca_pp.csv ca.vrt > > tells me that "Layer ca already exists". But that's the input layer/source! > > > If you ogrinfo ca.vrt there is probably a layer "ca"? I think that ogr2ogr > internally uses a vrt, perhaps that is causing trouble (making a "ca" layer > in ca_pp.csv and running into conflict before then). > > It will convert to shapefile: > > ogr2ogr -select "ufi,uni,cc1,adm1,dsg,full_name_ro" \ > -where "fc = 'P' and (nt = 'N' or nt = 'D' or nt = 'P')" \ > ca_pp ca.vrt > > -> ca_pp/ca.shp > > So this did create a "ca" output layer. > > You can probably rewrite your -select statement to a -sql "SELECT blah FROM > ca WHERE blah2" statement, perhaps that would work better. You can also do > casting like, -sql "SELECT blah, CAST (blah3 AS character(20)) FROM ca WHERE > blah2 = 'something'" You probably already know about the OGR SQL page, > http://www.gdal.org/ogr/ogr_sql.html which I need to reference whenever I do > casting in OGR SQL dialect. > > Best Regards, Eli > > > But I can't convert that to CSV, I get the same error "Layer ca already > exists". > > Converting to postgis, then extracting to CSV works (same select, where and > lco options). > > ----- > William Kyngesburye <kyngchaos*at*kyngchaos*dot*com> > http://www.kyngchaos.com/ > > "I ache, therefore I am. Or in my case - I am, therefore I ache." > > - Marvin > > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev > ----- William Kyngesburye <kyngchaos*at*kyngchaos*dot*com> http://www.kyngchaos.com/ Theory of the Universe There is a theory which states that if ever anyone discovers exactly what the universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarrely inexplicable. There is another theory which states that this has already happened. -Hitchhiker's Guide to the Galaxy 2nd season intro _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
