mmomtchev / node-gdal-async

Node.js bindings for GDAL (Geospatial Data Abstraction Library) with full async support
https://mmomtchev.github.io/node-gdal-async/
Apache License 2.0
129 stars 26 forks source link

use vectorTranslateAsync with sql #101

Closed LuckDogHu closed 11 months ago

LuckDogHu commented 11 months ago
gdal.openAsync(join(public_path, 'aaa.geojson')).then((in_ds) => {
  const sql = `SELECT *,'LABEL(f:Arial,t:'||floor||')' AS OGR_STYLE FROM aaa`;
  gdal
    .vectorTranslateAsync(join(public_path, `aaa.dxf`), in_ds, [
      '-f',
      'DXF',
      '-sql',
      sql,
    ])
    .then((out2_ds) => {
      in_ds.close();
      out2_ds.close();
    });
});

Error: SQL Expression Parsing Error: syntax error, unexpected $undefined, expecting FROM. Occurred around : SELECT *,'LABEL(f:Arial,t:'||floor||')' AS OGR_STYLE FROM aaa

so how can i get in_ds tabel_name for exec this sql can give me any help thank you

mmomtchev commented 11 months ago

I do not think your problem is related to gdal-async:

$ ogr2ogr -sql "SELECT *,'LABEL(f:Arial,t:'||floor||')' AS OGR_STYLE FROM aaa" out.json test/data/park.geo.json
ERROR 1: SQL Expression Parsing Error: syntax error, unexpected $undefined, expecting FROM. Occurred around :
SELECT *,'LABEL(f:Arial,t:'||floor||')' AS OGR_STYLE FROM aaa
                           ^

Check the validity of your SQL statement.