I am trying to check whether two geographic objects intersect and remove the overlapping parts (not doing this part in the code segment below). Please find the code below. It gives me error
Cannot call methods on bit.
I am using mssql library and using node 10. I cannot find anything regarding this error. I want to know if this is a code error or some issue with mssql library. If it is then how can I solve this issue?
*****UPDATE****** It only gives this error for STIntersects(), works fine for STIntersection() and STDifference.
const sql = require('mssql');
let path1 = `geography::STGeomFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326).MakeValid()`;
let path2 = `geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326).MakeValid()`;
let query = `SELECT ${path1}.STIntersects(${path2}).ToString();
SELECT ${path1}.STIntersection(${path2}).ToString();`;
let dbConfig = {
user: 'username',
password: 'password',
server: 'localhost',
database: 'db_name',
port: port,
connectionTimeout: 30000,
requestTimeout: 180000,
max: 15,
min: 3,
idleTimeoutMillis: 30000
};
sql.connect(dbConfig, err => {
if (err)
throw err;
console.log('Success');
queryExecuter();
});
let queryExecuter = async () => {
try {
let request = new sql.Request();
let result1 = await request.query(query)
console.log(result1)
} catch (err) {
console.log(err)
// ... error checks
}
}
sql.on('error', err => {
console.log(err)
// ... error handler
})