|
POST
|
The Flex Builder app has a widget to add Google Street View to Esri maps. How would I do that in the JavaScript API?
... View more
12-17-2014
09:02 AM
|
0
|
7
|
7715
|
|
POST
|
I added two new layers, activeWeedCases and activeCases and they do not draw correctly. One layer appears to be missing until you move the map some. And both layers cover the lBaseLayer that has the address number on them even though I added that layer last. Is something wrong with my code?
/// <reference path="esri-leaflet.min.js" />
/// <reference path="leaflet.js" />
/// <reference path="jquery-1.9.1.js" />
/// <reference path="jquery-ui-1.10.3.custom.min.js" />
/// <reference path="jquery.greybox2.js" />
/// <reference path="jquery.ui.touch-punch.js" />
// If JavaScript appears not to run, a line of code may not work properly
var map = L.map('mapSection').setView([39.861, -88.951], 13);
//ADD LEAFLET.USERMARKER PLUGIN
var marker = null;
map.on("locationfound", function (location) {
if (!marker)
marker = L.userMarker(location.latlng, { pulsing: true }).addTo(map);
marker.setLatLng(location.latlng);
marker.setAccuracy(location.accuracy);
});
map.locate({
watch: false, //This makes the locator move as the user changes location. Set to false to disable.
locate: true, // Set to true to locate the current location of the user
setView: true,
maxZoom: 20,
minZoom: 18,
enableHighAccuracy: true,
inertia: true
});
//END LEAFLET.USERMARKER PLUGIN
// Esri Image Layer
var imageLayer = L.esri.basemapLayer("Imagery");
//// Address Points, Streets, and Corporate Boundary
var lBaseLayer = L.esri.dynamicMapLayer("http://maps.decaturil.gov/arcgis/rest/services/Base/MapServer");
// Parcel Layer identified in the application - only Municipal parcels are available in this web service
var parcels = L.esri.dynamicMapLayer("http://maps.decaturil.gov/arcgis/rest/services/Parcels/MapServer");
// Parcels with no PINs
//var missingPins = L.esri.dynamicMapLayer("http://maps.decaturil.gov/arcgis/rest/services/MissingAddressCodes/MapServer");
var activeCases = L.esri.dynamicMapLayer("http://maps.decaturil.gov/arcgis/rest/services/Internal/activececases/MapServer");
var activeWeedCases = L.esri.dynamicMapLayer("http://maps.decaturil.gov/arcgis/rest/services/Internal/ActiveWeedCases/MapServer");
// Add featureLayer for drawing
var parcelsF = L.esri.featureLayer("http://maps.decaturil.gov/arcgis/rest/services/Parcels/MapServer/0", {
where: '1=0',
style: function (feature) {
// My color came from here: http://www.colorhexa.com/70ca49
return { color: "#f5f505", weight: 5 };
},
onEachFeature: function (feature, layer) {
//layer.bindPopup(L.Util.template(template, feature.properties));
}
}).addTo(map);
map.addLayer(imageLayer);
// I want to highlight the select parcel when I click on this layer
map.addLayer(activeWeedCases);
map.addLayer(activeCases);
map.addLayer(parcels);
map.addLayer(lBaseLayer);
//map.addLayer(missingPins);
// This is Esri JSAPI code; the first line determines how to get the name of the layer and the second is acquire the quantity of layers
//alert(dynamicMapServiceLayer.layerInfos[5].name);
//alert((dynamicMapServiceLayer.visibleLayers.length) + 1);
// Identify Dynamic Map Features
map.on("click", function (e) {
parcels.identify(e.latlng, function (data) {
jQuery("#sideBarContent").accordion("option", "active", 0);
//alert(data.results[0].layerName); //This will identify a layer name in leaflet
document.forms["frmMap"].elements["txtPin"].value = data.results[0].attributes.PIN;
document.forms["frmMap"].elements["txtAddress"].value = data.results[0].attributes.SITEADDRESS;
document.forms["frmMap"].elements["txtPrimaryName"].value = data.results[0].attributes.PRIMARYNAME;
document.forms["frmMap"].elements["txtPrimaryAddress"].value = data.results[0].attributes.PRIMARYADDRESS;
document.forms["frmMap"].elements["txtLegalDescription"].value = data.results[0].attributes.LEGALDESCRIPTION;
document.getElementById("btnStartCase").disabled = false;
document.getElementById("lblCaseCreated").innerHTML = '';
document.getElementById("btnCreateCase").disabled = true;
// returns an array of results, just grab the first one
var result = data.results[0];
console.debug(data, result);
if (result) {
var parcelnum = result.attributes.PARCELNUMBER;
highlightLayer(parcelnum);
}
});
});
/* Enables Sidebar to be draggable */
jQuery(function () {
jQuery("#sideBar").draggable();
});
/* The accordion allows sections to expand/collapse which show or hide each section */
jQuery(function () {
jQuery("#sideBarTitle").accordion({
collapsible: true,
heightStyle: "content"
});
});
jQuery(function () {
jQuery("#sideBarContent").accordion({
heightStyle: "content"
});
});
// Expands/collapses the Ask for Assistance Note: Setting active to false collapses section. Setting heightStyle to Content autosizes the height
jQuery(function () {
jQuery("#footerTitle").accordion({
collapsible: true,
heightStyle: "content",
active: false
});
});
// Opens the greybox for the help page
jQuery(document).ready(function () {
var gbOptions = {
gbWidth: 600,
gbHeight: 500,
captionHeight: 22,
ffMacFlash: true
};
jQuery('#lnkHelp').greybox(gbOptions);
});
// Set active section of sidebar
// http://api.jqueryui.com/accordion/ - how to activate a certain panel in the accordion
function showAddCase() {
jQuery("#sideBarContent").accordion("option", "active", 1);
}
// Set layer to be highlighted
function highlightLayer(value) {
console.debug('highlight', value);
parcelsF.setWhere("PARCELNUMBER = '" + value + "'");
}
... View more
12-12-2014
02:40 PM
|
0
|
0
|
1662
|
|
POST
|
I receive a: Tried to register widget with id==tocDiv but that id is already registered I removed the comments from the geometry declaration as well as the proxy and the TOC loads with the duplicate layers, but you can not turn them off on the map. If you refresh the map, the layers are removed from the TOC, and then you can remove the layer from the map.
... View more
12-10-2014
01:36 PM
|
0
|
0
|
977
|
|
POST
|
I haven't heard anything on that, but based on that it uses a plug-in like Flex, I'm not optimistic. My instructor in JavaScript training stated that Esri is trying to get away from plug-ins, but that could have been an offhand comment too. Based on last years DevSummit, you would have thought support for both had stopped as the lion's share of the sessions were JS API or mobile and of course AGS Online. But the best I can say on Silverlight is I really don't know.
... View more
12-10-2014
09:12 AM
|
0
|
0
|
1652
|
|
POST
|
Esri stated that they will support the JS API. But, I was also told that I need to move away from Legacy JS API and program in AMD JS API, more because of Dojo than Esri, but support is supposed to discontinue next year with Legacy JS API and Esri will continue to support AMD JS API. Both Flex information and JS API information I received from support calls, but I was basically warned on both to get them changed soon. With that, there has been no official announcement from Esri. If you are not familiar with this API or for anyone that reads this thread, the JS API that will receive ongoing support is here: ArcGIS API for JavaScript
... View more
12-10-2014
09:00 AM
|
0
|
2
|
1652
|
|
POST
|
Here is the URL if you want to see the app live: maps.decaturil.gov/decaturToc I modified my code like so and, it is still not working correctly: <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/soria/soria.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <link href="agsjs/dijit/css/TOC.css" rel="stylesheet" type="text/css" /> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; width:100%; overflow:hidden; } #tocDiv { z-index:50; position:absolute; top:0%; left:0%; width:300px; height:auto; background-color:White; } #scaleDiv .agsjsTOCOutOfScale { display:none; } #divDialogProcess { z-index:50; position:absolute; right:0%; top:0%; background-color:White; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script src="agsjs/dijit/TOC.js" type="text/javascript"></script> <script> var map; require(["esri/map", "esri/config", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/FeatureLayer", "esri/renderers/ClassBreaksRenderer", "esri/symbols/SimpleFillSymbol", "esri/tasks/GeometryService", "dojo/dom", "dojo/dom-geometry", "dojo/fx", "dojo/on", "dojo/parser", "dojo/_base/Color", "agsjs/dijit/TOC", "dojo/domReady!"], function (Map, esriConfig, Extent, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, FeatureLayer, ClassBreaksRenderer, SimpleFillSymbol, GeometryService, dom, domGeom, coreFx, on, parser, Color, TOC ) { /* The proxy comes before all references to web services */ /* Files required for security are proxy.config, web.config and proxy.ashx - set security in Manager to Private, available to selected users and select Allow access to all users who are logged in (Roles are not required) /* The proxy section is defined on the ESRI sample. I have included it as part of the documentation reads that the measuring will not work. I thought that might be important. */ // Proxy Definition Begin //identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters. //If this null or not available the project and lengths operation will not work. // Otherwise it will do a http post to the proxy. esriConfig.defaults.io.proxyUrl = "proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = true; // Proxy Definition End // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435 } }); // create map and set slider style to small map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent, logo: false }); // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); // add point feature layer var pointFeatureLayer = new FeatureLayer("http://maps.decaturil.gov/arcgis/rest/services/Test/FeatureServer/0"); map.addLayer(pointFeatureLayer); // declare geometry service esriConfig.defaults.geometryService = new GeometryService("http://maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer"); // Add Table of Contents Start map.on('layer-add-result', function (evt) { try { var toc = new TOC({ map: map, layerInfos: [{ layer: pointFeatureLayer, title: "My Feature" }, { layer: operationalLayer, title: "Dynamic Map" }, { layer: tiled, title: "Imagery" }] }, "tocDiv"); toc.startup(); toc.on("load", function () { divDialogProcess.innerHTML = "Initializing the Table of Contents' legends, please be patient..."; for (var k = 0; k < layerInfo.length; k++) { var layer = layerInfo .layer; var layersArray = layerInfo .layerList; if (layersArray !== null) { var dynamicLayerInfos = layer.createDynamicLayerInfosFromLayerInfos(); for (var j = 0; j < dynamicLayerInfos.length; j++) { toc.findTOCNode(layer, dynamicLayerInfos .id).hide(); for (var i = 0; i < layersArray.length; i++) { if (dynamicLayerInfos .id === layersArray) { //var test = toc.findTOCNode(layer, dynamicLayerInfos .id); toc.findTOCNode(layer, dynamicLayerInfos .id).show(); } } } } } domStyle.set(dom.byId("divDialogProcess"), "display", "none"); var test = registry.byId("buttonClose") domStyle.set(registry.byId("buttonClose").domNode, "display", "block"); initializing = false; }); } catch (e) { console.error(e.message); } }); } ); </script> </head> <body class="soria"> <div id="mapDiv"> <div id="tocDiv"></div> </div> <div id="divDialogProcess"> <button id="buttonClose" title="Close"></button> </div> </body> </html>
... View more
12-10-2014
08:49 AM
|
0
|
2
|
977
|
|
POST
|
Just an FYI. During an Esri support ticket, we had an issue that was not resolved and were told that Flex will no longer be supported in 2015.
... View more
12-10-2014
08:47 AM
|
0
|
5
|
1652
|
|
POST
|
I have placed a ticket in on this one as this widget works when referencing 3.10, but not 3.11.
... View more
12-10-2014
06:32 AM
|
0
|
0
|
504
|
|
POST
|
I was trying to get moveable to work with dojo so I could drag the editor widget, but this made it so I could not use the editor widget. I instead used jQuery punch and was able to allow the editor widget to drag. Mystery solved.
... View more
12-09-2014
01:54 PM
|
0
|
0
|
450
|
|
POST
|
I want to be able to touch on the editor template chooser and then touch on an iPad to create a new point to edit. Is there a way to do this with this widget on an iPad? Here is my current code that works on a pc: <!DOCTYPE html> <html> <head> <title>Decatur Graphics Editor</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/soria/soria.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; width:100%; position:absolute; z-index:0; } /* Editor style begin */ #templatePickerPane { width: 250px; height:260px; overflow: hidden; z-index:50; top:50%; right:0%; position:absolute; } #panelHeader { background-color: #92A661; border-bottom: solid 1px #92A860; color: #FFF; font-size: 18px; height: 50px; line-height: 22px; margin: 0; overflow: hidden; padding: 10px 10px 10px 10px; } #editorDiv { background-color:White; padding:10px; } .esriEditor .templatePicker { padding-bottom: 5px; padding-top: 5px; height: 120px; border-radius: 0px 0px 4px 4px; border: solid 1px #92A661; } .dj_ie .infowindow .window .top .right .user .content, .dj_ie .simpleInfoWindow .content { position: relative; } /* Editor Style End */ #closeEditor { position:absolute; right:5%; } #editor { height:20px; width:20px; position:absolute; top:285px; left:20px; z-index:50; padding: 5px 6px 6px 6px; background-color:#f9f8f8; border-radius:5px; visibility:visible; } </style> <script src="http://js.arcgis.com/3.11/" type="text/javascript"></script> <script type="text/javascript"> var map; require(["esri/map", "esri/config", "esri/geometry/Extent", "esri/dijit/editing/Editor", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/FeatureLayer", "esri/SnappingManager", "esri/tasks/GeometryService", "esri/toolbars/draw", "dojo/dom", "dojo/keys", "dojo/on", "dojo/parser", "dojo/_base/array", "dojo/i18n!esri/nls/jsapi", "dojo/dnd/Moveable", "dojo/domReady!"], function (Map, esriConfig, Extent, Editor, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, FeatureLayer, SnappingManager, GeometryService, Draw, dom, keys, on, parser, arrayUtils, i18n, Moveable ) { parser.parse(); //snapping is enabled for this sample - change the tooltip to reflect this i18n.toolbars.draw.start += "<br/>Press <b>CTRL</b> to enable snapping"; i18n.toolbars.draw.addPoint += "<br/>Press <b>CTRL</b> to enable snapping"; /* The proxy comes before all references to web services */ /* Files required for security are proxy.config, web.config and proxy.ashx - set security in Manager to Private, available to selected users and select Allow access to all users who are logged in (Roles are not required) /* The proxy section is defined on the ESRI sample. I have included it as part of the documentation reads that the measuring will not work. I thought that might be important. */ // Proxy Definition Begin //identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters. //If this null or not available the project and lengths operation will not work. // Otherwise it will do a http post to the proxy. esriConfig.defaults.io.proxyUrl = "proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = true; // Proxy Definition End // declare geometry service esriConfig.defaults.geometryService = new GeometryService("http://maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer"); // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435 } }); // create map and set slider style to small map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent, logo:false }); // Starts initEditing after the feature layer(s) have been added map.on("layers-add-result", initEditing); // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); // add point feature layer for editing var pointFeatureLayer = new FeatureLayer("http://maps.decaturil.gov/arcgis/rest/services/Test/FeatureServer/0", { mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"] }); map.addLayers([pointFeatureLayer]); // sizes the edit window map.infoWindow.resize(400, 300); // settings for the editor widget function initEditing(event) { var featureLayerInfos = arrayUtils.map(event.layers, function (layer) { return { "featureLayer": layer.layer }; }); var settings = { map: map, layerInfos: featureLayerInfos, toolbarVisible:true, enableUndoRedo :true, maxUndoOperations:20 }; var params = { settings: settings }; var editorWidget = new Editor(params, 'editorDiv'); editorWidget.startup(); var options = { snapKey: keys.copyKey }; map.enableSnapping(options); } // Allow editor to move with mouse on(Moveable(dom.byId("templatePickerPane")), "onmousedown", function () { var dnd = new Moveable(dom.byId("templatePickerPane")); }); // Hide editor on(dom.byId("closeEditor"), "click", function () { document.getElementById("templatePickerPane").style.visibility = 'hidden'; }); // Show Editor on(dom.byId("showEditorWidget"), "click", function () { document.getElementById("templatePickerPane").style.visibility = 'visible'; }); } ); </script> </head> <body class="soria"> <div id="mapDiv"> <div id="editor"> <input type="image" id="showEditorWidget" src="images/edit.ico" alt="Editor" title="Editor" /> </div> </div> <div id="templatePickerPane"> <div id="panelHeader"> <p>Default Editor <input type="image" id="closeEditor" src="images/close.ico" alt="Close Editor" title="Close Editor" /></p> </div> <div id="editorDiv"> </div> </div> </body> </html>
... View more
12-08-2014
09:09 AM
|
0
|
1
|
1635
|
|
POST
|
Upon initial click I will receive the latitude and longitude using the point on my measurement widget. After that the latitude and longitude won't update. Any ideas why? Here is my code: <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/soria/soria.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; width:100%; } #titlePane { width:240px; position:absolute; left:20px; bottom:10px; z-index:999; } .soria .dijitTitlePaneTitle { background: #fff; font-weight:600; border: none; border-bottom:solid 1px #29201A; border-top:solid 1px #29201A; } .soria .dijitTitlePaneTitleHover { background:#eee; } .soria .dijitTitlePaneTitleActive { background:#808775; } .soria .dijitTitlePaneContentOuter { border-right: none; border-bottom: none; border-left: none; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/config", "dojo/parser", "esri/renderers/SimpleRenderer", "esri/Color", "esri/dijit/Measurement", "esri/dijit/Scalebar", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/LayerDrawingOptions", "esri/SnappingManager", "esri/sniff", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/tasks/GeometryService", "dojo/dom", "dojo/keys", "dojo/on", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/TitlePane", "dijit/form/CheckBox", "dojo/domReady!"], function (Map, esriConfig, parser, SimpleRenderer, Color, Measurement, Scalebar, Extent, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, LayerDrawingOptions, SnappingManager, has, SimpleFillSymbol, SimpleLineSymbol, GeometryService, dom, keys, on ) { parser.parse(); // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435 } }); // create map and set slider style to small map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent, logo:false }); // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); // declare geometry service esriConfig.defaults.geometryService = new GeometryService("http://maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer"); // start measurement tool - the current layer we are measuring is the operational layer var layerDrawingOptions = []; var layerDrawingOption = new LayerDrawingOptions(); var sfs = new SimpleFillSymbol( "solid", new SimpleLineSymbol("solid", new Color([195, 176, 23]), 2), null ); layerDrawingOption.renderer = new SimpleRenderer(sfs); // change 1 to the layer index that you want to modify: layerDrawingOptions[1] = layerDrawingOption; //dojo.keys.copyKey maps to CTRL on windows and Cmd on Mac., but has wrong code for Chrome on Mac var snapManager = map.enableSnapping({ snapKey: has("mac") ? keys.META : keys.CTRL }); var layerInfos = [{ layer: operationalLayer }]; snapManager.setLayerInfos(layerInfos); var measurement = new Measurement({ map: map }, dom.byId("measurementDiv")); measurement.startup(); // end measurement tool } ); </script> </head> <body class="soria"> <div id="mapDiv"></div> <div id="titlePane" data-dojo-type="dijit/TitlePane" data-dojo-props="title:' Measurement', closeable:false,open:false"> <div id="measurementDiv"></div> <span style="font-size:smaller;padding:5px 5px;">Press <b>CTRL</b> to enable snapping.</span> </div> </body> </html>
... View more
12-08-2014
09:03 AM
|
0
|
1
|
1643
|
|
POST
|
I did try it on the left, but the ExpandoPane would allow me to place it on the right where I want it. Thanks.
... View more
12-08-2014
08:54 AM
|
0
|
0
|
908
|
|
POST
|
@@@Sometimes my table of contents displays and sometimes it does not; why is this? <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/soria/soria.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <link href="agsjs/dijit/css/TOC.css" rel="stylesheet" type="text/css" /> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; width:100%; overflow:hidden; } #tocDiv { z-index:50; position:absolute; top:0%; left:0%; width:300px; height:auto; background-color:White; } #scaleDiv .agsjsTOCOutOfScale { display:none; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script src="agsjs/dijit/TOC.js" type="text/javascript"></script> <script> var map; require(["esri/map", "esri/config", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/FeatureLayer", "esri/renderers/ClassBreaksRenderer", "esri/symbols/SimpleFillSymbol", "esri/tasks/GeometryService", "dojo/dom", "dojo/dom-geometry", "dojo/fx", "dojo/on", "dojo/parser", "dojo/_base/Color", "agsjs/dijit/TOC", "dojo/domReady!"], function (Map, esriConfig, Extent, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, FeatureLayer, ClassBreaksRenderer, SimpleFillSymbol, GeometryService, dom, domGeom, coreFx, on, parser, Color, TOC ) { /* The proxy comes before all references to web services */ /* Files required for security are proxy.config, web.config and proxy.ashx - set security in Manager to Private, available to selected users and select Allow access to all users who are logged in (Roles are not required) /* The proxy section is defined on the ESRI sample. I have included it as part of the documentation reads that the measuring will not work. I thought that might be important. */ // Proxy Definition Begin //identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters. //If this null or not available the project and lengths operation will not work. // Otherwise it will do a http post to the proxy. esriConfig.defaults.io.proxyUrl = "proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = true; // Proxy Definition End // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435 } }); // create map and set slider style to small map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent, logo: false }); // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); // add point feature layer var pointFeatureLayer = new FeatureLayer("http://maps.decaturil.gov/arcgis/rest/services/Test/FeatureServer/0"); map.addLayer(pointFeatureLayer); // declare geometry service esriConfig.defaults.geometryService = new GeometryService("http://maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer"); // Add Table of Contents Start map.on('layer-add-result', function (evt) { // overwrite the default visibility of service. //try { toc = new TOC({ map: map, layerInfos: [{ layer: pointFeatureLayer, title: "My Feature" }, { layer: operationalLayer, title: "Dynamic Map" }, { layer: tiled, title: "Imagery" }] }, 'tocDiv'); toc.startup(); }); toc.on('load', function () { if (console) console.log('TOC loaded'); }); toc.on('toc-node-checked', function (evt) { if (console) { console.log("TOCNodeChecked, rootLayer:" + (evt.rootLayer ? evt.rootLayer.id : 'NULL') + ", serviceLayer:" + (evt.serviceLayer ? evt.serviceLayer.id : 'NULL') + " Checked:" + evt.checked); } }); } ); </script> </head> <body class="soria"> <div id="mapDiv"> <div id="tocDiv"></div> </div> </body> </html>
... View more
12-05-2014
02:35 PM
|
0
|
4
|
4346
|
|
POST
|
I am trying to use dojo animation so that I can store my table of contents in a slide in slide out panel. I want to know how to keep it from sliding across the screen on button click left and how to get keep the scroll bar from showing up when it slides right. Here is my code: <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/soria/soria.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; width:100%; } #tocPanel { position:absolute; right:0%; top:20%; height:600px; width:300px; background-color:Red; z-index:50; } #slideLeftButton { position:absolute; left:0px; bottom:0px; } #slideRightButton { position:absolute; right:0%; bottom:0px; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/config", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/FeatureLayer", "esri/tasks/GeometryService", "dojo/dom", "dojo/dom-geometry", "dojo/fx", "dojo/on", "dojo/parser", "dojo/domReady!"], function (Map, esriConfig, Extent, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, FeatureLayer, GeometryService, dom, domGeom, coreFx, on, parser ) { /* The proxy comes before all references to web services */ /* Files required for security are proxy.config, web.config and proxy.ashx - set security in Manager to Private, available to selected users and select Allow access to all users who are logged in (Roles are not required) /* The proxy section is defined on the ESRI sample. I have included it as part of the documentation reads that the measuring will not work. I thought that might be important. */ // Proxy Definition Begin //identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters. //If this null or not available the project and lengths operation will not work. // Otherwise it will do a http post to the proxy. esriConfig.defaults.io.proxyUrl = "proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = true; // Proxy Definition End // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435 } }); // create map and set slider style to small map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent, logo: false }); // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); // add point feature layer var pointFeatureLayer = new FeatureLayer("http://maps.decaturil.gov/arcgis/rest/services/Test/FeatureServer/0"); map.addLayer(pointFeatureLayer); // declare geometry service esriConfig.defaults.geometryService = new GeometryService("http://maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer"); function slideIt(amt) { coreFx.slideTo({ node: "tocPanel", top: domGeom.getMarginBox("tocPanel").t.toString(), left: (domGeom.getMarginBox("tocPanel").l + amt).toString(), unit: "px" }).play(); } on(dom.byId("slideRightButton"), "click", function () { slideIt(200); }); on(dom.byId("slideLeftButton"), "click", function () { slideIt(-200); }); } ); </script> </head> <body class="soria"> <div id="mapDiv"> <div id="tocPanel"> <button type="button" id="slideLeftButton">Slide it Left</button> <button type="button" id="slideRightButton">Slide it right</button> </div> </div> </body> </html>
... View more
12-05-2014
10:04 AM
|
0
|
2
|
3932
|
|
POST
|
If you have this question, I changed my line to the following to make it work: on(Moveable(dom.byId("templatePickerPane")), "onmousedown", function () { var dnd = new Moveable(dom.byId("templatePickerPane")); });
... View more
12-02-2014
12:18 PM
|
0
|
0
|
723
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-26-2015 12:31 PM | |
| 1 | 06-24-2015 06:06 AM | |
| 1 | 07-15-2015 12:34 PM | |
| 1 | 05-21-2015 02:27 PM | |
| 1 | 05-19-2015 11:52 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|