Skip to content

Commit

Permalink
various javascript cleanups for esri services
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Jan 29, 2016
1 parent 0892e99 commit e2c98f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/geoblacklight/viewers/esri.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

GeoBlacklight.Viewer.Esri = GeoBlacklight.Viewer.Map.extend({
layerInfo: {},

layerOptions: {

// sets initial layer opacity
opacity: 0.75
opacity: 0.75
},

load: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GeoBlacklight.Viewer.FeatureLayer = GeoBlacklight.Viewer.Esri.extend({

// default feature styles
defaultStyles: {
'esriGeometryPoint': '',
'esriGeometryPoint': '',
'esriGeometryMultipoint': '',
'esriGeometryPolyline': {color: 'blue', weight: 3 },
'esriGeometryPolygon': {color: 'blue', weight: 2 }
Expand Down Expand Up @@ -44,8 +44,8 @@ GeoBlacklight.Viewer.FeatureLayer = GeoBlacklight.Viewer.Esri.extend({
var _this = this;

// lookup style hash based on layer geometry type and return function
return function(feature) {
return _this.defaultStyles[_this.layerInfo.geometryType];
return function(feature) {
return _this.defaultStyles[_this.layerInfo.geometryType];
};
},

Expand All @@ -58,15 +58,15 @@ GeoBlacklight.Viewer.FeatureLayer = GeoBlacklight.Viewer.Esri.extend({
setupInspection: function(featureLayer) {
var _this = this;

// inspect on click
// inspect on click
featureLayer.on('click', function(e) {
_this.appendLoadingMessage();

// query layer at click location
featureLayer.query()
.returnGeometry(false)
.intersects(e.latlng)
.run(function(error, featureCollection, response){
.run(function(error, featureCollection, response) {
if (error) {
_this.appendErrorMessage();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ GeoBlacklight.Viewer.TiledMapLayer = GeoBlacklight.Viewer.Esri.extend({
* - use Proj4Leaflet
*/

//
var esriTiledMapLayer = L.esri.tiledMapLayer(this.layerOptions);

//setup feature inspection
Expand All @@ -25,15 +24,15 @@ GeoBlacklight.Viewer.TiledMapLayer = GeoBlacklight.Viewer.Esri.extend({
}
},

setupInspection: function(layer) {
setupInspection: function(layer) {
var _this = this;
this.map.on('click', function(e) {
_this.appendLoadingMessage();

// query layer at click location
L.esri.Tasks.identifyFeatures({
url: layer.options.url,
useCors: true
url: layer.options.url,
useCors: true
})
.tolerance(0)
.returnGeometry(false)
Expand Down

0 comments on commit e2c98f3

Please sign in to comment.