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
def publish(context, data_dict): | |
# Gather inputs | |
resource_id = data_dict.get("resource_id", None) | |
layer_name = data_dict.get("layer_name", resource_id) | |
username = context.get("user", None) | |
package_id = data_dict.get("package_id", None) | |
lat_field = data_dict.get("col_latitude", None) | |
lng_field = data_dict.get("col_longitude", None) | |
# Check that you have everything you need |
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
from ckanext.ngds.tests.ngds_test_case import NgdsTestCase | |
class MyActionTestCase(NgdsTestCase): | |
def test_gobbledee_action(self): | |
# Generate your POST body | |
post_body = { | |
"turkeys": 12, | |
"gobbles": ["gobble", "gobble"] | |
} |
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 jsts = require("jsts"), | |
spaghetti = [ | |
"LINESTRING(-108.6328125 32.54681317351517,-117.7734375 44.33956524809713,-91.0546875 50.51342652633956,-92.46093749999999 30.751277776257812)", | |
"LINESTRING(-120.58593749999999 25.48295117535531,-106.5234375 42.032974332441405,-78.046875 40.713955826286046)" | |
], | |
reader = new jsts.io.WKTReader(), | |
polygonizer = new jsts.operation.polygonize.Polygonizer(), | |
polygons, dangles, cutEdges, invalidRingLines; | |
spaghetti.forEach(function (line) { |
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 jsts = require("jsts"), | |
_ = require("underscore"), | |
fs = require("fs"); | |
fs.readFile("/Users/ryan/Desktop/hv-lines.geojson", function (err, data) { | |
var geojson = JSON.parse(data), | |
reader = new jsts.io.GeoJSONReader(), | |
writer = new jsts.io.GeoJSONWriter(), | |
polygonizer = new jsts.operation.polygonize.Polygonizer(), |
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
WeeSofty:tm2 ryan$ brew upgrade mapnik | |
Error: mapnik-2.2.0 already installed | |
WeeSofty:tm2 ryan$ brew upgrade protobuf | |
Error: protobuf-2.5.0 already installed | |
WeeSofty:tm2 ryan$ brew upgrade node | |
Error: node-0.10.15 already installed | |
WeeSofty:tm2 ryan$ node index.js | |
module.js:356 | |
Module._extensions[extension](this, filename); |
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"), | |
_ = require("underscore"), | |
request = require("request"), | |
baseUrl = "https://hazards.fema.gov/gis/nfhl/rest/services/public/NFHL/MapServer/28", | |
outEsri = JSON.stringify({"displayFieldName":"DFIRM_ID","fieldAliases":{"FLD_ZONE":"FLD_ZONE","ZONE_SUBTY":"ZONE_SUBTY"},"fields":[{"name":"FLD_ZONE","type":"esriFieldTypeString","alias":"FLD_ZONE","length":17},{"name":"ZONE_SUBTY","type":"esriFieldTypeString","alias":"ZONE_SUBTY","length":57}]}), | |
outFile = fs.createWriteStream("fema-get-all-esri.json"); | |
outFile.write(outEsri + ",features:["); | |
request(baseUrl + "?f=json", function (err, response, information) { |
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 jsts = require("jsts"), | |
u = require("underscore"), | |
fs = require("fs"); | |
fs.readFile("/Users/ryan/Desktop/hv-lines.geojson", function (err, data) { | |
var geojson = JSON.parse(data), | |
writer = new jsts.io.GeoJSONWriter(), | |
polygonizer = new jsts.operation.polygonize.Polygonizer(), | |
noder = new jsts.noding.MCIndexNoder(), | |
intersector = new jsts.algorithm.RobustLineIntersector(), |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
.marker-properties { | |
border-collapse:collapse; |
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 jsts = require("jsts"), | |
fs = require("fs"), | |
javascript = require("javascript.util"), | |
assert = require("assert"), | |
lines = [ | |
"LINESTRING(-110.5 32.1,-110.45 32.2,-110.4 32.1)", | |
"LINESTRING(-110.5 32.25,-110.45 32.2,-110.45 32.15,-110.4 32.25)" | |
], | |
expected = [ | |
"LINESTRING(-110.5 32.1,-110.45 32.2)", |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.