Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions scripts/BufferPoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var GEOM = require("../lib/geoscript/geom");

print("Point - X: 0, Y: 0"); //http://geoscript.org/js/api/geom/point.html
var Point = new GEOM.Point([0, 0]); //Create a new point at the coordinates [X, Y].

print("==========================");
print(" - [Number] Point.x: " + Point.x); //The first coordinate value.
print(" - [Number] Point.y: " + Point.y); //The second coordinate value.
print(" - [geom.bounds] Point.bounds: " + Point.bounds); //The bounds defined by minimum and maximum x and y values in this geometry.

print("PointBuffer - bufferDistance: 10");
//Point.buffer(dist,options)
// - dist: Width of buffer. May be positive, negative, or zero.
// - options: Options for the buffer operation.
// - geom.BUFFER_CAP_BUTT: Used to calculate butt caps for buffer operations.
// - geom.BUFFER_CAP_ROUND: Used to calculate round caps for buffer operations.
// - geom.BUFFER_CAP_SQUARE: Used to calculate square caps for buffer operations.
var bufferDistance = 10;
var bufferOptions = {segs: 8, caps: GEOM.BUFFER_CAP_ROUND, single: false };
var PointBuffer = Point.buffer(bufferDistance, bufferOptions);

print("==========================");
print(" - [Number] PointBuffer.x: " + PointBuffer.x); //The first coordinate value.
print(" - [Number] PointBuffer.y: " + PointBuffer.y); //The second coordinate value.
print(" - [geom.bounds] PointBuffer.bounds: " + PointBuffer.bounds); //The bounds defined by minimum and maximum x and y values in this geometry.

print("PointBuffer - bufferDistance: 5");
bufferDistance = 5;
PointBuffer = Point.buffer(bufferDistance, bufferOptions);

print("==========================");
print(" - [Number] PointBuffer.x: " + PointBuffer.x); //The first coordinate value.
print(" - [Number] PointBuffer.y: " + PointBuffer.y); //The second coordinate value.
print(" - [geom.bounds] PointBuffer.bounds: " + PointBuffer.bounds); //The bounds defined by minimum and maximum x and y values in this geometry.
85 changes: 85 additions & 0 deletions scripts/Impassable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
var GEOM = require("../lib/geoscript/geom");
var FEATURE = require("../lib/geoscript/feature");
var FILTER = require("../lib/geoscript/filter");
var PROJ = require("../lib/geoscript/proj");
var LAYER = require("../lib/geoscript/layer");
var WORKSPACE = require("../lib/geoscript/workspace");
var VIEWER = require("../lib/geoscript/viewer");
var STYLE = require("../lib/geoscript/style");
var MAP = require("../lib/geoscript/map");

print("Opening PostGIS Workspace..."); //http://geoscript.org/js/api/workspace.html

var PostGIS_Database= new WORKSPACE.PostGIS({database: "GeoScript_Test", host: "192.168.10.140", password: "p0stGISAdm!n", port: "5432", schema: "public", user: "postgres"});
print(PostGIS_Database);

var TableDemElevation = PostGIS_Database.get("demelevation");
//print(Elevation.bounds);
//print(Elevation.count);

//var Map = new MAP.Map();
//Map.add(Raster);
//Map.render();

//VIEWER.draw(TestLayer);

TableDemElevation.features.forEach(function(feature) {
print(feature.toString());
VIEWER.draw(feature);
});

//var rect = new FEATURE.Feature({
// values: {
// geom: new GEOM.Polygon([
// [ [-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45] ]
// ]),
// name: "Rectangle"
// }
//});
//VIEWER.draw(rect);
//var RectLayer = PostGIS_Database.get("Rectangle");
//RectLayer.add(rect);

//print("Rect.bounds: " + rect.bounds);

//var Point = new GEOM.Point([0, 0]); //Create a new point at the coordinates [X, Y].
//var bufferDistance = 3;
//var bufferOptions = {segs: 8, caps: GEOM.BUFFER_CAP_ROUND, single: false };
//var PointBuffer = Point.buffer(bufferDistance, bufferOptions);
//VIEWER.draw(PointBuffer);

//var point = new FEATURE.Feature({
// values: {
// geom: new GEOM.Point([-3, -3]).buffer(bufferDistance, bufferOptions),
// name: "Point"
// }
//});
//var PointLayer = PostGIS_Database.get("Circle");
//PointLayer.add(point);

//TestLayer.query("INTERSECTS(geom, POINT(0 0))").forEach(function(feature) {
// print(feature.toString());
//});

//TestLayer.query("SELECT *").forEach(function(feature) {
// print(feature.toString());
//});

//TestLayer.update();

//TestLayer.query("name = 'Metropolis'").forEach(function(feature) {
// print(feature.toString());
//});

//var layer = new LAYER.Layer({name: "Rectangle"});
//print("layer.name: " + layer.name);
//PostGIS_Database.add(layer);

//VIEWER.draw(PointLayer);

PostGIS_Database.close(); //close the connection when we are done.
print("PostGIS Workspace Closed.");

//var Map = new MAP.Map();
//Map.add(Elevation);
//Map.render();
Binary file added scripts/Raster/medford_dem.tif
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/TestConnecion.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var meta = {
connection: null,
driver: new Packages.org.postgresql.Driver,
setUp: function() {
var uri = "jdbc:postgresql://localhost:5432/postgres";
var uri = "jdbc:postgresql://localhost:54321/postgres";
var params = new java.util.Properties();
params.setProperty("user", "postgres");
params.setProperty("password", "postgres");
Expand Down
Binary file modified target/jars/postgresql-8.4-701.jdbc3.jar
Binary file not shown.
Binary file added target/jars/postgresql-8.4-701.jdbc3.jar.BAK
Binary file not shown.