Comments (11)
CSV is supported through OGR_VRT, do you have a sample code snippet on how you are using this in code?
from ogr2ogr.
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
from ogr2ogr.
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();
from ogr2ogr.
Hmmm still didn't work for me.. I still get the same error about the drivers
from ogr2ogr.
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?
from ogr2ogr.
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.
from ogr2ogr.
It seems to run the ogr2ogr command successfully but it isn’t writing the data in the csv correctly..
from ogr2ogr.
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
from ogr2ogr.
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
from ogr2ogr.
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.
from ogr2ogr.
This issue was closed because it has been stalled for 5 days with no activity.
from ogr2ogr.
Related Issues (20)
- stream() from geojson HOT 7
- shz file saved as a directory on linux, breaking stream processing HOT 4
- converting
- converting to geopakacge not working propaly HOT 1
- . HOT 2
- Currently can't provide custom args when specifying a custom command HOT 6
- How to write -update statement ? HOT 2
- how to use on angular project? HOT 2
- OGR_XLSX_HEADERS HOT 1
- precision? HOT 5
- geoJSON features order HOT 2
- Uncaught errors when opening a bad CSV file HOT 4
- Load CSV to Postgres very slow HOT 5
- change http method HOT 3
- ogr2ogr is not a function HOT 1
- How to export postegresql table to .shp using org2org? HOT 3
- More examples of how to write data HOT 6
- Unexpected behavior with double quotes in PG connection string HOT 2
- Unknown option name '-spat' HOT 2
- Result.cmd is missing a space between command and args
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ogr2ogr.