Giter Club home page Giter Club logo

Comments (4)

wavded avatar wavded commented on May 27, 2024

I think its the GDAL version you have installed on Linux. SHZ support is a newer file type that GDAL added support for. Are you able to get a 3.x version of GDAL installed on Linux?

from ogr2ogr.

marknutrien avatar marknutrien commented on May 27, 2024

Yeah, that's kinda what I was afraid of. After spending the better part of the day trying to figure out how to get the 3.x version working, it seems that support for GDAL 3.x on Debian is not supported except for in their "unstable" Debian packages (see https://gdal.org/download.html#binaries) which would never fly at my client. They use the nodeJS Debian docker images as its build source so that isn't negotiable. I did try to see if I could use Anaconda or other ways to get GDAL injected into the docker image but it was getting pretty messy. I ultimately hacked around it by modifying the convertGeoJsonToShapeFile with:

async convertGeoJsonToShapeFile({ geometry }) {
    const ogr2ogr = Ogr2ogr.default;
    const { stream } = await ogr2ogr(geometry, {
      format: 'ESRI Shapefile'
    });

    let buffer;
    try {
      // the normal way to process on a dev machine
      buffer = await this.stream2Buffer(stream);
    } catch (e) {
      // docker ogr2ogr which is v2.1 doesn't save it as a file
      // but rather  as a directory, so zip the directory
      const archive = archiver('zip');
      archive.directory(stream.path, false);
      archive.finalize();
      buffer = await this.stream2Buffer(archive);
    }

    return buffer;
  }

Perhaps this repo could support the 2.x output by evaluating the resulting stream fromres.stream = createReadStream(this.outputPath) and if the length of the stream was zero, send it through the createZipStream() function instead?

from ogr2ogr.

wavded avatar wavded commented on May 27, 2024

This current version 3.x really is designed around GDAL 3 support in this case. I intentionally made the API as close to the ogr2ogr tool as possible in 3.x to avoid various issues we had in the past (so this lib's support is tied to ogr2ogr's support rather than trying to make special cases). The 2.x version should support your use case for now until you are able to upgrade.

You probably have already went through this in your mind but GDAL does have official docker containers that have the latest version and they document using the unstable repo for their release on Debian platforms. Of course you can always build from source too.

https://gdal.org/download.html

from ogr2ogr.

marknutrien avatar marknutrien commented on May 27, 2024

Yeah, no prob. that makes sense. 99.9% that their corporate security wouldn't allow the unstable docker builds and there is a lot of other intermediate build steps that are required with their CI/CD stuff. I'll keep the code I have for now - like most projects, on to the next thing. Thanks! I'll close this issue.

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.