|
POST
|
Identify from Button I was on here working out a solution to fire some code that did a buffer and selection of features within and return to a grid. That works, but I now have a button that I want to run an identify and send results to a side bar. I believe the code is in place to pause the buffer code when switching between buttons. But the way I have it set up below its requiring a click event on the map to start running the Identify code...if I click a feature in the map it does not run the code. So I am confused on how to start the Identify Trying to call the identify sidebar code in red the blue is where I am seeing a required map click to run the code...but it does not fire when I click a feature I want to identify on. When I click the map I am not even getting to the Function and the alert.... alert("In SidebarApp"); Thoughts? Thanks
on(dojo.byId('Identify'), "click", function () {
if (Buffer != undefined) {
Buffer.pause();
}
if (Identify == undefined) {
Identify = on.pausable(app.map, "click", function (evt) {
initializeSidebar(map);
});
}
else {
Identify.resume();
}
}); // SIDEBAR IDENTIFY START
function initializeSidebar(map){
alert("In SidebarApp");
var popup = map.infoWindow;
//when the selection changes update the side panel to display the popup info for the
//currently selected feature.
connect.connect(popup, "onSelectionChange", function(){
displayPopupContent(popup.getSelectedFeature());
});
//when the selection is cleared remove the popup content from the side panel.
connect.connect(popup, "onClearFeatures", function(){
//dom.byId replaces dojo.byId
dom.byId("featureCount").innerHTML = "Click to select feature(s)";
//registry.byId replaces dijit.byId
registry.byId("leftPane").set("content", "");
domUtils.hide(dom.byId("pager"));
});
//When features are associated with the map's info window update the sidebar with the new content.
connect.connect(popup, "onSetFeatures", function(){
displayPopupContent(popup.getSelectedFeature());
dom.byId("featureCount").innerHTML = popup.features.length + " feature(s) selected";
//enable navigation if more than one feature is selected
popup.features.length > 1 ? domUtils.show(dom.byId("pager")) : domUtils.hide(dom.byId("pager"));
});
}
function displayPopupContent(feature){
if(feature){
var content = feature.getContent();
registry.byId("leftPane").set("content", content);
}
}
function selectPrevious(){
map.infoWindow.selectPrevious();
}
function selectNext(){
map.infoWindow.selectNext();
}
function clearContent() {
registry.byId("leftPane").set("content", "");
domUtils.hide(dom.byId("pager"));
}
... View more
04-16-2014
05:33 AM
|
0
|
8
|
2421
|
|
POST
|
thanks Jon I was doign this in silverlight with great success....I have to go back and determine what I was using... What I eventually want to do is move slightly away from a table format ad do something like the below....can I do this with the example you suggested? I then want to have to Feature in the map interactive with the row in the Grid. Where I can hover on the Row in the Grid and have it highlight in the map and visa-versa....Map back to the grid
Title
Image Address
some other info
Instead of:
Image Title Address some other info
Can I build a table structure with TD and TR? Thanks for your thoughts.
... View more
04-15-2014
03:36 PM
|
0
|
0
|
2053
|
|
POST
|
I am populating my grid with this Looking for a way to clear the grid on the start of another tool... var data = arrayUtils.map(featureSet.features, function (entry, i) { return { NAME: entry.attributes.SITENAME, REGION: entry.attributes.REGION, WATERBODY: entry.attributes.WATERBODY, TYPE: entry.attributes.TYPE, ACCESSAREA: entry.attributes.ACCESSAREA, LOCATION: entry.attributes.LOCATION }; }); grid.store.setData(data); grid.refresh(); I tried to create a new Grid and clear it but not having luck....any thoughts? var newStore = new dojo.data.ItemFileReadStore({data: { identifier: "", items: []}}); var grid = dijit.byId("grid"); grid.setStore(newStore); }
... View more
04-15-2014
10:20 AM
|
0
|
14
|
3442
|
|
POST
|
I placed the DIALOG outside the Function until i figure out how to destroy the dialog...
... View more
04-10-2014
09:48 AM
|
0
|
0
|
1250
|
|
POST
|
Thank you Jon...still learning here...good lesson for me....I will start looking at the console for error trapping....forgot about it.
... View more
04-10-2014
09:18 AM
|
0
|
0
|
1250
|
|
POST
|
I regards to my last post with the "Dialog" Here is a JFiddle of the project. http://jsfiddle.net/Jaykapalczynski/TwBLZ/17/ Please see lines 208 - 214 in the java script. If you click in the map near the east shore along the main rivers you will get a return data set....they are boat ramps being returned.... 1. Comment the DIALOG code out (as it is now) you can activate the buffer tool and click multiple times in the map and the buffer will run.... 2. Uncomment the DIALOG code and you can only click the map once and run the buffer.... What is causing this...do I need to stop the Dialog and restart each time? Declare somewhere else?
... View more
04-10-2014
08:35 AM
|
0
|
0
|
1250
|
|
POST
|
I narrowed my issue down to the DIALOG: I had thsi just inside the buffer code....it was part of the SNIP in a couple posts ago.... dialog = new TooltipDialog({
id: "tooltipDialog",
style: "position: absolute; width: 100px; font: normal normal normal 10pt Helvetica;z-index:100"
});
dialog.startup(); This is allowing the user to hover over the graphics and retrieve a popup with some information. If I remove it I can continually click the map and run the buffers...if I put the code back in and refresh I can only run the code once. I am figuring that I need to stop the dialog after each run through the Buffer? Not sure....Any thoughts? Do I need to Shut it down each pass through the Buffer Code? Clear it? hmmmmm
... View more
04-10-2014
06:28 AM
|
0
|
0
|
1250
|
|
POST
|
OOPS ... ONE LAST THOUGHT ON THIS. When I click the button I does run the Query and Buffer and returns the correct results... BUT I cannot run it again for some reason....ANY THOUGHTS? http://jsfiddle.net/Jaykapalczynski/TwBLZ/10/
... View more
04-09-2014
08:32 AM
|
0
|
0
|
1250
|
|
POST
|
GOT IT!!! Thanks to both of you for your help...greatly appreciated....learning here.... Call to the BufferTool Function with this...passing the Buffer Params to the Function
on(dojo.byId('btnAction2'), "click", function () {
if (action1 != undefined) {
action1.pause();
}
if (action2 == undefined) {
action2 = on.pausable(app.map, "click", function(evt) {
var params = new BufferParameters();
params.geometries = [ evt.mapPoint ];
params.distances = [ 10 ];
params.unit = GeometryService.UNIT_STATUTE_MILE;
// COMMENT out the below and make the call in the Buffer Function
//geometryService.buffer(params);
BufferTool(map, params); // Pass the map and the params to the Buffer Function
});
}
else {
action2.resume();
}
}); In my BufferTool Function I commented out the Buffer params and grabbed the params sent to the function
function BufferTool(map, params){
// ...SNIP OF CODE REMOVED
//when the map is clicked create a buffer around the click point of the specified distance.
//app.map.on("click", function(evt){
//define input buffer parameters
// var params = new BufferParameters();
// params.geometries = [ evt.mapPoint ];
// params.distances = [ 10 ];
// params.unit = GeometryService.UNIT_STATUTE_MILE;
// geometryService.buffer(params);
// });
geometryService.buffer(params);
geometryService.on("buffer-complete", function(result){
app.map.graphics.clear();
// draw the buffer geometry on the map as a map graphic
var symbol2 = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_NULL,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([105,105,105]),
2
),new Color([255,255,0,0.25])
);
var bufferGeometry = result.geometries[0]
var graphic = new Graphic(bufferGeometry, symbol2);
app.map.graphics.add(graphic);
... View more
04-09-2014
04:59 AM
|
0
|
0
|
1250
|
|
POST
|
Like this: BufferTool(map) About passing the parameters: In this line? action2 = on.pausable(app.map, "click", function(DECLARE VARIABLES HERE?) {
on(dojo.byId('btnAction2'), "click", function () {
if (action1 != undefined) {
action1.pause();
}
if (action2 == undefined) {
action2 = on.pausable(app.map, "click", function(geometryService.buffer(params)) {
var params = new BufferParameters();
params.geometries = [ evt.mapPoint ];
params.distances = [ 10 ];
params.unit = GeometryService.UNIT_STATUTE_MILE
BufferTool(map);
});
}
else {
action2.resume();
}
});
OR am i close?
on(dojo.byId('btnAction2'), "click", function () {
if (action1 != undefined) {
action1.pause();
}
if (action2 == undefined) {
action2 = on.pausable(app.map, "click", function(evt) {
var params = new BufferParameters();
params.geometries = [ evt.mapPoint ];
params.distances = [ 10 ];
params.unit = GeometryService.UNIT_STATUTE_MILE
BufferTool(map, geometryService.buffer(params));
});
}
else {
action2.resume();
}
});
... View more
04-08-2014
03:50 PM
|
0
|
0
|
1250
|
|
POST
|
Ran into one more issue..... I can still call the buffer with the old code but for some reason the new on(dojo.byID example is blowing up when I try and turn the geometry service on in the buffer code. THIS DOES NOT happen when I use the old code I guess the question is how do I properly call the buffer code from the EXAMPLE 2 below and then properly disconnect the Click in the Buffer code so it does not continue to fire on map click.....you example worked great for an Alert but I dont know where to call the Buffer code...I even tried to copy all the code into the function. The FIRST example works fine....BUT does not allow me to use other tools because I need to disconnect from the Click in the buffer Do I have something wrong in the EXAMPLE 2 below... EXAMPLE 1 OLD CODE on(dom.byId("BUFFER"), "click", function () {
dijit.byId("FirstPane").set('open',false); //Close
BufferCall = connect.connect(app.map, "onClick", BufferTool(app.map))
}) I tried this from the above example EXAMPLE 2 NEW CODE on(dojo.byId('btnAction2'), "click", function () {
if (action1 != undefined) {
action1.pause();
}
if (action2 == undefined) {
action2 = on.pausable(app.map, "click", function(evt) {
BufferTool();
//alert("Action 2!");
});
}
else {
action2.resume();
}
}); This is the Buffer Code being called from the above examples.... In example 2 above it gets to the Alert("8"); but not the Alert("8");
function BufferTool(map){
dialog = new TooltipDialog({
id: "tooltipDialog",
style: "position: absolute; width: 100px; font: normal normal normal 10pt Helvetica;z-index:100"
});
dialog.startup();
// selection symbol used to draw the selected census block points within the buffer polygon
var point = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE,
25,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_NULL,
new Color([137, 214, 171, 0.9]),
1
),
new Color([137, 214, 171, 0.5])
);
app.map.on("load", function(){
app.map.graphics.enableMouseEvents();
app.map.graphics.on("mouse-out", closeDialog);
});
//listen for when the onMouseOver event fires on the countiesGraphicsLayer
//when fired, create a new graphic with the geometry from the event.graphic and add it to the maps graphics layer
featureLayer.on("mouse-over", function(evt){
var t = "<b>${SITENAME}</b><hr><b>Region: </b>${REGION}<br>";
var content = esriLang.substitute(evt.graphic.attributes,t);
var highlightGraphic = new Graphic(evt.graphic.geometry,point);
app.map.graphics.add(highlightGraphic);
dialog.setContent(content);
domStyle.set(dialog.domNode, "opacity", 0.85);
dijitPopup.open({
popup: dialog,
x: evt.pageX,
y: evt.pageY
});
});
// selection symbol used to draw the selected census block points within the buffer polygon
var symbol2 = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE,
12,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_NULL,
new Color([247, 34, 101, 0.9]),
1
),
new Color([207, 34, 171, 0.5])
);
featureLayer.setSelectionSymbol(symbol2);
// change cursor to indicate features are click-able
featureLayer.on("mouse-over", function () {
app.map.setMapCursor("pointer");
});
featureLayer.on("mouse-out", function () {
app.map.setMapCursor("default");
});
// Add the Feature Layer To Map
app.map.addLayer(featureLayer);
// geometry service that will be used to perform the buffer
var geometryService = new GeometryService("https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
BufferClick = app.map.on("click", function(evt){
//define input buffer parameters
var params = new BufferParameters();
params.geometries = [ evt.mapPoint ];
params.distances = [ 10 ];
params.unit = GeometryService.UNIT_STATUTE_MILE;
geometryService.buffer(params);
});
alert("Hey 8");
geometryService.on("buffer-complete", function(result){
app.map.graphics.clear();
// draw the buffer geometry on the map as a map graphic
var symbol2 = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_NULL,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([105,105,105]),
2
),new Color([255,255,0,0.25])
);
var bufferGeometry = result.geometries[0]
var graphic = new Graphic(bufferGeometry, symbol2);
app.map.graphics.add(graphic);
alert("Hey 9");
//Select features within the buffered polygon. To do so we'll create a query to use the buffer graphic
//as the selection geometry.
var query = new Query();
query.geometry = bufferGeometry;
// Select the Points within the Buffer and show them
featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){
});
// Query for the records with the given object IDs and populate the grid
featureLayer.queryFeatures(query, function (featureSet) {
updateGrid(featureSet);
});
});
} // End Function BufferTool
... View more
04-08-2014
01:33 PM
|
0
|
0
|
1794
|
|
POST
|
Thanks jon.uihlein think I have it working...have to give props to above first to kenbuja for sticking with me through this....BOTH of your help is greatly appreciated. THANKS
... View more
04-07-2014
06:39 PM
|
0
|
0
|
1794
|
|
POST
|
Thanks for your help its greatly appreciated. Have another issue maybe you can help with Why are the buttons deactivated in this http://jsfiddle.net/hzNmf/6/
... View more
04-07-2014
01:39 PM
|
0
|
0
|
1794
|
|
POST
|
I copied your last example verbatim (One in the html and the other in the JS) and it does not draw the map...only the two buttons show up and the border of the Map... hmmmm EDIT !!!! oops I needed it to be HTTPS ... Be right back testing
... View more
04-07-2014
10:04 AM
|
0
|
0
|
1794
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|