Skip to content

Instantly share code, notes, and snippets.

View rgwozdz's full-sized avatar

Rich Gwozdz rgwozdz

  • Esri
  • Bellingham, WA
View GitHub Profile
/*
Example request: http://koop.com/craigslist/washingtondc/apartments/FeatureServer/0/query?where=price>20&f=geojson
Req is the express request object: https://expressjs.com/en/4x/api.html#req
req.params = {
host: 'washingtondc',
id: 'apartments'
}
req.query = {
where: 'price > 20',
f: geojson
@rgwozdz
rgwozdz / geojson-sample.geojson
Last active May 14, 2018 13:22
GeoJSON sample
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rgwozdz
rgwozdz / census-koopinfo.json
Created April 30, 2018 20:18
census-koopinfo
{
"info": {
"_indexFields": false,
"_indexGeometry": false,
"url": "https:\/\/tigerweb.geo.census.gov\/arcgis\/rest\/services\/Census2010\/Tracts_Blocks\/MapServer",
"_indexGeohash": false,
"itemModified": 1500480948000,
"version": 3,
"itemTitle": "2010 Census Population & Housing Unit Counts",
"type": "Feature Service"
@rgwozdz
rgwozdz / trees-koopinfo.json
Last active April 30, 2018 20:19
trees-koopinfo
{
"_indexFields": false,
"retrieved_at": 1524775095476,
"failedLastImport": false,
"lastImportCompleted": 1524775109941,
"version": 3,
"fullFile": "files\/593b88391b614123890f54a1db8fbf55_0\/full\/593b88391b614123890f54a1db8fbf55_0.txt",
"type": "Feature Service",
"status": "Cached",
"generating": {
@rgwozdz
rgwozdz / AGOL-secured-service.md
Last active April 24, 2018 14:54
Network details for AGOL secured service authentication and authorization

Network details during a AGOL session for adding a "secured item" to Content

1. ArcGIS checks resource server URL to see if its secure

Request GET https://www.arcgis.com/sharing/rest/portals/checkurl

GET params:

{ 
 url: https:///rest/services/Hosted/cb_2017_us_state_500k/FeatureServer?f=json
@rgwozdz
rgwozdz / provider-metadata.js
Last active May 30, 2018 17:41
Koop Provider metadata
metadata: {
name: String, // The name of the layer
description: String, // The description of the layer
extent: Array, // valid extent array e.g. [[180,90],[-180,-90]]
displayField: String, // The display field to be used by a client
geometryType: String // REQUIRED if no features are returned with this object Point || MultiPoint || LineString || MultiLineString || Polygon || MultiPolygon
idField: Integer || String, // unique identifier field,
maxRecordCount: Number, // the maximum number of features a provider can return at once
limitExceeded: Boolean, // whether or not the server has limited the features returned
timeInfo: Object // describes the time extent and capabilities of the layer,
@rgwozdz
rgwozdz / parse-string-array.js
Created April 11, 2018 12:47
Parse a comma delimited list of arrays to an enclosing array
let geom = {"Polygon_Geometry": ["[-117.10, 34.20],[-117.19, 34.05],[-118.19, 34.20],[-117.10, 34.20]"]}
let json = `[${geom.Polygon_Geometry[0]}]`;
console.log(JSON.parse(json))
@rgwozdz
rgwozdz / bubble-sort.js
Created December 20, 2017 16:28
bubble-sort with notes
function bubbleSort(arr){
// Get Array length
var len = arr.length;
// Create and outer-loop with a decrementing index i
for (var i = len-1; i>=0; i--){
// Create and inner-loop with incrementing index j that has a max index i
// So, the first time the innerloop cycles, it will loop a number of times equal to the array length.
// The next cycle it will be one less, and so forth
@rgwozdz
rgwozdz / binary-search.js
Last active December 20, 2017 16:37
binary-search
/**
* Performs a binary search on the provided *sorted* list and returns the index of the item if found. If it can't be found it'll return -1.
*
* @param {*[]} sorted (ascending) list Items to search through.
* @param {*} item The item-value to look for.
* @return {Number} The index of the item if found, -1 if not.
*/
function binarySearch(list, searchValue) {
var minIndex = 0;
var maxIndex = list.length - 1;