2

I have a KML file called tracts.kml and a CSV called B01001A_007E_tract.csv in one directory.

I opened a command line in the folder and ran this:

ogr2ogr -sql "select tracts.*, B01001A_007E_tract.* from tracts left join 'B01001A_007E_tract.csv'.B01001A_007E_tract on tracts.Id2 = B01001A_007E_tract.StateCountyTractID" dst_tracts.kml tracts.kml

I got this message and error:

Warning: The target file has a 'kml' extension, which is normally used by the LIBKML, KML drivers,but the requested output driver is ESRI Shapefile. Is it really what you want ?

ERROR 1: SELECT from table tracts failed, no such table/featureclass.

What am I doing wrong?

  • 1
    The warning part is simple to fix, just define the outputformat with -f KML or -f LIBKML. – user30184 Dec 13 '17 at 11:31
3

First, execute ogrinfo tracts.kml in order to keep note of the layer name, e.g. tracts (it could be different from the file name). Then append -f KML (because your output is a KML file) to the ogr2ogr command line and eventually replace tracts with the output of ogrinfo in the sql query.

  • In my case, I appended -f LIBKML – Username Dec 14 '17 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.