appgeo / cartodb Goto Github PK
View Code? Open in Web Editor NEWcarto sql lib for node
License: MIT License
carto sql lib for node
License: MIT License
The following code:
if (normalized.paths) {
let geojson = {
type: 'MultiLineString',
coordinates: normalized.paths
};
normalized.the_geom = db.raw(`ST_GeomFromGeoJSON('${JSON.stringify(geojson)}')`);
delete normalized.paths;
}
return db('appgeo_surveys')
.insert(normalized)
.then(() => {
return data;
});
Returns the following sql (via query.toString()
):
BEGIN;
PREPARE _2c97d7a66be43fe4 AS
insert into "appgeo_surveys" ("is_correct", "issue", "comments", "confidence", "neighborhood_id", "city_id", "user_id", "the_geom") values ($1, $2, $3, $4, $5, $6, $7, $8);
EXECUTE _2c97d7a66be43fe4(false,$cartodb$boundaries little off$cartodb$,$cartodb$ewrwer$cartodb$,$cartodb$very$cartodb$,$cartodb$prt023$cartodb$,$cartodb$portland$cartodb$,$cartodb$1$cartodb$,$cartodb${"client":{"url":"urlobfuscated","key":"keyobfuscated","isBatch":false},"sql":"ST_GeomFromGeoJSON('{\\"type\\":\\"MultiLineString\\",\\"coordinates\\":[[[-122.66329765319824,45.60052733338059],[-122.66029357910158,45.60160825936073],[-122.65771865844728,45.60220876479576],[-122.65583038330078,45.60226881498576],[-122.65437126159667,45.60190851288167],[-122.65308380126955,45.60184846230603],[-122.65222549438475,45.60190851288167],[-122.65188217163086,45.602028613840126]],[[-122.68106460571289,45.60407029079811],[-122.67926216125487,45.60389014581998],[-122.67797470092772,45.60364995161597],[-122.67788887023924,45.60340975638357],[-122.67754554748535,45.60310951089689]]]}')","_noTransaction":false}$cartodb$);;
COMMIT;
notice the escaped double-quotes in the sql's geojson string, not sure if this is an issue
the error is
Error: {"error":["parse error - invalid geometry"],"hint":"\"{\"\" <-- parse error at position 2 within geometry"}
I've tried a variety of ways to represent the value, like db.raw('?', [...])
and db.raw(`ST_GeomFromGeoJSON('?')`, [..])
, etc..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.