Giter Club home page Giter Club logo

Comments (11)

wavded avatar wavded commented on May 28, 2024

CSV is supported through OGR_VRT, do you have a sample code snippet on how you are using this in code?

from ogr2ogr.

ferily7 avatar ferily7 commented on May 28, 2024

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.

wavded avatar wavded commented on May 28, 2024

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.

ferily7 avatar ferily7 commented on May 28, 2024

Hmmm still didn't work for me.. I still get the same error about the drivers

from ogr2ogr.

ferily7 avatar ferily7 commented on May 28, 2024

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.

wavded avatar wavded commented on May 28, 2024

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.

ferily7 avatar ferily7 commented on May 28, 2024

It seems to run the ogr2ogr command successfully but it isn’t writing the data in the csv correctly..

from ogr2ogr.

ferily7 avatar ferily7 commented on May 28, 2024

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.

ferily7 avatar ferily7 commented on May 28, 2024

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.

github-actions avatar github-actions commented on May 28, 2024

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.

github-actions avatar github-actions commented on May 28, 2024

This issue was closed because it has been stalled for 5 days with no activity.

from ogr2ogr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.