Closed ferily7 closed 3 years ago
CSV is supported through OGR_VRT, do you have a sample code snippet on how you are using this in code?
Yes, my code looks like this:
let ogr = await ogr2ogr(path)
.format('PostgreSQL')
.destination(databaseHost)
.options(['-nlt', 'PROMOTE_TO_MULTI', '-nln', 'schema.tableName, '-a_srs', 'EPSG:4326', '-oo', 'X_POSSIBLE_NAMES="' + long + '"', '-oo', 'Y_POSSIBLE_NAMES="' + lat + '"', '-overwrite',]).promise();
where path
is the path to the CSV file and databaseHost
is my database credentials
specifying a destination can sometimes cause issues but, out of curiosity, does this work:
let ogr = await ogr2ogr(fs.createReadStream(path), 'csv')
.format('PostgreSQL')
.destination(databaseHost)
.options(['-nlt', 'PROMOTE_TO_MULTI', '-nln', 'schema.tableName, '-a_srs', 'EPSG:4326', '-oo', 'X_POSSIBLE_NAMES="' + long + '"', '-oo', 'Y_POSSIBLE_NAMES="' + lat + '"', '-overwrite',]).promise();
Hmmm still didn't work for me.. I still get the same error about the drivers
So @wavded I tried a different file and it seems like the module is successful but it didn't send over the data correctly to my destination... When I look at the table in my postgres, it's empty. Is there something wrong with csv and the destination?
Gosh, I don't have a great way to test this as I don't have a Postgres environment readily available. Usually I try to mimic the command using the ogr2ogr command line tool itself to see. I don't see anything API wise that is amiss with what you've shared.
It seems to run the ogr2ogr command successfully but it isn’t writing the data in the csv correctly..
The name of the table in my postgres is correct, but when I try to view all the data for that table, all I see is a ogc_fid
column with nothing in it
I also noticed that the same file writes to my postgres locally but when I try to do it on my lambda function, it doesn't work properly. The data isn't in the table
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
I'm trying to send a csv file over to my postgres but I noticed that I get the following error:
Is there no support for csv files?