Skip to content

Instantly share code, notes, and snippets.

View brightrain's full-sized avatar

David Puckett brightrain

View GitHub Profile
@brightrain
brightrain / dp-extents.geojson
Created August 24, 2021 18:34
all the wayout places
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brightrain
brightrain / esri-leaflet-identify-example.js
Created February 2, 2017 18:31
The function that is called on map click in the epa cwns map app
// this function is called on map click event
showEntities: function(latLng) {
try {
cwns.map.removeLayer(cwns.current.selectedGeoJson);
cwns.current.countyGroupLayer.clearLayers();
cwns.current.congDistGroupLayer.clearLayers();
cwns.current.stateGroupLayer.clearLayers();
cwns.mapMarker.setLatLng(latLng);
cwns.map.addLayer(cwns.mapMarker);
cwns.cwnsDynamicLayer.identify()
<!DOCTYPE html>
<html lang="en">
<head>
<title>One Minute Map</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://mapzen.com/js/mapzen.css">
<script src="https://mapzen.com/js/mapzen.min.js"></script>
<style>
#map {
height: 100%;
@brightrain
brightrain / population-io-country-translator.json
Created April 22, 2016 00:03
Translator between population.io countries and the standard iso 2 character country code
[{"Country":"Falkland Islands","populationIoName":"NotFound","iso2Code":"FK"},{"Country":"French Guiana","populationIoName":"French Guiana","iso2Code":"GF"},{"Country":"Guyana","populationIoName":"Guyana","iso2Code":"GY"},{"Country":"Cyprus","populationIoName":"Cyprus","iso2Code":"CY"},{"Country":"Pitcairn","populationIoName":"NotFound","iso2Code":"PN"},{"Country":"South Georgia","populationIoName":"NotFound","iso2Code":"GS"},{"Country":"Saint Helena","populationIoName":"NotFound","iso2Code":"SH"},{"Country":"Egypt","populationIoName":"Arab Rep of Egypt","iso2Code":"EG"},{"Country":"Suriname","populationIoName":"Suriname","iso2Code":"SR"},{"Country":"Georgia","populationIoName":"Georgia","iso2Code":"GE"},{"Country":"Greece","populationIoName":"Greece","iso2Code":"GR"},{"Country":"Trinidad and Tobago","populationIoName":"Trinidad and Tobago","iso2Code":"TT"},{"Country":"Lebanon","populationIoName":"Lebanon","iso2Code":"LB"},{"Country":"Syria","populationIoName":"Syrian Arab Rep","iso2Code":"SY"},{"Country":"Ve
@brightrain
brightrain / typeahead-stype.css
Created February 11, 2015 01:25
typeahead style
.typeahead {
background-color: #FFFFFF;
}
.tt-dropdown-menu {
background-color: #FFFFFF;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 4px 4px 4px 4px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
margin-top: 4px;
padding: 4px 0;
@brightrain
brightrain / typeahead-event.js
Created February 11, 2015 01:24
typeahead event
.on("typeahead:selected", function (obj, datum) {
// what happens when a user selects\clicks a suggestion
// we get the datum that contains the properties we defined when we setup the engine via the filter function
map.graphics.clear();
switch(datum.source) {
case "esri-geocoder":
var url = config.arcgisGeocodingBaseUrl + "find?" +
"magicKey=" + datum.magicKey + "&text=" + datum.name +
"&outFields=Addr_type&f=json";
// https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find.htm
@brightrain
brightrain / typeahead-all.js
Created February 11, 2015 01:03
typeahead setup all
$("#searchInput").typeahead({
// how many characters does the user type before suggestions start firing
minLength: 3,
highlight: true,
hint: false
}, {
name: "camp",
displayKey: "name",
source: campBH.ttAdapter(),
// what the header looks like for this source in the suggestions drop down
@brightrain
brightrain / camp-ahead-setup.js
Last active August 29, 2015 14:15
camp ahead setup
...
, {
name: "camp",
displayKey: "name",
source: campBH.ttAdapter(),
// what the header looks like for this source in the suggestions drop down
templates: {
header: "<h1 class='typeahead-header'><span class='icon icon-camp'></span>&nbsp;Campgrounds</h1>"
}
},
@brightrain
brightrain / setup-typeahead.js
Created February 11, 2015 00:55
setup typeahead
$("#searchInput").typeahead({
minLength: 3,
highlight: true,
hint: false
},
@brightrain
brightrain / geocode-ahead.js
Created February 11, 2015 00:50
esri-geocoder engine
// build the esri geocoder bloodhound engine
var esriBH = new Bloodhound({
name: "esri-geocoder",
datumTokenizer: function (d) {
return Bloodhound.tokenizers.whitespace(d.name);
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
//https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm
// use the searchExtent parameter to limit the results to roughly washington state