modify google maps engine tables from node
Wrapper for doing crud operations on Google Maps Engine tables.
No affiliations with Google blah blah etc.
All methods return promises.
var GME = ;GME;var table = key email tableID primaryKey;table; //-> info about the tabletable; //-> all the featurestable; // -> same but read streamtable; //-> filtered listtable; // -> again same but with a read streamtable; //-> one featuretable; //-> success/failuretable; //-> success/failuretable; //-> success/failure// Using bulk operationsvar bulk = table;bulkcreate|update|remove; //-> ready for more/failurebulk; //-> success/failure// Using streams to write multiple rowsvar stream = table;stream;stream;stream;
key and the
Once you obtain the private key, you must convert it to a pem file, with something like
openssl pkcs12 -in key.p12 -out key.pem -nodes, where
key.p12 is the downloaded file from the Service Account and
key.pem is the file you pass as the
key argument. The key parameter may either be the buffer contents of the key file or the string path to the keyfile.
tableID arguments must be strings,
primaryKey is optional and defaults to
For remove an array of ids to delete is required.
bulk doesn't return a promise, but instead it returns a bulk object, which has the same create update and remove methods that work the same way, the only difference is that they wait util they have the maximum number of features or verticies and then does the upload in a batch.
bulk.create(feature); the first 49 times will return a promise that resolves to
true but the 50th time it is a promise for the bulk upload of all 50 features.
bulk.flush forces an upload of all items in the current queue and cleans them out, flush doesn't close the object or anything so you can continue to use it.
writeStream method returns a writable stream, write objects with a
type property with 'create', 'update', or 'remove' value and then a 'data' property with the object or string to put to the method (this can also be named 'key' if you want).
Similar to the table constructor but instead of a table ID takes a table creation object.
Either returns all the rows or a filtered set based on a query, the only difference is that features returns a promise while readStream returns a stream., see this page for query options. Note that table.features does the pagination for you, you don't need to worry about it.