-->
var XB = XB || {}; // global used for xblock adapter scripts
Ext.onReady(function() {
var config = {
useCapabilities: false,
tools: [{
ptype: "gxp_wmsgetfeatureinfo",
// uncomment the line below if you want feature info in a grid
format: "grid",
actionTarget: "main.tbar",
outputConfig: {width: 400, height: 200, panIn: false}
}, //***** XBLOCK RELATED SETUP *******
{
ptype: "gxp_coordinatetool",
title: "Map Coordinates - longitude, latitude",
actionTarget: {target: "main.tbar"}
},
{
ptype: "gxp_annotation",
user: "None",
toggleGroup: 'featureGroup',
actionTarget: {target: "main.tbar", index: 6}
}
//***** END - XBLOCK RELATED SETUP ******
],
createTools: function() {
return [new Ext.Button({
tooltip: GeoExplorer.prototype.backgroundContainerText,
iconCls: 'icon-layer-switcher',
menu: new gxp.menu.LayerMenu({
layers: this.mapPanel.layers
})
})]
},
proxy: "/proxy/?url=",
siteUrl: "http://worldmap.harvard.edu/",
/* The URL to a REST map configuration service. This service
* provides listing and, with an authenticated user, saving of
* maps on the server for sharing and editing.
*/
rest: "/maps/"
};
Ext.apply(config, {"map": {"layers": [{"opacity": 1, "args": ["No background"], "group": "background", "name": "No background", "title": "No background", "url": null, "selected": false, "visibility": false, "source": "0", "fixed": true, "type": "OpenLayers.Layer"}, {"opacity": 1, "args": ["OpenStreetMap"], "group": "background", "name": "OpenStreetMap", "title": "OpenStreetMap", "url": null, "selected": false, "visibility": false, "source": "0", "fixed": true, "type": "OpenLayers.Layer.OSM"}, {"opacity": 1, "group": "background", "name": "osm", "title": "MapQuest OpenStreetMap", "url": null, "selected": false, "visibility": false, "source": "1", "fixed": true}, {"opacity": 1, "group": "background", "name": "AerialWithLabels", "title": "Bing Aerial With Labels", "url": null, "selected": false, "visibility": false, "source": "2", "fixed": true}, {"opacity": 1, "group": "background", "name": "watercolor", "title": "Stamen Watercolor", "url": null, "selected": false, "visibility": false, "source": "3", "fixed": true}, {"opacity": 1, "group": "background", "name": "toner", "title": "Stamen Toner", "url": null, "selected": false, "visibility": false, "source": "3", "fixed": true}, {"opacity": 1, "group": "background", "name": "World Street Map", "format": "jpeg", "url": "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", "selected": false, "visibility": true, "source": "4", "tiled": false, "title": "ESRI World Street Map", "fixed": true}, {"opacity": 1, "group": "background", "name": "World Imagery", "format": "jpeg", "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", "selected": false, "visibility": false, "source": "5", "tiled": false, "title": "ESRI World Imagery", "fixed": true}, {"opacity": 1, "group": "background", "name": "SATELLITE", "title": "Google Satellite", "url": null, "selected": false, "visibility": false, "source": "6", "fixed": true}, {"opacity": 1, "group": "background", "name": "TERRAIN", "title": "Google Terrain", "url": null, "selected": false, "visibility": false, "source": "6", "fixed": true}, {"opacity": 1, "group": "background", "name": "HYBRID", "title": "Google Hybrid", "url": null, "selected": false, "visibility": false, "source": "6", "fixed": true}, {"opacity": 1, "group": "background", "name": "ROADMAP", "title": "Google Roadmap", "url": null, "selected": false, "visibility": false, "source": "6", "fixed": true}, {"styles": "_census_2zo", "llbbox": [-118.944922954565, 32.7996786668888, -117.64639324212, 34.823326801231], "abstract": "2010 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["Pop", "Wht", "Blk", "Asn", "Oth", "2Race", "Mhi", "Mfi", "pctBlk", "pctL", "pctPvtr"], "propertyNames": {"Oth": "other", "pctBlk": "percent black", "Mhi": "median household income", "Mfi": "median family income", "2Race": "two races", "Pop": "population", "pctL": "percent latino", "Wht": "white", "pctPvtr": "poverty rate", "Blk": "black", "Asn": "asian"}}, "group": "LA Median Household Income", "title": "2010 census", "selected": false, "source": "7", "local": true, "opacity": 0.87, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_2zo", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "Pop", "searchable": false}, {"header": "white", "id": "Wht", "searchable": false}, {"header": "black", "id": "Blk", "searchable": false}, {"header": "asian", "id": "Asn", "searchable": false}, {"header": "other", "id": "Oth", "searchable": false}, {"header": "two races", "id": "2Race", "searchable": false}, {"header": "median household income", "id": "Mhi", "searchable": false}, {"header": "median family income", "id": "Mfi", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}, {"header": "poverty rate", "id": "pctPvtr", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944922954565, 32.7996786668888, -117.64639324212, 34.823326801231]}, {"styles": "_census_9ss_83731f4e", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "2000 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["POP", "WH_al", "BL_al", "AS_al", "OT_al", "2Race", "LAT", "MFI", "MHI", "PVT_pop", "PVTY", "pctBlk", "pctL", "pctPvty"], "propertyNames": {"pctBlk": "percent black", "MHI": "median household income", "MFI": "median family income", "2Race": "two races", "AS_al": "asian", "POP": "population", "BL_al": "black", "WH_al": "white", "pctL": "percent latino", "PVT_pop": "poverty population", "LAT": "latino", "pctPvty": "percent poverty", "PVTY": "poverty", "OT_al": "other"}}, "group": "LA Median Household Income", "title": "2000 census", "selected": false, "source": "7", "local": true, "opacity": 0.9, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_9ss", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "POP", "searchable": false}, {"header": "white", "id": "WH_al", "searchable": false}, {"header": "black", "id": "BL_al", "searchable": false}, {"header": "asian", "id": "AS_al", "searchable": false}, {"header": "other", "id": "OT_al", "searchable": false}, {"header": "two races", "id": "2Race", "searchable": false}, {"header": "latino", "id": "LAT", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "poverty population", "id": "PVT_pop", "searchable": false}, {"header": "poverty", "id": "PVTY", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}, {"header": "percent poverty", "id": "pctPvty", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "1990 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["pop", "BL", "WH", "OT", "LT_all", "ASN", "MFI", "MHI", "pctBlk", "pctL"], "propertyNames": {"pctBlk": "percent black", "MHI": "median household income", "BL": "black population", "MFI": "median family income", "pop": "population", "WH": "white population", "LT_all": "latino population", "pctL": "percent latino", "OT": "other population", "ASN": "asian population"}}, "group": "LA Median Household Income", "title": "1990 census", "selected": false, "source": "7", "local": true, "opacity": 0.9, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_11q", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "pop", "searchable": false}, {"header": "black population", "id": "BL", "searchable": false}, {"header": "white population", "id": "WH", "searchable": false}, {"header": "other population", "id": "OT", "searchable": false}, {"header": "latino population", "id": "LT_all", "searchable": false}, {"header": "asian population", "id": "ASN", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "_census_web_65b024f4", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "1980 census demographics
Minnesota Population Center. National Historical Geographic Information
System: Version 2.0. Minneapolis, MN: University of Minnesota 2011.
", "disabled": false, "getFeatureInfo": {"fields": ["Pop", "blk", "LAT", "pctB", "pctLT", "PVrt", "MHI", "MFI"], "propertyNames": {"pctB": "percent black", "MHI": "median household income", "MFI": "median family income", "Pop": "population", "PVrt": "poverty rate", "blk": "black population", "LAT": "latino population", "pctLT": "percent latino"}}, "group": "LA Median Household Income", "title": "1980 census", "selected": false, "source": "8", "local": true, "opacity": 0.89, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_web", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "Pop", "searchable": false}, {"header": "black population", "id": "blk", "searchable": false}, {"header": "latino population", "id": "LAT", "searchable": false}, {"header": "percent black", "id": "pctB", "searchable": false}, {"header": "percent latino", "id": "pctLT", "searchable": false}, {"header": "poverty rate", "id": "PVrt", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "_census_2zo_70b16e75", "llbbox": [-118.944922954565, 32.7996786668888, -117.64639324212, 34.823326801231], "abstract": "2010 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["Pop", "Wht", "Blk", "Asn", "Oth", "2Race", "Mhi", "Mfi", "pctBlk", "pctL", "pctPvtr"], "propertyNames": {"Oth": "other", "pctBlk": "percent black", "Mhi": "median household income", "Mfi": "median family income", "2Race": "two races", "Pop": "population", "pctL": "percent latino", "Wht": "white", "pctPvtr": "poverty rate", "Blk": "black", "Asn": "asian"}}, "group": "LA Demographic: Latino", "title": "2010 census", "selected": false, "source": "9", "local": true, "opacity": 0.89, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_2zo", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "Pop", "searchable": false}, {"header": "white", "id": "Wht", "searchable": false}, {"header": "black", "id": "Blk", "searchable": false}, {"header": "asian", "id": "Asn", "searchable": false}, {"header": "other", "id": "Oth", "searchable": false}, {"header": "two races", "id": "2Race", "searchable": false}, {"header": "median household income", "id": "Mhi", "searchable": false}, {"header": "median family income", "id": "Mfi", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}, {"header": "poverty rate", "id": "pctPvtr", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944922954565, 32.7996786668888, -117.64639324212, 34.823326801231]}, {"styles": "_census_9ss_d3612214", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "2000 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["POP", "WH_al", "BL_al", "AS_al", "OT_al", "2Race", "LAT", "MFI", "MHI", "PVT_pop", "PVTY", "pctBlk", "pctL", "pctPvty"], "propertyNames": {"pctBlk": "percent black", "MHI": "median household income", "MFI": "median family income", "2Race": "two races", "AS_al": "asian", "POP": "population", "BL_al": "black", "WH_al": "white", "pctL": "percent latino", "PVT_pop": "poverty population", "LAT": "latino", "pctPvty": "percent poverty", "PVTY": "poverty", "OT_al": "other"}}, "group": "LA Demographic: Latino", "title": "2000 census", "selected": false, "source": "9", "local": true, "opacity": 0.9, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_9ss", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "POP", "searchable": false}, {"header": "white", "id": "WH_al", "searchable": false}, {"header": "black", "id": "BL_al", "searchable": false}, {"header": "asian", "id": "AS_al", "searchable": false}, {"header": "other", "id": "OT_al", "searchable": false}, {"header": "two races", "id": "2Race", "searchable": false}, {"header": "latino", "id": "LAT", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "poverty population", "id": "PVT_pop", "searchable": false}, {"header": "poverty", "id": "PVTY", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}, {"header": "percent poverty", "id": "pctPvty", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "_census_11q_41e16bc0", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "1990 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["pop", "BL", "WH", "OT", "LT_all", "ASN", "MFI", "MHI", "pctBlk", "pctL"], "propertyNames": {"pctBlk": "percent black", "MHI": "median household income", "BL": "black population", "MFI": "median family income", "pop": "population", "WH": "white population", "LT_all": "latino population", "pctL": "percent latino", "OT": "other population", "ASN": "asian population"}}, "group": "LA Demographic: Latino", "title": "1990 census", "selected": false, "source": "9", "local": true, "opacity": 0.92, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_11q", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "pop", "searchable": false}, {"header": "black population", "id": "BL", "searchable": false}, {"header": "white population", "id": "WH", "searchable": false}, {"header": "other population", "id": "OT", "searchable": false}, {"header": "latino population", "id": "LT_all", "searchable": false}, {"header": "asian population", "id": "ASN", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "_census_web_d1911b8c", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "1980 census demographics
Minnesota Population Center. National Historical Geographic Information
System: Version 2.0. Minneapolis, MN: University of Minnesota 2011.
", "disabled": false, "getFeatureInfo": {"fields": ["Pop", "blk", "LAT", "pctB", "pctLT", "PVrt", "MHI", "MFI"], "propertyNames": {"pctB": "percent black", "MHI": "median household income", "MFI": "median family income", "Pop": "population", "PVrt": "poverty rate", "blk": "black population", "LAT": "latino population", "pctLT": "percent latino"}}, "group": "LA Demographic: Latino", "title": "1980 census", "selected": false, "source": "9", "local": true, "opacity": 0.89, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_web", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "Pop", "searchable": false}, {"header": "black population", "id": "blk", "searchable": false}, {"header": "latino population", "id": "LAT", "searchable": false}, {"header": "percent black", "id": "pctB", "searchable": false}, {"header": "percent latino", "id": "pctLT", "searchable": false}, {"header": "poverty rate", "id": "PVrt", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "_census_lpw_6fd99f4e", "llbbox": [-118.944915954708, 32.7996126722541, -86.6387182107674, 36.2629827132385], "abstract": "1970 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["BLK", "OTH", "WHT", "HISP", "POP", "pctB", "pctL"], "propertyNames": {"OTH": "other population", "pctB": "percent black", "POP": "population", "pctL": "percent latino", "WHT": "white population", "HISP": "latino population", "BLK": "black population"}}, "group": "LA Demographic: Latino", "title": "1970 census", "selected": false, "source": "9", "local": true, "opacity": 0.89, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_lpw", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "black population", "id": "BLK", "searchable": false}, {"header": "other population", "id": "OTH", "searchable": false}, {"header": "white population", "id": "WHT", "searchable": false}, {"header": "latino population", "id": "HISP", "searchable": false}, {"header": "population", "id": "POP", "searchable": false}, {"header": "percent black", "id": "pctB", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -86.6387182107674, 36.2629827132385]}, {"styles": "_census_3gt_f3a2a31c", "llbbox": [-118.944915954708, 32.7996126722541, -86.6387182107674, 36.2629827132385], "abstract": "1960 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["BLK", "OTH", "WHT", "HISP", "POP", "pctB", "pctL"], "propertyNames": {"OTH": "other", "pctB": "percent black", "POP": "population", "pctL": "percent latino", "WHT": "white", "HISP": "latino (hispanic)", "BLK": "black"}}, "group": "LA Demographic: Latino", "title": "1960 census", "selected": false, "source": "9", "local": true, "opacity": 0.9, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_3gt", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "black", "id": "BLK", "searchable": false}, {"header": "other", "id": "OTH", "searchable": false}, {"header": "white", "id": "WHT", "searchable": false}, {"header": "latino (hispanic)", "id": "HISP", "searchable": false}, {"header": "population", "id": "POP", "searchable": false}, {"header": "percent black", "id": "pctB", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -86.6387182107674, 36.2629827132385]}, {"styles": "_census_2zo_bba7403d", "llbbox": [-118.944922954565, 32.7996786668888, -117.64639324212, 34.823326801231], "abstract": "2010 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["Pop", "Wht", "Blk", "Asn", "Oth", "2Race", "Mhi", "Mfi", "pctBlk", "pctL", "pctPvtr"], "propertyNames": {"Oth": "other", "pctBlk": "percent black", "Mhi": "median household income", "Mfi": "median family income", "2Race": "two races", "Pop": "population", "pctL": "percent latino", "Wht": "white", "pctPvtr": "poverty rate", "Blk": "black", "Asn": "asian"}}, "group": "LA Demographic: Black", "title": "2010 census", "selected": false, "source": "9", "local": true, "opacity": 0.91, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_2zo", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "Pop", "searchable": false}, {"header": "white", "id": "Wht", "searchable": false}, {"header": "black", "id": "Blk", "searchable": false}, {"header": "asian", "id": "Asn", "searchable": false}, {"header": "other", "id": "Oth", "searchable": false}, {"header": "two races", "id": "2Race", "searchable": false}, {"header": "median household income", "id": "Mhi", "searchable": false}, {"header": "median family income", "id": "Mfi", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}, {"header": "poverty rate", "id": "pctPvtr", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944922954565, 32.7996786668888, -117.64639324212, 34.823326801231]}, {"styles": "", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "2000 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["POP", "WH_al", "BL_al", "AS_al", "OT_al", "2Race", "LAT", "MFI", "MHI", "PVT_pop", "PVTY", "pctBlk", "pctL", "pctPvty"], "propertyNames": {"pctBlk": "percent black", "MHI": "median household income", "MFI": "median family income", "2Race": "two races", "AS_al": "asian", "POP": "population", "BL_al": "black", "WH_al": "white", "pctL": "percent latino", "PVT_pop": "poverty population", "LAT": "latino", "pctPvty": "percent poverty", "PVTY": "poverty", "OT_al": "other"}}, "group": "LA Demographic: Black", "title": "2000 census", "selected": false, "source": "10", "local": true, "opacity": 0.89, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_9ss", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "POP", "searchable": false}, {"header": "white", "id": "WH_al", "searchable": false}, {"header": "black", "id": "BL_al", "searchable": false}, {"header": "asian", "id": "AS_al", "searchable": false}, {"header": "other", "id": "OT_al", "searchable": false}, {"header": "two races", "id": "2Race", "searchable": false}, {"header": "latino", "id": "LAT", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "poverty population", "id": "PVT_pop", "searchable": false}, {"header": "poverty", "id": "PVTY", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}, {"header": "percent poverty", "id": "pctPvty", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "_census_11q_b42d0543", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "1990 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["pop", "BL", "WH", "OT", "LT_all", "ASN", "MFI", "MHI", "pctBlk", "pctL"], "propertyNames": {"pctBlk": "percent black", "MHI": "median household income", "BL": "black population", "MFI": "median family income", "pop": "population", "WH": "white population", "LT_all": "latino population", "pctL": "percent latino", "OT": "other population", "ASN": "asian population"}}, "group": "LA Demographic: Black", "title": "1990 census", "selected": false, "source": "10", "local": true, "opacity": 0.9, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_11q", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "pop", "searchable": false}, {"header": "black population", "id": "BL", "searchable": false}, {"header": "white population", "id": "WH", "searchable": false}, {"header": "other population", "id": "OT", "searchable": false}, {"header": "latino population", "id": "LT_all", "searchable": false}, {"header": "asian population", "id": "ASN", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "percent black", "id": "pctBlk", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "", "llbbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271], "abstract": "1980 census demographics
Minnesota Population Center. National Historical Geographic Information
System: Version 2.0. Minneapolis, MN: University of Minnesota 2011.
", "disabled": false, "getFeatureInfo": {"fields": ["Pop", "blk", "LAT", "pctB", "pctLT", "PVrt", "MHI", "MFI"], "propertyNames": {"pctB": "percent black", "MHI": "median household income", "MFI": "median family income", "Pop": "population", "PVrt": "poverty rate", "blk": "black population", "LAT": "latino population", "pctLT": "percent latino"}}, "group": "LA Demographic: Black", "title": "1980 census", "selected": false, "source": "10", "local": true, "opacity": 0.9, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_web", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "population", "id": "Pop", "searchable": false}, {"header": "black population", "id": "blk", "searchable": false}, {"header": "latino population", "id": "LAT", "searchable": false}, {"header": "percent black", "id": "pctB", "searchable": false}, {"header": "percent latino", "id": "pctLT", "searchable": false}, {"header": "poverty rate", "id": "PVrt", "searchable": false}, {"header": "median household income", "id": "MHI", "searchable": false}, {"header": "median family income", "id": "MFI", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -117.645623223366, 34.8231748157271]}, {"styles": "", "llbbox": [-118.944915954708, 32.7996126722541, -86.6387182107674, 36.2629827132385], "abstract": "1970 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["BLK", "OTH", "WHT", "HISP", "POP", "pctB", "pctL"], "propertyNames": {"OTH": "other population", "pctB": "percent black", "POP": "population", "pctL": "percent latino", "WHT": "white population", "HISP": "latino population", "BLK": "black population"}}, "group": "LA Demographic: Black", "title": "1970 census", "selected": false, "source": "10", "local": true, "opacity": 0.9, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_lpw", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "black population", "id": "BLK", "searchable": false}, {"header": "other population", "id": "OTH", "searchable": false}, {"header": "white population", "id": "WHT", "searchable": false}, {"header": "latino population", "id": "HISP", "searchable": false}, {"header": "population", "id": "POP", "searchable": false}, {"header": "percent black", "id": "pctB", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -86.6387182107674, 36.2629827132385]}, {"styles": "", "llbbox": [-118.944915954708, 32.7996126722541, -86.6387182107674, 36.2629827132385], "abstract": "1960 census demographics", "disabled": false, "getFeatureInfo": {"fields": ["BLK", "OTH", "WHT", "HISP", "POP", "pctB", "pctL"], "propertyNames": {"OTH": "other", "pctB": "percent black", "POP": "population", "pctL": "percent latino", "WHT": "white", "HISP": "latino (hispanic)", "BLK": "black"}}, "group": "LA Demographic: Black", "title": "1960 census", "selected": false, "source": "10", "local": true, "opacity": 0.9, "format": "image/png", "buffer": 0, "visibility": false, "tiled": true, "transparent": true, "name": "geonode:_census_3gt", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "black", "id": "BLK", "searchable": false}, {"header": "other", "id": "OTH", "searchable": false}, {"header": "white", "id": "WHT", "searchable": false}, {"header": "latino (hispanic)", "id": "HISP", "searchable": false}, {"header": "population", "id": "POP", "searchable": false}, {"header": "percent black", "id": "pctB", "searchable": false}, {"header": "percent latino", "id": "pctL", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.944915954708, 32.7996126722541, -86.6387182107674, 36.2629827132385]}, {"styles": "josegamez_1xy", "llbbox": [-118.29130901981, 33.9890052661704, -118.29130901981, 33.9890052661704], "abstract": "Jose Gamez", "disabled": false, "getFeatureInfo": {"fields": ["Name", "Description"], "propertyNames": {"Name": "Name", "Description": "Description"}}, "group": "Key Blog Locations", "title": "Memories of the T", "selected": false, "source": "11", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": true, "tiled": true, "transparent": true, "name": "geonode:josegamez_1xy", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "Name", "id": "Name", "searchable": true}, {"header": "Description", "id": "Description", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.29130901981, 33.9890052661704, -118.29130901981, 33.9890052661704]}, {"styles": "walterflores_sae", "llbbox": [-118.291216935423, 33.9863010864554, -118.291216935423, 33.9863010864554], "abstract": "Walter Flores", "disabled": false, "getFeatureInfo": {"fields": ["Name", "Description"], "propertyNames": {"Name": "Name", "Description": "Description"}}, "group": "Key Blog Locations", "title": "Chesterfield Square", "selected": false, "source": "12", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": true, "tiled": true, "transparent": true, "name": "geonode:walterflores_sae", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "Name", "id": "Name", "searchable": true}, {"header": "Description", "id": "Description", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.291216935423, 33.9863010864554, -118.291216935423, 33.9863010864554]}, {"styles": "expopark_r6t", "llbbox": [-118.286047167318, 34.0174890968716, -118.284579680907, 34.0245526576309], "abstract": "Open Space", "disabled": false, "getFeatureInfo": {"fields": ["Name", "Description"], "propertyNames": {"Name": "Name", "Description": "Description"}}, "group": "Key Blog Locations", "title": "Memories of Exposition", "selected": false, "source": "13", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": true, "tiled": true, "transparent": true, "name": "geonode:expopark_r6t", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "Name", "id": "Name", "searchable": true}, {"header": "Description", "id": "Description", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.286047167318, 34.0174890968716, -118.284579680907, 34.0245526576309]}, {"styles": "albertflores_3xd", "llbbox": [0.0, 0.0, -1.0, -1.0], "abstract": "Albert Flores", "disabled": false, "getFeatureInfo": {"fields": ["Name", "Description"], "propertyNames": {"Name": "Name", "Description": "Description"}}, "group": "Key Blog Locations", "title": "Slauson traintracks to Exposition Line", "selected": false, "source": "14", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": true, "tiled": true, "transparent": true, "name": "geonode:albertflores_3xd", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "Name", "id": "Name", "searchable": true}, {"header": "Description", "id": "Description", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [0.0, 0.0, -1.0, -1.0]}, {"styles": "veronicaestrada_qkj", "llbbox": [-118.308905742918, 34.025472967912, -118.300236843382, 34.0255796711253], "abstract": "Veronica Estrada", "disabled": false, "getFeatureInfo": {"fields": ["Name", "Description"], "propertyNames": {"Name": "Name", "Description": "Description"}}, "group": "Key Blog Locations", "title": "From Western to Figueroa", "selected": false, "source": "15", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": true, "tiled": true, "transparent": true, "name": "geonode:veronicaestrada_qkj", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "Name", "id": "Name", "searchable": true}, {"header": "Description", "id": "Description", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.308905742918, 34.025472967912, -118.300236843382, 34.0255796711253]}, {"styles": "jessebrewerjr.park_tcc", "llbbox": [-118.290819699093, 34.0175307592822, -118.258569977177, 34.0257853059366], "abstract": "Green Space", "disabled": false, "getFeatureInfo": {"fields": ["Name", "Description"], "propertyNames": {"Name": "Name", "Description": "Description"}}, "group": "Key Blog Locations", "title": "Memories with family", "selected": false, "source": "16", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": true, "tiled": true, "transparent": true, "name": "geonode:jessebrewerjr.park_tcc", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "Name", "id": "Name", "searchable": true}, {"header": "Description", "id": "Description", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.290819699093, 34.0175307592822, -118.258569977177, 34.0257853059366]}, {"styles": "gilbertot_0jn", "llbbox": [-118.282625814729, 34.0037472259543, -118.282625814729, 34.0037472259543], "abstract": "Gilberto T.", "disabled": false, "getFeatureInfo": {"fields": ["Name", "Description"], "propertyNames": {"Name": "Name", "Description": "Description"}}, "group": "Key Blog Locations", "title": "Memories on Rails", "selected": true, "source": "11", "local": true, "opacity": 1, "format": "image/png", "buffer": 0, "visibility": true, "tiled": true, "transparent": true, "name": "geonode:gilbertot_0jn", "url": "http://worldmap.harvard.edu/geoserver/wms", "srs": "EPSG:4326", "attributes": [{"header": "Name", "id": "Name", "searchable": true}, {"header": "Description", "id": "Description", "searchable": false}], "fixed": false, "queryable": [true], "bbox": [-118.282625814729, 34.0037472259543, -118.282625814729, 34.0037472259543]}], "projection": "EPSG:900913", "center": [-13167595.315276, 4029212.9554589], "zoom": 13, "groups": [{"expanded": "true", "group": "Key Blog Locations"}, {"expanded": "true", "group": "LA Demographic: Black"}, {"expanded": "true", "group": "LA Demographic: Latino"}, {"expanded": "false", "group": "LA Median Household Income"}], "units": "m", "maxResolution": 156543.03390625, "numZoomLevels": 22, "maxExtent": [-20037508.34, -20037508.34, 20037508.34, 20037508.34]}, "about": {"urlsuffix": "bridgingsouthcentral", "abstract": "This site is to function as a virtual tour to the Memories of my Neighborhood blog series of Bridging South Central Communities. This map contains photos, boundaries, census data, along with links to other people\u2019s memories and stories in the area.\n", "officialurl": "", "introtext": "
\n\n\n\n\n\n\n\n\n\n\n\n\nMemories of My Neighborhood Series
\n\nINSTRUCTIONS: To\nenjoy tour at its fullest, click on any of the dots located on the map for photos. Use legend on the left to explore other layers, including census data. Enjoy!
This site is to function as a virtual tour to the Memories\nof my Neighborhood blog series of Bridging South Central Communities.This contains photos,\nboundaries, census data, along with links to other people\u2019s memories and\nstories in the area. \n\n\n\n\n\n
Bridging\n South Central Communities (BSCC) is a community-based and grassroots \norganization established in South Central Los Angeles. Our mission is to provide a platform for local communities to share their experiences via our Historias de South Central project.
", "title": "Memories of my Neighborhood"}, "topic_categories": [["farming", "Farming & Agriculture"], ["biota", "Ecology & Biota"], ["boundaries", "Boundaries"], ["climatologyMeteorologyAtmosphere", "Climate & Weather"], ["economy", "Economic Activities & Employment"], ["elevation", "Elevation"], ["environment", "Environmental Resources, Conservation"], ["health", "Health & Human Ecology"], ["geoscientificInformation", "Earth Sciences"], ["imageryBaseMapsEarthCover", "Imagery & Base Maps"], ["location", "Place Locations"], ["planningCadastre", "Planning & Cadastral Data"], ["society", "Society & Demographics"], ["structure", "Structures"], ["transportation", "Transportation"], ["utilitiesCommunication", "Utilities & Infrastructure"], ["intelligenceMilitary", "Military Bases & Activities"], ["inlandWaters", "Rivers, Streams, Lakes"], ["oceans", "Oceans"]], "uid": 8584, "edit_map": true, "sources": {"11": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "11"}, "10": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "10"}, "13": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "13"}, "12": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "12"}, "15": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "15"}, "14": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "14"}, "17": {"url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "projection": "EPSG:900913", "id": "17"}, "16": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "16"}, "1": {"ptype": "gxp_mapquestsource", "id": "1", "projection": "EPSG:900913"}, "0": {"ptype": "gx_olsource", "id": "0", "projection": "EPSG:900913"}, "3": {"ptype": "gxp_stamensource", "id": "3", "projection": "EPSG:900913"}, "2": {"ptype": "gxp_bingsource", "id": "2", "projection": "EPSG:900913"}, "5": {"url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", "ptype": "gxp_arcgiscachesource", "id": "5", "projection": "EPSG:900913"}, "4": {"url": "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", "ptype": "gxp_arcgiscachesource", "id": "4", "projection": "EPSG:900913"}, "7": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "7"}, "6": {"ptype": "gx_googlesource", "id": "6", "projection": "EPSG:900913"}, "9": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "9"}, "8": {"projection": "EPSG:900913", "title": "GeoNode Source", "url": "http://worldmap.harvard.edu/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "id": "8"}, "csw": {"url": "http://worldmap.harvard.edu/geonetwork/srv/en/csw", "ptype": "gxp_cataloguesource", "projection": "EPSG:900913", "proxyOptions": {"listeners": {}}, "id": "csw"}, "local": {"url": "/geoserver/wms", "ptype": "gxp_gnsource", "restUrl": "/gs/rest", "projection": "EPSG:900913", "id": "local"}}, "proxy": "/proxy/?url=", "social_explorer": [], "defaultSourceType": "gxp_gnsource", "first_visit": false, "id": 6077});
app = new GeoExplorer.Viewer(config);
//********************************************* XBLOCK RELATED CODE ********************************************
//useful for debugging...
window.MESSAGING.getInstance().registerHandler("info", function (m) {
alert("INFO: the slave code received this 'info' message: " + m.getMessage());
});
app.on("ready", function () {
markerLayer = new OpenLayers.Layer.Markers("worldmap-markers");
polygonLayer = new OpenLayers.Layer.Vector("worldmap-polygons", {
styleMap: new OpenLayers.StyleMap({
fillColor: "#ff0000",
fillOpacity: 0.3
})
});
polylineLayer = new OpenLayers.Layer.Vector("worldmap-polyline", {
styleMap: new OpenLayers.StyleMap({
strokeColor: "#000000",
strokeOpacity: 1.0,
strokeWidth: 3
})
});
var polygonControl =
new OpenLayers.Control.DrawFeature(polygonLayer, OpenLayers.Handler.Polygon, {
callbacks: {
done: function (geo) {
var polygon = [];
for (var i = 0; i < geo.components[0].components.length; i++) {
var point = transformToLonLat({lon: geo.components[0].components[i].x, lat: geo.components[0].components[i].y});
polygon.push({lon: point.x, lat: point.y});
}
window.MESSAGING.getInstance().send(
new Message("polygon_response",
{
polygon: polygon,
question: currentQuestion
}
)
);
var feature = new OpenLayers.Feature.Vector(geo, {}, {
fillColor: '#' + currentQuestion.color,
fillOpacity: 0.4
});
var proceed = this.events.triggerEvent("sketchcomplete", {feature: feature});
if (proceed !== false) {
feature.state = OpenLayers.State.INSERT;
if (polygons[currentQuestion.id]) {
polygonLayer.removeFeatures([polygons[currentQuestion.id]]);
}
polygons[currentQuestion.id] = feature;
polygonLayer.addFeatures([feature]);
this.featureAdded(feature);
this.events.triggerEvent("featureadded", {feature: feature});
}
}
}
});
var polylineControl =
new OpenLayers.Control.DrawFeature(polylineLayer, OpenLayers.Handler.Path, {
doubleTouchTolerance: 50,
callbacks: {
done: function (geo) {
var polyline = [];
for (var i = 0; i < geo.components.length; i++) {
var point = transformToLonLat({lon: geo.components[i].x, lat: geo.components[i].y});
polyline.push({lon: point.x, lat: point.y});
}
window.MESSAGING.getInstance().send(
new Message("polyline_response",
{
polyline: polyline,
question: currentQuestion
}
)
);
var feature = new OpenLayers.Feature.Vector(geo, {}, {
strokeColor: '#' + currentQuestion.color,
strokeOpacity: 1,
strokeWidth: 3
});
var proceed = this.events.triggerEvent("sketchcomplete", {feature: feature});
if (proceed !== false) {
feature.state = OpenLayers.State.INSERT;
if (polylines[currentQuestion.id]) {
polylineLayer.removeFeatures([polylines[currentQuestion.id]]);
}
polylines[currentQuestion.id] = feature;
polylineLayer.addFeatures([feature]);
this.featureAdded(feature);
this.events.triggerEvent("featureadded", {feature: feature});
}
}
}
});
app.mapPanel.map.addLayers([markerLayer, polygonLayer, polylineLayer]);
app.mapPanel.map.events.register("moveend", app.mapPanel, function () {
// calculate lat/lon
window.MESSAGING.getInstance().send(new Message("moveend", {center: transformToLonLat(app.mapPanel.map.getCenter()), zoomLevel: app.mapPanel.map.getZoom()}));
});
app.mapPanel.map.events.register("zoomend", app.mapPanel.map, function () {
window.MESSAGING.getInstance().send(new Message("zoomend", app.mapPanel.map.getZoom()));
});
app.mapPanel.map.events.register("changelayer", app.mapPanel.map, function (e) {
var msg = new Message("changelayer", {name: e.layer.name, id: e.layer.id, visibility: e.layer.visibility, opacity: e.layer.opacity, legendData: getLayerLegendInfo(app.config.map.layers, e.layer)});
console.log("sending changelayer back to master. layer: " + JSON.stringify(msg.getMessage()));
window.MESSAGING.getInstance().send(msg);
});
window.MESSAGING.getInstance().registerHandler("setZoomLevel", function (m) {
app.mapPanel.map.zoomTo(m.getMessage());
});
window.MESSAGING.getInstance().registerHandler("setCenter", function (m) {
var data = m.getMessage();
//Ext.example.msg("Info","setCenter: "+data.centerLat+","+data.centerLon+" zoom="+data.zoomLevel);
var pt = transformToXY({lon: data.centerLon, lat: data.centerLat});
app.mapPanel.map.setCenter([pt.x, pt.y], data.zoomLevel, false, false);
});
window.MESSAGING.getInstance().registerHandler("setLayers", function (m) {
console.log("slave recieved setLayers command, data = " + m.getMessage());
var data = JSON.parse(m.getMessage());
for (var id in data) {
try {
if (id !== "OpenLayers_Layer_Vector_132") { //TODO: REMOVE THIS - it causes an exception that we can't seem to handle
var layer = app.mapPanel.map.getLayer(id);
if (layer != null) {
// layer.setVisibility(data[id]['visibility']);
var ctrl = Ext.getCmp("layer_menu_" + layer.id);
layer.setOpacity(data[id]['opacity']);
if ((ctrl.checked && !data[id]['visibility']) || (!ctrl.checked && data[id]['visibility'])) {
console.log("turning layer: " + id + " to " + data[id]['visibility']);
ctrl.setChecked(data[id]['visibility']);
}
else {
console.log("didn't change visibility for layer: " + id + " currently: " + data[id]['visibility']);
console.log("sending changelayer back to master. layer: { name: " + data[id]['name'] + ", id: " + id + ", visibility: " + data[id]['visibility'] + ", opacity: " + data[id]['opacity'] + ", legendData: " + JSON.stringify(getLayerLegendInfo(app.config.map.layers, data[id])) + "}");
window.MESSAGING.getInstance().send(new Message("changelayer", {name: data[id]['name'], id: id, visibility: data[id]['visibility'], opacity: data[id]['opacity'], legendData: getLayerLegendInfo(app.config.map.layers, data[id])}));
}
} else {
console.log("ERROR: could not find layer for id: " + id);
}
} else {
console.log("setLayer was asked to deal with a bad layer: " + id);
}
} catch (e) {
console.log("slave caught exception during setLayers: " + e);
}
}
});
var markerControl = new CLICK_CONTROL();
app.mapPanel.map.addControl(markerControl);
app.mapPanel.map.addControl(polygonControl);
app.mapPanel.map.addControl(polylineControl);
window.MESSAGING.getInstance().registerHandler("reset-answer-tool", function (m) {
$('.olMapViewport').css('cursor', "default");
// if( document.getElementById(id) != undefined ) {
// document.getElementById(id).style.cursor = "default";
// }
markerControl.deactivate();
polygonControl.deactivate();
polylineControl.deactivate();
currentQuestion = null;
});
window.MESSAGING.getInstance().registerHandler("set-answer-tool", function (e) {
var message = JSON.parse(e.message);
currentQuestion = message;
//TODO: fix url - make relative
//should use $('.olMapViewport').style.cursor = "url(http://robertlight.com/tmp/"+currentQuestion.type+"Cursor.png) 16 16, auto";
$('.olMapViewport').css('cursor', "url(/static/geonode/externals/ext/resources/images/default/xblock-images/" + currentQuestion.type + "Cursor.png) 16 16, auto");
//document.getElementById(app.mapPanel.map.id+"_OpenLayers_ViewPort").style.cursor = "url(http://robertlight.com/tmp/"+currentQuestion.type+"Cursor.png) 16 16, auto";
if (currentQuestion.type == 'point') {
Ext.example.msg("Info", "Click the map at the location requested");
markerControl.activate();
} else if (currentQuestion.type == 'polygon') {
// window.alert("color="+currentQuestion.color);
polygonLayer.styleMap = new OpenLayers.StyleMap({
fillColor: '#' + currentQuestion.color,
fillOpacity: 0.3
});
Ext.example.msg("Info", "Please click on the boundaries of a polygon. < br / > Double - click to end drawing."
)
;
polygonControl.activate();
} else if (currentQuestion.type == 'polyline') {
Ext.example.msg("Info", "Please click on the verticies of a polyline. < br / > Double - click to end drawing. ");
polylineControl.activate();
}
});
window.MESSAGING.getInstance().registerHandler("flash-polygon", function (e) {
var data = JSON.parse(e.message);
var features = [];
var bounds = null;
for (var i = 0; i < data.length; i++) {
var points = [];
for (var j = 0; j < data[i].length; j++) {
points.push(transformToXY(data[i][j]));
}
var ring = new OpenLayers.Geometry.LinearRing(points);
var center = ring.getCentroid();
var feature =
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon(ring),
{},
{
fillColor: '#FF0000',
fillOpacity: 0.05,
strokeColor: '#FF0000',
strokeOpacity: 0.05
}
);
feature.state = OpenLayers.State.INSERT;
var b = ring.getBounds();
if (bounds != null) {
bounds.extend(b);
} else {
bounds = b;
}
features.push(feature);
}
app.mapPanel.map.setCenter(
[center.x, center.y],
Math.min(15, app.mapPanel.map.getZoomForExtent(bounds, false))
);
polygonLayer.addFeatures(features);
polygonLayer.redraw();
setTimeout(function () {
polygonLayer.removeFeatures(features);
polygonLayer.redraw();
}, 3000);
});
window.MESSAGING.getInstance().registerHandler("reset-highlights", function (m) {
try {
polygonLayer.destroyFeatures();
} catch (e) {
}
try {
markerLayer.destroyFeatures();
} catch (e) {
}
try {
polylineLayer.destroyFeatures();
} catch (e) {
}
try {
markerLayer.clearMarkers();
} catch (e) {
}
// try {
// for( var i in markers ) {
// markerLayer.removeMarker(markers[i]);
// }
// } catch (e) {}
});
window.MESSAGING.getInstance().registerHandler("highlight-layer", function (m) {
var data = JSON.parse(m.getMessage());
var layer = app.mapPanel.map.getLayer(data['layer']);
var duration = data['duration'];
if (layer != null) {
var ctrl = Ext.getCmp("layer_menu_" + data['layer']);
if (!ctrl.checked) {
ctrl.setChecked(true);
}
var zoom = app.mapPanel.map.getZoomForExtent(layer.maxExtent, true) + data['relativeZoom'];
app.mapPanel.map.setCenter(layer.maxExtent.getCenterLonLat(), zoom);
if (duration != undefined && duration > 0) {
setTimeout(function () {
ctrl.setChecked(false);
}, duration);
}
} else {
console.log("ERROR: could not find layer for id: " + id);
}
});
window.MESSAGING.getInstance().registerHandler("highlight-geometry", function (e) {
var data = JSON.parse(e.message);
var type = data['type'];
var duration = data['duration']
var features = [];
var relativeZoom = data['relativeZoom'] == undefined ? 0 : data['relativeZoom'];
var bounds = null;
if (type == 'polygon') {
var points = [];
for (var i = 0; i < data['points'].length; i++) {
points.push(transformToXY(data['points'][i]))
}
var ring = new OpenLayers.Geometry.LinearRing(points);
var center = ring.getCentroid();
var feature =
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon(ring),
{},
{
fillColor: '#FF0000',
fillOpacity: 0.5,
strokeColor: '#FF0000',
strokeOpacity: 0.5
}
);
feature.state = OpenLayers.State.INSERT;
bounds = ring.getBounds();
features.push(feature);
var factor = Math.min(15, relativeZoom + app.mapPanel.map.getZoomForExtent(bounds, false));
console.log("zooming in to (" + center.x + "," + center.y + ") factor=" + factor);
app.mapPanel.map.setCenter([center.x, center.y], factor);
polygonLayer.addFeatures(features);
polygonLayer.redraw();
if (duration != undefined && duration > 0) {
setTimeout(function () {
polygonLayer.removeFeatures(features);
polygonLayer.redraw();
}, duration);
}
} else if (type == 'point') {
// app.mapPanel.map
var size = new OpenLayers.Size(21, 25);
var offset = new OpenLayers.Pixel(-size.w / 2, -size.h);
var xy = transformToXY(data['points'][0]);
var icon = new OpenLayers.Icon('/static/geonode/externals/ext/resources/images/default/xblock-images/marker.png', size, offset);
app.mapPanel.map.setCenter([xy.x, xy.y], 11 + relativeZoom);
marker = new OpenLayers.Marker({lon: xy.x, lat: xy.y}, icon);
markerLayer.addMarker(marker);
if (duration != undefined && duration > 0) {
setTimeout(function () {
markerLayer.removeMarker(marker);
}, duration);
}
} else if (type == 'polyline') {
var points = [];
for (var i = 0; i < data['points'].length; i++) {
points.push(transformToXY(data['points'][i]));
}
var line = new OpenLayers.Geometry.LineString(points);
//var center = line.getCentroid();
var bounds = line.getBounds();
var feature = new OpenLayers.Feature.Vector(line, {}, { strokeColor: '#FF0000', strokeWidth: 4, strokeOpacity: 1.0});
feature.state = OpenLayers.State.INSERT;
features.push(feature);
app.mapPanel.map.setCenter(
bounds.getCenterLonLat(),
Math.min(15, relativeZoom + app.mapPanel.map.getZoomForExtent(bounds, false))
);
polygonLayer.addFeatures(features);
polygonLayer.redraw();
if (duration != undefined && duration > 0) {
setTimeout(function () {
polygonLayer.removeFeatures(features);
polygonLayer.redraw();
}, duration);
}
}
});
console.log("sending portalReady to master from embed.html at end of app.on('ready') processing");
window.MESSAGING.getInstance().send(new Message("portalReady", {}));
var legendInfo = [];
for (var i = 0; i < app.mapPanel.map.layers.length; i++) {
var layer = app.mapPanel.map.layers[i];
legendInfo.push(
{
name: layer.name,
id: layer.id,
visibility: layer.visibility,
opacity: layer.opacity,
legendData: getLayerLegendInfo(app.config.map.layers, layer)
}
);
}
window.MESSAGING.getInstance().send(new Message("postLegends", legendInfo));
//**************************************** END - XBLOCK RELATED CODE ****************************************
});
});