Skip to content

Instantly share code, notes, and snippets.

@asizer
asizer / index.html
Last active August 26, 2015 20:59
Search widget events and country-limiting
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Basic Search Widget</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.14/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">
<style>
@asizer
asizer / README.md
Last active August 29, 2015 14:00
Map with header/footer

This example gets around the map's need for a height when you don't know the height of the map, but you do know the height of the header and footer. Set the map container's position: absolute and the top and bottom properties to account for the header and footer heights.

Firefox seems to treat box-sizing differently, so add 4 px to the map's top/bottom to account for the header/footer borders

@asizer
asizer / LayerSearch.css
Last active August 29, 2015 14:00
Layer Search
.esriLayerSearcher .esriLayerSearcherClearFloat {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
.simpleLayerSearcher .esriLayerSearcherContainer *,
@asizer
asizer / README.md
Last active August 29, 2015 14:03
Map horizontal repeat

Demonstrates the ability to repeat a map horizontally.

The map's container's container gets a clip dynamically added to it such that repeated tiles are not shown. To get rid of the clip, we just need:

.map .container .container {
  clip: inherit !important;
}

Note: Only the basemap layers will be repeated. The data layers will appear once.

@asizer
asizer / Widget.js
Created July 11, 2014 22:25
Make dojo xhrRequest work with secured service
/* all this is around line 334 of SQLQuery/Widget.js */
// option 1 is to query the rest endpoint for unique values.
// option 2 is to store featureSet clientside (1000 limit)
var tokenRequest = esri.id.findCredential(this.activeInfo.fLayerUrl); // THIS IS NEW!
if (!this.activeInfo.featureSet) {
dojoXhr(this.activeInfo.fLayerUrl + '/query', {
query: {
where: '1=1',
outFields: fieldInfo.name,
@asizer
asizer / README.md
Last active August 29, 2015 14:04 — forked from mbostock/.block
@asizer
asizer / index.html
Created September 11, 2014 03:13
LabelClass on DynamicLayer
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<link rel="stylesheet" href="//js.arcgis.com/3.10/js/esri/css/esri.css">
<style>
html, body, #map {
height: 100%; width: 100%; margin: 0; padding: 0;
@asizer
asizer / README.md
Created October 28, 2014 15:46
Feature Layer with Multi-Line Labels

Multi-line labels on a Feature Layer

This is a workaround to add line breaks to the Label Layer

NOTE: I can't figure out a way to return all the labels for a Feature Layer here, unfortunately. The Label Layer only returns the labels that will fit into their elements, or not conflict with other labels, as calculated based on the original, single-line label. Splitting these labels into multiple lines might reduce conflicts, or allow them to fit properly within their polygons, but because they were conflicted out in the first place, we never see them.

@asizer
asizer / index.html
Created November 7, 2014 01:13
Colors for labels
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Feature Layer Multi-Line Labels</title>
<link rel="stylesheet" href="//js.arcgis.com/3.10/js/esri/css/esri.css">
<style>
html, body, #map {
height: 100%; width: 100%; margin: 0; padding: 0;
@asizer
asizer / partialGruntfile.js
Last active August 29, 2015 14:12
Use grunt concat to create single file for dojo modules AND TEMPLATES!
concat: {
options: {
banner: 'require({\ncache: {\n',
process: function(src, filepath) {
var returnStr = '// Source: ' + filepath + '\n';
if (filepath.indexOf('.js') > 0) {
// add file name
returnStr += '\'' + filepath.replace('js/', '').replace('.js', '') + '\': ';
// add function and file text
returnStr += 'function() {\n' + src + '}';