POST
|
I just tried to do the same thing. No luck referencing the 3.x api in a 4.x application or the other way around. Ended up having to go with the dgrid.
... View more
05-04-2018
05:20 AM
|
1
|
0
|
553
|
POST
|
Hello, I am working on an application where I want the user to be able to switch between webmaps in the same application similar to this - Calcite Maps - ArcGIS 4.x except instead of a Scene View and Map View, I want both to be API 3.24 webmaps. Has anyone done this or can they provide some insight in how to accomplish this? My code so far <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="description" content="Calcite Maps Demo - ArcGIS">
<meta name="author" content="">
<title>TESTESTEST</title>
<!-- Calcite Maps Bootstrap -->
<link rel="stylesheet" href="https://esri.github.io/calcite-maps/dist/css/calcite-maps-bootstrap.min-v0.3.css">
<!-- Calcite Maps -->
<link rel="stylesheet" href="https://esri.github.io/calcite-maps/dist/css/calcite-maps-arcgis-3.x.min-v0.3.css">
<!-- ArcGIS JS 3.x -->
<link rel="stylesheet" href="https://js.arcgis.com/3.24/esri/themes/calcite/dijit/calcite.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/dojox/grid/resources/Grid.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/dojox/grid/resources/claroGrid.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/esri/themes/calcite/esri/esri.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/dgrid/css/dgrid.css">
<style>
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#bottompane {
height: 100px;
}
#grid {
height: 100%;
}
.dgrid {
border: none;
}
.calcite-panels {
z-index: 31;
}
.calcite-panels.calcite-panels-table {
position: absolute;
bottom: 0;
top: auto;
left: 0;
right: 0;
z-index: 30;
}
#panelTable {
margin-bottom: 0;
}
#panelTable .panel-body {
height: 400px;
width: 100%;
}
</style>
</head>
<body class="calcite calcite-nav-top">
<nav class="navbar calcite-navbar navbar-fixed-top calcite-text-light calcite-bg-custom calcite-bgcolor-dark-blue">
<!-- Menu -->
<div class="dropdown calcite-dropdown calcite-bg-light calcite-text-dark" role="presentation">
<a class="dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false">
<div class="calcite-dropdown-toggle">
<span class="sr-only">Toggle dropdown menu</span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</a>
<ul class="dropdown-menu">
<li>
<a class="visible-xs" role="button" data-target="#panelSearch" aria-haspopup="true">
<span class="glyphicon glyphicon-search"></span> Search</a>
</li>
<li>
<a role="menuitem" data-target="#panelLegend" aria-haspopup="true">
<span class="glyphicon glyphicon-list-alt"></span> Legend
</a>
</li>
<li>
<a role="button" data-target="#panelBasemaps" aria-haspopup="true">
<span class="glyphicon glyphicon-th-large"></span> Basemaps</a>
</li>
<li>
<a role="button" data-target="#panelTable" data-toggle="collapse" aria-haspopup="true">
<span class="glyphicon glyphicon-list"></span> Table</a>
</li>
</ul>
</div>
<!-- Title -->
<div class="calcite-title calcite-overflow-hidden">
<span class="calcite-title-main hidden-xs">My WebMap App</span>
<span class="hidden-xs"
</div>
<!-- Nav -->
<ul class="calcite-nav nav navbar-nav">
<li>
<a id="map1" class="hidden-xs hidden-sm" href="#map1Tab" aria-controls="map1Tab" aria-expanded="true" role="tab" data-toggle="tab"
data-tooltip="tip" title="Map 1" data-placement="bottom">Map 1</a>
</li>
<li>
<a id="Map 2" class="hidden-xs hidden-sm" href="#map2Tab" aria-controls="Map 2Tab" aria-expanded="true" role="tab" data-toggle="tab"
data-tooltip="tip" title="Map 2" data-placement="bottom">Map 2</a>
</li>
<li>
<div class="calcite-navbar-search hidden-xs">
<div id="searchNavDiv"></div>
</div>
</li>
</ul>
</nav>
<!-- Map Container -->
<div class="calcite-map">
<div id="tabContainer" class="tab-content">
<div id="map1Tab" class="tabe-pane active" role="tabpanel">
<div id="map1" class="calcite-map-absolute"></div>
</div>
<div id="map2Tab" class="tab-pane" role="tabpanel" class="tab-pane">
<div id="map2" class="calcite-map-absolute"></div>
</div>
</div>
</div>
<div class="calcite-panels calcite-panels-right calcite-bg-light calcite-text-dark panel-group" role="tablist" aria-multiselectable="true">
<div id="panelSearch" class="panel collapse hidden-sm hidden-md hidden-lg">
<div id="headingSearch" class="panel-heading" role="tab">
<div class="panel-title">
<a class="panel-toggle collapsed" role="button" data-toggle="collapse" href="#collapseSearch" aria-expanded="false" aria-controls="collapseSearch">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
<span class="panel-label">Search</span>
</a>
<a class="panel-close" role="button" data-toggle="collapse" data-target="#panelSearch">
<span class="esri-icon esri-icon-close" aria-hidden="true"></span>
</a>
</div>
</div>
<div id="collapseSearch" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSearch">
<div class="panel-body calcite-body-expander">
<div id="searchPanelDiv"></div>
</div>
</div>
</div>
<!-- Legend -->
<div id="panelLegend" class="panel collapse">
<div id="headingLegend" class="panel-heading" role="tab">
<div class="panel-title">
<a class="panel-toggle collapsed" role="button" data-toggle="collapse" href="#collapseLegend" aria-expanded="false" aria-controls="collapseLegend">
<span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span>
<span class="panel-label">Legend</span>
</a>
<a class="panel-close" role="button" data-toggle="collapse" href="#panelLegend">
<span class="esri-icon esri-icon-close" aria-hidden="true"></span>
</a>
</div>
</div>
<div id="collapseLegend" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingLegend">
<div class="panel-body body-light">
<div id="legendDiv"></div>
</div>
</div>
</div>
<div id="panelBasemaps" class="panel collapse">
<div id="headingBasemaps" class="panel-heading" role="tab">
<div class="panel-title">
<a class="panel-toggle collapsed" role="button" data-toggle="collapse" href="#collapseBasemaps" aria-expanded="false" aria-controls="collapseBasemaps">
<span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>
<span class="panel-label">Basemaps</span>
</a>
<a class="panel-close" role="button" data-toggle="collapse" href="#panelBasemaps">
<span class="esri-icon esri-icon-close" aria-hidden="true"></span>
</a>
</div>
</div>
<div id="collapseBasemaps" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingBasemaps">
<div class="panel-body">
<select id="selectBasemapPanel" class="form-control">
<option value="streets" data-vector="vector-streets">Streets</option>
<option value="satellite" data-vector="satellite">Satellite</option>
<option value="hybrid" data-vector="hybrid">Hybrid</option>
<option value="national-geographic" data-vector="national-geographic">National Geographic</option>
<option value="topo" data-vector="vector-streets-relief">Topographic</option>
<option value="gray" data-vector="vector-canvas-light">Gray</option>
<option value="dark-gray" data-vector="vector-canvas-dark">Dark Gray</option>
<option value="osm" data-vector="osm">Open Street Map</option>
<option value="dark-gray" data-vector="vector-streets-night">Streets Night</option>
<option value="streets" data-vector="vector-streets-mobile">Streets Mobile</option>
</select>
</div>
</div>
</div>
</div>
<!--table-->
<div class="calcite-panels calcite-panels-table calcite-bg-light calcite-text-dark">
<div id="panelTable" class="panel collapse in">
<div id="headingInfo" class="panel-heading" role="tab">
<div class="panel-title">
<a class="panel-toggle" role="button" data-toggle="collapse" href="#collapseTable" data-parent="#panelAccordion" aria-expanded="true"
aria-controls="collapseInfo">
<span class="glyphicon glyphicon-list" aria-hidden="true"></span> Table</a>
<a class="panel-close" role="button" data-toggle="collapse" data-target="#panelTable">
<span class="esri-icon esri-icon-close" aria-hidden="true"></span>
</a>
</div>
</div>
<div id="collapseTable" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingInfo">
<div id="container" class="panel-body">
<div id="grid"></div>
</div>
</div>
</div>
</div>
<!-- /html structure -->
<!-- Dojo Config -->
<script type="text/javascript">
var dojoConfig = {
packages: [{
name: "bootstrap",
location: "https://esri.github.io/calcite-maps/dist/vendor/dojo-bootstrap"
//location: location.pathname.replace(/\/[^/]+$/, "") + "./../../dist/vendor/dojo-bootstrap"
},
{
name: "calcite-maps",
location: "https://esri.github.io/calcite-maps/dist/js/dojo"
//location: location.pathname.replace(/\/[^/]+$/, "") + "./../../dist/js/dojo"
}]
};
</script>
<!-- ArcGIS JS 3.x -->
<script src="https://js.arcgis.com/3.24/"></script>
<script>
require([
"dojo/ready",
"esri/map",
"esri/layers/FeatureLayer",
"esri/dijit/FeatureTable",
"esri/tasks/QueryTask",
"esri/tasks/FindTask",
"esri/tasks/FindParameters",
"esri/tasks/query",
"esri/InfoTemplate",
"esri/dijit/Search",
"dojo/_base/Color",
"dojo/query",
"dojo/dom",
"dijit/registry",
"dojo/_base/array",
"dojo/_base/connect",
"dojox/grid/DataGrid",
"dojo/data/ItemFileReadStore",
"dijit/form/Button",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dgrid/OnDemandGrid",
"dgrid/Selection",
"dojo/_base/declare",
"esri/symbols/SimpleFillSymbol",
"dojo/store/Memory",
"dojo/dom-style",
"dgrid/_StoreMixin",
"esri/dijit/Legend",
"esri/arcgis/utils",
// OAuth
"esri/arcgis/Portal",
"esri/arcgis/OAuthInfo",
"esri/IdentityManager",
"dojo/on",
"dojo/parser",
// Bootstrap
"bootstrap/Collapse",
"bootstrap/Dropdown",
"bootstrap/Tab",
// Calcite Maps
"calcite-maps/calcitemaps",
], function (ready, Map, FeatureLayer, FeatureTable, QueryTask, FindTask, FindParameters, Query, InfoTemplate, Search, Color, query, dom, registry, array, connect, DataGrid, ItemFileReadStore, Button, BorderContainer, ContentPane, Grid, Selection, declare, SimpleFillSymbol, Memory, domStyle, StoreMixin, Legend, arcgisUtils, arcgisPortal, OAuthInfo, esriID, on, parser
) {
ready(function () {
// OAuth
var info = new OAuthInfo({
//OAuthStuff
});
esriID.registerOAuthInfos([info]);
/************************************************************
* Begin Map Stuff
************************************************************/
parser.parse();
// Set portal URL so the map knows where to pull item id from
arcgisUtils.arcgisUrl = "portal.com/portal"
var webmapids = [
"webmapid1",
"webmapid2"
];
arcgisUtils.createMap("webmapid1", "map1").then(function (response) {
var map1 = response.map;
var legendLayers = arcgisUtils.getLegendLayers(response);
var legendDijit = new Legend({
map: map1,
layerInfos: legendLayers
}, "legendDiv");
legendDijit.startup();
});
arcgisUtils.createMap("webmapid2", "map2").then(function (response) {
var map2 = response.map;
var legendDijit = arcgisUtils.getLegendLayers(response);
var legendDijit = new Legend({
map: map2,
layerInfos: legendLayers
}, "legendDiv");
legendDijit.startup()
});
});
})
</script>
</body>
</html> Thanks, Judson
... View more
05-04-2018
05:19 AM
|
1
|
0
|
420
|
POST
|
I just found the issue.... I am hosting my map app on Sharepoint and it adds some code at the beginning of the head that somehow disables some of the rendering. Thanks for the help anyhow!
... View more
05-03-2018
06:22 AM
|
0
|
0
|
759
|
POST
|
Hello, I am trying to insert the "esri/dijit/Legend" widget inside a Calcite Maps bootstrap panel but it is not rendering for some reason. Is this a limitation of Calcite Maps and 3.x? (specifically 3.24) I would have built this application in 4.x however, my understanding is that feature layer labeling is not supported in 2D. Can anyone provide some insight or a work around on how to get a legend on my map? <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="description" content="Calcite Maps Demo - ArcGIS">
<meta name="author" content="">
<title>TESTESTEST</title>
<!-- Calcite Maps Bootstrap -->
<link rel="stylesheet" href="https://esri.github.io/calcite-maps/dist/css/calcite-maps-bootstrap.min-v0.3.css">
<!-- Calcite Maps -->
<link rel="stylesheet" href="https://esri.github.io/calcite-maps/dist/css/calcite-maps-arcgis-3.x.min-v0.3.css">
<!-- ArcGIS JS 3.x -->
<link rel="stylesheet" href="https://js.arcgis.com/3.24/esri/themes/calcite/dijit/calcite.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/dojox/grid/resources/Grid.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/dojox/grid/resources/claroGrid.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/esri/themes/calcite/esri/esri.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/dgrid/css/dgrid.css">
<style>
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#bottompane {
height: 100px;
}
#grid {
height: 100%;
}
.dgrid {
border: none;
}
.calcite-panels {
z-index: 31;
}
.calcite-panels.calcite-panels-table {
position: absolute;
bottom: 0;
top: auto;
left: 0;
right: 0;
z-index: 30;
}
#panelTable {
margin-bottom: 0;
}
#panelTable .panel-body {
height: 800px;
width: 100%;
}
</style>
</head>
<body class="esri claro calcite calcite-nav-top">
<!-- Navbar -->
<nav class="navbar calcite-navbar navbar-fixed-top calcite-text-light calcite-bg-custom calcite-bgcolor-dark-blue">
<!-- Menu -->
<div class="dropdown calcite-dropdown calcite-bg-light calcite-text-dark" role="presentation">
<a class="dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false">
<div class="calcite-dropdown-toggle">
<span class="sr-only">Toggle dropdown menu</span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</a>
<ul class="dropdown-menu">
<li>
<a class="visible-xs" role="button" data-target="#panelSearch" aria-haspopup="true">
<span class="glyphicon glyphicon-search"></span> Search</a>
</li>
<li>
<a role="menuitem" data-target="#panelLegend" aria-haspopup="true">
<span class="glyphicon glyphicon-list-alt"></span> Legend
</a>
</li>
<li>
<a role="button" data-target="#panelBasemaps" aria-haspopup="true">
<span class="glyphicon glyphicon-th-large"></span> Basemaps</a>
</li>
<li>
<a role="button" data-target="#panelTable" data-toggle="collapse" aria-haspopup="true">
<span class="glyphicon glyphicon-list"></span> Table</a>
</li>
<li>
<a role="button" id="calciteToggleNavbar" aria-haspopup="true">
<span class="glyphicon glyphicon-fullscreen"></span> Full Map</a>
</li>
</ul>
</div>
<!-- Title -->
<div class="calcite-title calcite-overflow-hidden">
<span class="calcite-title-main hidden-xs">My Map App</span>
</div>
<!-- Nav -->
<ul class="calcite-nav nav navbar-nav">
<li>
<div class="calcite-navbar-search hidden-xs">
<div id="searchNavDiv"></div>
</div>
</li>
</ul>
</nav>
<!--/.navbar -->
<!-- Map Container -->
<div class="calcite-map">
<div id="map" class="calcite-map-absolute">
</div>
</div>
<!-- /.container -->
<!-- Panel -->
<div class="calcite-panels calcite-panels-right calcite-bg-light calcite-text-dark panel-group" role="tablist" aria-multiselectable="true">
<div id="panelSearch" class="panel collapse hidden-sm hidden-md hidden-lg">
<div id="headingSearch" class="panel-heading" role="tab">
<div class="panel-title">
<a class="panel-toggle collapsed" role="button" data-toggle="collapse" href="#collapseSearch" aria-expanded="false" aria-controls="collapseSearch">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
<span class="panel-label">Search</span>
</a>
<a class="panel-close" role="button" data-toggle="collapse" data-target="#panelSearch">
<span class="esri-icon esri-icon-close" aria-hidden="true"></span>
</a>
</div>
</div>
<div id="collapseSearch" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSearch">
<div class="panel-body calcite-body-expander">
<div id="searchPanelDiv"></div>
</div>
</div>
</div>
<!-- Legend -->
<div id="panelLegend" class="panel collapse">
<div id="headingLegend" class="panel-heading" role="tab">
<div class="panel-title">
<a class="panel-toggle collapsed" role="button" data-toggle="collapse" href="#collapseLegend" aria-expanded="false" aria-controls="collapseLegend">
<span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span>
<span class="panel-label">Legend</span>
</a>
<a class="panel-close" role="button" data-toggle="collapse" tabindex="0" href="#panelLegend">
<span class="esri-icon esri-icon-close" aria-hidden="true"></span>
</a>
</div>
</div>
<div id="collapseLegend" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingLegend">
<div class="panel-body body-light">
<div id="legend" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'">
<div data-dojo-type="dijit/layout/ContentPane">
<div id="legendDiv"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Basemaps Panel -->
<div id="panelBasemaps" class="panel collapse">
<div id="headingBasemaps" class="panel-heading" role="tab">
<div class="panel-title">
<a class="panel-toggle collapsed" role="button" data-toggle="collapse" href="#collapseBasemaps" aria-expanded="false" aria-controls="collapseBasemaps">
<span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>
<span class="panel-label">Basemaps</span>
</a>
<a class="panel-close" role="button" data-toggle="collapse" tabindex="0" href="#panelBasemaps">
<span class="esri-icon esri-icon-close" aria-hidden="true"></span>
</a>
</div>
</div>
<div id="collapseBasemaps" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingBasemaps">
<div class="panel-body">
<select id="selectBasemapPanel" class="form-control">
<option value="streets" data-vector="vector-streets">Streets</option>
<option value="satellite" data-vector="satellite">Satellite</option>
<option value="hybrid" data-vector="hybrid">Hybrid</option>
<option value="national-geographic" data-vector="national-geographic">National Geographic</option>
<option value="topo" data-vector="vector-streets-relief">Topographic</option>
<option value="gray" data-vector="vector-canvas-light">Gray</option>
<option value="dark-gray" data-vector="vector-canvas-dark">Dark Gray</option>
<option value="osm" data-vector="osm">Open Street Map</option>
<option value="dark-gray" data-vector="vector-streets-night">Streets Night</option>
<option value="streets" data-vector="vector-streets-mobile">Streets Mobile</option>
</select>
</div>
</div>
</div>
</div>
<!-- /.calcite-panels -->
<!--table-->
<div class="calcite-panels calcite-panels-table calcite-bg-light calcite-text-dark">
<div id="panelTable" class="panel collapse in">
<div id="headingInfo" class="panel-heading" role="tab">
<div class="panel-title">
<a class="panel-toggle" role="button" data-toggle="collapse" href="#collapseTable" data-parent="#panelAccordion" aria-expanded="true"
aria-controls="collapseInfo">
<span class="glyphicon glyphicon-list" aria-hidden="true"></span> Table</a>
<a class="panel-close" role="button" data-toggle="collapse" data-target="#panelTable">
<span class="esri-icon esri-icon-close" aria-hidden="true"></span>
</a>
</div>
</div>
<div id="collapseTable" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingInfo">
<div id="container" class="panel-body">
<div id="grid"></div>
</div>
</div>
</div>
</div>
<!-- /.calcite-panels -->
<script type="text/javascript">
var dojoConfig = {
packages: [{
name: "bootstrap",
location: "https://esri.github.io/calcite-maps/dist/vendor/dojo-bootstrap"
},
{
name: "calcite-maps",
location: "https://esri.github.io/calcite-maps/dist/js/dojo"
}]
};
</script>
<!-- ArcGIS JS 3.x -->
<script src="https://js.arcgis.com/3.24/"></script>
<script>
var map, searchWidgetNav, searchWidgetPanel, activeView;
require([
"dojo/ready",
"esri/map",
"esri/layers/FeatureLayer",
"esri/dijit/FeatureTable",
"esri/tasks/QueryTask",
"esri/tasks/FindTask",
"esri/tasks/FindParameters",
"esri/tasks/query",
"esri/InfoTemplate",
"esri/dijit/Search",
"dojo/_base/Color",
"dojo/query",
"dojo/dom",
"dijit/registry",
"dojo/_base/array",
"dojo/_base/connect",
"dojox/grid/DataGrid",
"dojo/data/ItemFileReadStore",
"dijit/form/Button",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dgrid/OnDemandGrid",
"dgrid/Selection",
"dojo/_base/declare",
"esri/symbols/SimpleFillSymbol",
"dojo/store/Memory",
"dojo/dom-style",
"dgrid/_StoreMixin",
"esri/dijit/Legend",
// OAuth
"esri/arcgis/Portal",
"esri/arcgis/OAuthInfo",
"esri/IdentityManager",
"dojo/on",
"dojo/parser",
// Bootstrap
"bootstrap/Collapse",
"bootstrap/Dropdown",
"bootstrap/Tab",
// Calcite Maps
"calcite-maps/calcitemaps",
// "dojo/domReady!"
], function (ready, Map, FeatureLayer, FeatureTable, QueryTask, FindTask, FindParameters, Query, InfoTemplate, Search, Color, query, dom, registry, array, connect, DataGrid, ItemFileReadStore, Button, BorderContainer, ContentPane, Grid, Selection, declare, SimpleFillSymbol, Memory, domStyle, StoreMixin, Legend, arcgisPortal, OAuthInfo, esriID, on, parser) {
ready(function () {
var info = new OAuthInfo({
appId: //appid
portalUrl: //portal.com
popup: false
});
esriID.registerOAuthInfos([info]);
parser.parse();
window.grid = new (declare([Grid, Selection]))({
bufferRows: Infinity,
columns: {
// Columns go here
},
selectionMode: "single",
sortable: true
}, "grid");
function formatTimestamp(value) {
var inputDate = new Date(value);
return dojo.date.locale.format(inputDate, {
selector: 'date',
datePattern: 'MM/dd/yyyy'
});
}
var map = new Map("map", {
basemap: "streets",
center: [-103, 32],
zoom: 9,
showLabels: true
});
// Search
searchDivNav = createSearchWidget("searchNavDiv");
searchWidgetPanel = createSearchWidget("searchPanelDiv");
function createSearchWidget(parentId) {
var search = new Search({
map: map,
enableHighlight: false
}, parentId);
search.startup();
return search;
};
// Basemaps
query("#selectBasemapPanel").on("change", function (e) {
map.setBasemap(e.target.options[e.target.selectedIndex].value);
});
// FL 1
// FL 2
//FL 3
map.on("load", function (evt) {
// show the border container now that the dijits
// are rendered and the map has loaded
domStyle.set(registry.byId("legend").domNode, "visibility", "visible");
populateGrid(Memory); // pass a reference to the MemoryStore constructor
});
map.on("layers-add-result", function (evt) {
var layerInfo = array.map(evt.layers, function (layer, index) {
return { layer: layer.layer, title: layer.layer.name };
});
if (layerInfo.length > 0) {
var legendDijit = new Legend({
map: map,
layerInfos: layerInfo
}, "legendDiv");
legendDijit.startup();
}
});
map.addLayers([FL1, FL2, FL3]);
function populateGrid(Memory) {
var qt = new QueryTask(FL1.url);
var query = new Query();
query.where = "1=1";
query.returnGeometry = false;
query.outFields = window.outFields;
qt.execute(query, function (results) {
var data = array.map(results.features, function (feature) {
return {
// property names used here match those used when creating the dgrid
};
});
// grid.set("columns", generateColumns(results.fields));
var memStore = new Memory({ data: data, "idProperty": "col_1" });
window.grid.set("store", memStore);
});
}
//Returns Columns object for dgrid store
function generateColumns(fields) {
var columns = [];
fields.forEach(function (field) {
var objects = {};
objects.label = field.alias;
objects.field = field.name;
columns.push(objects);
});
return columns;
}
function showDefaultPanels() {
query(".calcite-panels-table").addClass("hidden");
query(".calcite-panels:not(.calcite-panels-table)").removeClass("hidden");
}
function showTablePanel() {
query(".calcite-panels-table").removeClass("hidden");
query(".calcite-panels:not(.calcite-panels-table)").addClass("hidden");
}
function showAllPanels() {
query(".calcite-panels-table").removeClass("hidden");
query(".calcite-panels:not(.calcite-panels-table)").removeClass("hidden");
}
// Default panels
query(".calcite-panels .panel:not(#panelTable)").on("show.bs.collapse", function (e) {
if (window.innerWidth <= breakpoint) {
showDefaultPanels();
} else {
showAllPanels();
}
});
// Table panel
query(".calcite-panels-table .panel").on("show.bs.collapse", function (e) {
if (window.innerWidth <= breakpoint) {
showTablePanel();
} else {
showAllPanels();
}
});
// Responsive
var breakpoint = 768;
var isMobile = window.innerWidth <= breakpoint;
query(window).on("resize", function (e) {
if (e.target.innerWidth <= breakpoint && !isMobile) {
isMobile = true;
showTablePanel();
}
if (e.target.innerWidth > breakpoint && isMobile) {
isMobile = false;
showAllPanels();
}
}.bind(this));
});
})
</script>
</body>
</html>
... View more
05-03-2018
06:01 AM
|
0
|
2
|
1397
|
POST
|
Thanks for the link to your blog post! That is exactly what I was looking for. I appreciate you taking the time to explain this.
... View more
11-23-2016
05:15 AM
|
0
|
0
|
800
|
POST
|
Hi Richard, I am relatively new to Python and search cursors. Can you explain what the value dictionary does? Thanks in advance! Judson
... View more
11-22-2016
01:51 PM
|
0
|
2
|
800
|
POST
|
Hello all,
I am relatively new to programming and software development but thought this is the place to ask. I am currently developing a small app for internal use at my company and am stuck on Leaflet Authentication to access subscriber content (a layer from ArcGIS Online). My company has a GIS personnel login for AGOL that I would like to enter into my JavaScript code so that anytime someone opens the app, it is already signed in. I am a total newb to JavaScript (this is the first time I have ever used it) but it sort of makes sense.
Can anyone provide me with a snippet of code that I can type the login information into so that it will log in upon launch?
Thanks for the help!
... View more
06-23-2016
06:53 AM
|
0
|
2
|
4954
|
POST
|
I figured it out. The unicode the error was referring to was the variable names (D,H,M). Instead of defining the variables ahead of time, I inserted the GetParamterAsText(x) into the corresponding argument in the timedelta expression. # Calculate new time in new field
xp = 'arcpy.time.ParseDateTimeString(!TIME!) + datetime.timedelta(days=int(arcpy.GetParameterAsText(2)), hours=int(arcpy.GetParameterAsText(3)), minutes=int(arcpy.GetParameterAsText(4)))'
... View more
05-11-2016
08:29 AM
|
1
|
0
|
940
|
POST
|
Thanks for the replies Dan. While this eliminated the original error, I am now getting the following: exp = "arcpy.time.ParseDateTimeString(!DATETIME!)" + str(datetime.timedelta(days=D, hours=H, minutes=M)) TypeError: unsupported type for timedelta minutes component: unicode I did a quick scour of Google and could not find anything of use. Any idea why unicode text would throw it off?
... View more
05-11-2016
05:48 AM
|
0
|
0
|
940
|
POST
|
Hello All, I am working on creating a tool that will add or subtract time to a text field in a feature class. My thought process is that I will take the original feature class with text field "DATETIME", make a copy of the original feature class (extra step to preserve source data), add a field titled "TIME", and run a field calculator expression with user designated values in the calculator expression. import arcpy as ap
import os
# Script Arguments
input_fc = ap.GetParameterAsText(0)
output_fc = ap.GetParameterAsText(1)
D = ap.GetParameterAsText(2)
H = ap.GetParameterAsText(3)
M = ap.GetParameterAsText(4)
# Create copy of input trajectory
ap.CopyFeatures_management(input_fc, output_fc)
# Create new field
ap.AddField_management(output_fc,"TIME", "TEXT", 50 )
# Calculate new time in new field
exp = 'arcpy.time.ParseDateTimeString(!DATETIME!) + datetime.timedelta(days=D, hours=H, minutes=M)'
ap.CalculateField_management(output_fc, "TIME", exp, "PYTHON_9.3" )
# Copy new time to DATETIME field
ap.CalculateField_management(output_fc, "DATETIME", "!TIME!", "PYTHON_9.3") I encounter the following error: ExecuteError: ERROR 000539: Error running expression: arcpy.time.ParseDateTimeString(u"4/28/2016 2:45:00 AM") + datetime.timedelta(days=D, hours=H, minutes=M) Traceback (most recent call last): File "<expression>", line 1, in <module> NameError: name 'D' is not defined What gives? I know that the entire workflow process works when I do all of the steps manually but I think the "GetParamterAsText" is what is throwing me off. I am still relatively new to Python and Tool Building so its probably something pretty obvious. Thanks in advance for the help!
... View more
05-10-2016
02:11 PM
|
0
|
4
|
2712
|
POST
|
A combination of all of this above made this work. Thanks for all the help! See code below for final code: fields = ["Type", "Phone", "Address", "Lat", "Long"]
addfield = partial(ap.AddField_management, feature, field_type = "STRING", field_length = 150)
print("Adding Fields...")
for field in fields:
addfield(field)
print("Fields Added.")
with ap.da.UpdateCursor(feature, ["PopupInfo", "Type", "Phone", "Address", "Lat", "Long"]) as cursor:
for row in cursor:
try:
row[1] = ((row[0].replace('<br>','|')).replace('</br>', '|')).split('|')[0]
row[2] = ((row[0].replace('<br>','|')).replace('</br>', '|')).split('|')[1]
row[3] = ((row[0].replace('<br>','|')).replace('</br>', '|')).split('|')[2]
row[4] = ((row[0].replace('<br>','|')).replace('</br>', '|')).split('|')[3]
row[5] = ((row[0].replace('<br>','|')).replace('</br>', '|')).split('|')[4]
cursor.updateRow(row)
except IndexError as iErr:
print"Error processing: {}\n{}.".format(row[0], iErr)
pass
This left me with 4 of the original 55 records as null due to those 4 records having only two instances of '<br>' in them.
... View more
03-03-2016
02:32 PM
|
0
|
0
|
1153
|
POST
|
I tried your code block and it returned every record. There are a couple of records that have only 2 or 3 instances of '<br>' in them... I'm still a bit new to python and arcpy so can you clarify how to "print row[0]" to find out where the error is? I tried replacing the cursor.updateRow(row) with print row[0] and it returned the same record as before. Thanks for the help!
... View more
03-03-2016
01:59 PM
|
0
|
0
|
1153
|
POST
|
Jake, I used the following code however, it return with the following error. import arcpy
ap.env.workspace = "...\\path\\to\\gdb"
with arcpy.da.UpdateCursor('Places', ["PopupInfo", "Type", "Phone", "Address", "Lat", "Long"]) as cursor:
for row in cursor:
row[1] = row[0].split('<br>')[0]
row[2] = row[0].split('<br>')[1]
row[3] = row[0].split('<br>')[2]
row[4] = row[0].split('<br>')[3]
row[5] = row[0].split('<br>')[4]
cursor.updateRow(row) row[5] = row[0].split('<br>')[4] IndexError: list index out of range. I think this is caused by gaps in my data. I looked to make sure it was all the same format but it looks like it is not so I think I need to do a while loop to skip over the bad records in the table but am not sure how to accomplish that. Any suggestions?
... View more
03-03-2016
01:34 PM
|
0
|
2
|
1153
|
POST
|
I am working on creating a script that can be used when converting KMZ files to a feature class. I have that part down and am now getting rid of extraneous columns and cleaning up the data. The issue is that when the KMZ is imported, the "PopupInfo" field contains "<br>" and "</br>" characters separating things like type of site, phone number, address, and lat/long. Ex: Education<br>(123) 456-7890</br><br>12345 Road Name Rd., City, ST 12345<br>Location:DD.DDDDDN, DD.DDDDDW I was trying to think of a way to split the text out into respective columns (type, phone, address, Lat, Long) but for the life of me cannot figure out how to split this in an efficient way. In field calculator I have tried: !PopupInfo!.split('<br>')[0] and successfully brought over the type but have no idea how to do it with the phone number and addresses. Is there anyway to split text based on multiple delimiters or can anyone suggest an efficient way to do this? Thanks in advance!
... View more
03-03-2016
12:27 PM
|
0
|
6
|
3050
|
POST
|
Thanks for the help! I was thinking too much about it...simple solution.
... View more
01-18-2016
10:55 AM
|
0
|
0
|
757
|
Title | Kudos | Posted |
---|---|---|
1 | 05-11-2016 08:29 AM | |
1 | 05-04-2018 05:19 AM | |
1 | 05-04-2018 05:20 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|