Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ogr2ogr -f PostgreSQL PG:"host=server_ip user=username dbname=dbname password=password" yourshapefile.shp;
- $username = 'your_username';
- $password = 'your_password';
- $dbname = 'target_databasename';
- $tbname = 'target_tablename';
- $srsname = 'reference_system';
- $fileName = 'shapefile_name';
- $directory = '\directory\' .$fileName. '.shp';
- $shellCommand = "shp2pgsql -I -s " .$srsname. " " .$directory. " public." .$tbname. " | psql -U " .$username. " -d " .$dbname."";
- $shapfileLoader = exec($shellCommand,$stdOut,$stdErr);
- if (!$stdErr) {
- echo $stdOut;
- } else {
- echo $stdErr;
- }
- var express = require('express');
- var router = express.Router();
- var { exec } = require('child_process');
- router.post("/", function (_req, _res, _next) {
- const postGISdb = 'db_name';
- const user = 'your_username';
- exec(`psql -U ${user} -d ${postGISdb}`, (err, stdOut, stdErr) => {
- console.log(stdOut)
- })
- });
- module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement