This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.sample_notify() | |
RETURNS trigger AS | |
$BODY$ | |
DECLARE | |
BEGIN | |
PERFORM pg_notify('actions', '{"type": "Feature", "geometry": ' || | |
st_asgeojson(NEW.shape) || | |
',"properties": {"message": "' || | |
'insert' || '",' || | |
'"schema": "' || TG_TABLE_SCHEMA || '",' || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE public.simple_table | |
( | |
id integer NOT NULL DEFAULT nextval('simple_table_id_seq'::regclass), | |
message text, | |
shape geometry(Point,4326), | |
CONSTRAINT pk_notify PRIMARY KEY (id) | |
) | |
WITH ( | |
OIDS=FALSE | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.geomusings.dialect; | |
//import org.hibernate.dialect.PostgreSQLDialect; | |
import org.hibernate.dialect.function.StandardSQLFunction; | |
import org.hibernate.type.CustomType; | |
import org.hibernate.type.StandardBasicTypes; | |
import org.hibernate.type.Type; | |
import org.hibernate.spatial.dialect.postgis.PostgisDialect; | |
import org.hibernate.usertype.UserType; | |
import org.hibernate.spatial.SpatialAggregate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d3.json( | |
"data/statistics.geojson", | |
function (json) { | |
//dimensions | |
var w = 980; | |
var h = 480; | |
//get the center of the data | |
var center = d3.geo.centroid(json); | |
var svg = d3.select("body").append("svg") | |
.attr("width", w) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ogr2ogr -f "GeoJSON" statistics_%2_%1.geojson PG:"host=localhost user=wombat dbname=geo2 password=sufficiently_complex_password" -sql "SELECT * FROM vw_geojson_statistics_ytd WHERE year = 2015" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
us_states_squares.shape, | |
us_states_squares.abbr, | |
us_states_squares.name, | |
vw_statistics_ytd.ytd | |
FROM | |
public.us_states_squares | |
INNER JOIN public.vw_statistics_ytd ON | |
us_states_squares.abbr = vw_statistics_ytd.state_abbr | |
WHERE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
function writeMetadata(Origin, Pubdate, Title, Abstract, Westbc, Eastbc, Northbc, Southbc, Addrtype, State){ | |
var XMLWriter = require('xml-writer'); | |
xw = new XMLWriter(true); | |
xw.startDocument(); | |
var root = xw.startElement('metadata'); | |
root.writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); | |
root.writeAttribute('xsi:noNamespaceSchemaLocation','http://www.fgdc.gov/metadata/fgdc-std-001-1998.xsd'); | |
var idinfo = root.startElement('idinfo'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//callback should be like function(err){//do stuff} | |
function registervector(datasetName, callback){ | |
//dataset name is the name of the PostGIS table | |
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; //my dev SSL is self-signed. don't do this in production. | |
var https = require('https'); //using SSL because of basic auth in this example | |
var auth = 'Basic ' + new Buffer('username' + ':' + 'p@s$w0rd').toString('base64'); //strong passwords please | |
//build the object to post | |
var post_data = {'featureType': {'name': datasetName}}; | |
//be sure to turn it into a string | |
var s = JSON.stringify(post_data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void win_Closed(object sender, EventArgs e) | |
{ | |
TextSymbolPropsWindow win = sender as TextSymbolPropsWindow; | |
if ((bool)win.DialogResult) | |
{ | |
GraphicsLayer graphicsLayer = BoundMap.Layers["AnnoLayer"] as GraphicsLayer; //the layer on which the anno will be drawn | |
string input = win.Annotation; | |
if (!String.IsNullOrEmpty(input)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void DrawCompleteHandler(object sender, DrawEventArgs args) | |
{ | |
_currentPoint = args.Geometry as MapPoint; //capture the point that where the mouse was clicked | |
TextSymbolPropsWindow win = new TextSymbolPropsWindow(); //My child window. This can be any you define. | |
win.EditMode = false; //this tells the window that this is a new annotation | |
win.Closed += new EventHandler(win_Closed); //subscribe to the window's Closed event | |
win.Show(); | |
} |