Skip to content

Commit

Permalink
renderer fix
Browse files Browse the repository at this point in the history
typo in sample

typo in sample part two
  • Loading branch information
jgravois committed Dec 1, 2014
1 parent 0c04e50 commit 405e0c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
19 changes: 10 additions & 9 deletions geojsonlayer.html
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>ArcGIS GeoJSON Layer</title>
<title>ArcGIS GeoJSON Layer</title>
<link rel="shortcut icon" href="//esri.github.io/quickstart-map-js/images/favicon.ico">
<!-- ArcGIS API for JavaScript CSS-->
<link rel="stylesheet" href="//js.arcgis.com/3.10/js/esri/css/esri.css">
Expand Down Expand Up @@ -71,8 +71,8 @@
url: url // ./data/dc-schools.json
});

// Optional SimpleRenderer if you don't want a random symbol and color
// var simpleJson = {
//Optional SimpleRenderer if you don't want a random symbol and color
// var simpleJson = {
// "type": "simple",
// "label": "",
// "description": "",
Expand All @@ -85,14 +85,15 @@
// "type": "esriSLS" // esriSMS, esriSLS
// }
// };
// geoJsonLayer.render = new SimpleRenderer(simpleJson);
// geoJsonLayer.renderer = new SimpleRenderer(simpleJson);

// Zoom to layer
geoJsonLayer.on("update-end", function (e) {
map.setExtent(e.target.extent.expand(1.2));
});
// Add to map
map.addLayer(geoJsonLayer);

}

function removeAllLayers() {
Expand Down Expand Up @@ -126,15 +127,15 @@
<div class="panel panel-primary panel-fixed">
<div class="panel-heading">
<h3 class="panel-title">ArcGIS GeoJSON Layer</h3>
<button id="chevron" class="btn btn-primary btn-xs btn-absolute">
<button id="chevron" class="btn btn-primary btn-xs btn-absolute">
<span class="glyphicon glyphicon-chevron-up"></span>
</button>
</div>
<div class="panel-body collapse in">
<p>Load GeoJSON into the map as a layer. <a href="https://github.com/esri/Terraformer">Terraformer</a> is used to convert GeoJSON to ArcGIS JSON.</p>
<div class="form text-left">
<div class="form-group">
<label class="control-label">Sample Data</label>
<label class="control-label">Sample Data</label>
<select class="form-control" id="selGeoJson">
<option value="./data/dc-school-zones.json">GeoJSON File - D.C. School Zones</option>
<option value="./data/dc-metro-lines.json">GeoJSON File - D.C. Metro Lines</option>
Expand Down
10 changes: 5 additions & 5 deletions src/geojsonlayer.js
Expand Up @@ -20,7 +20,7 @@ define([
) {
return declare([GraphicsLayer], {

// Required Terrformer library reference
// Required Terrformer library reference
_terrafomer: (typeof Terraformer !== 'undefined') ? Terraformer : null,

constructor: function (options) {
Expand All @@ -38,7 +38,7 @@ define([
this._data = options.data;
// GeoJSON spatial reference (not optional)
this._inSpatialReference = new SpatialReference({wkid: 4326}); // Data must be in Geographic Coordinates
// GeoJSON transformation (optional)
// GeoJSON transformation (optional)
this._outSpatialReference = null;
// Default popup
this.setInfoTemplate(options.infoTemplate || new InfoTemplate("GeoJSON Data", "${*}"));
Expand Down Expand Up @@ -167,7 +167,7 @@ define([
},

_getGeoJsonXhr: function (url) {
// xhr request to get data
// xhr request to get data
var requestHandle = esriRequest({
url: url,
handleAs: "json"
Expand Down Expand Up @@ -263,9 +263,9 @@ define([
// This magically sets geometry type!
graphic = new Graphic(arcgisJson);
// Set the correct symbol based on type and render - NOTE: Only supports simple renderers
if (this.render && this.render.symbol) {
if (this.renderer && this.renderer.symbol) {
//graphic.setSymbol(this.render.getSymbol(graphic)); // use for complex renderers
graphic.setSymbol(this.render.symbol);
graphic.setSymbol(this.renderer.symbol);
} else {
graphic.setSymbol(this._getEsriSymbol(graphic.geometry.type));
}
Expand Down

0 comments on commit 405e0c4

Please sign in to comment.