POST
|
Hi everyone, I wrote a script that behaves differently based upon the keywords a user enters. As of now it is still hardcoded; for example:
searchOrder.setKeywords(['hello'])
would search all results that contain the word ???hello???, and this:
searchOrder.setKeywords(['hello', 'forum'])
would search all results that contain the word ???hello??? and ???forum???. Now, I would like to convert this script to a tool. But I am unsure how to obtain that list of keywords from users. I was thinking that I should be able to let the user type in a word, then click an Add button (the black cross, as seen in many tools), but I am unsure how to do that. When I set string to multivalue the resulting interface remains un-clickable: [ATTACH=CONFIG]29508[/ATTACH] Please let me know if you have any suggestions or think of a different approach. Thank you.
... View more
12-02-2013
12:45 PM
|
0
|
2
|
645
|
POST
|
Thank you, Tracy, I used your suggestions and I got it to work. As a JavaScript beginner I appreciate such help, and I thank you for pointing out unnecessary parts such as using Memory as an argument. As a beginner I depend on samples and sometimes I am not entirely sure what I can or cannot take out. Thank you so much and have a great weekend. Now adding a third grid... let's see if I can do it.
... View more
11-15-2013
03:51 PM
|
0
|
0
|
280
|
POST
|
Problem solved; figured it out after more browsing. In case anyone is interested, I first used Make XY Event Layer, which is a temporary layer, and then I saved it to a feature class, using Feature To Point.
# Define input parameters
inputTable = "E:/Redlands/MIP/Files/Twitter.gdb/TweetTable"
xLong = "Longitude"
yLat = "Latitude"
outputLayer = "tweet_pts"
# Create layer with above inputs
arcpy.MakeXYEventLayer_management(inputTable, xLong, yLat, outputLayer)
# Save the event layer as a feature class
arcpy.FeatureToPoint_management(outputLayer, "E:/Redlands/MIP/Files/Twitter.gdb/TweetPoints")
... View more
11-14-2013
08:44 PM
|
0
|
0
|
144
|
POST
|
Hi everyone one, I wrote a script that searches Tweets and writes them to a table in a geodatabase. I got this to work finally, and now I would like to map out the tweets that have a location attached to them. As you can see in the following screenshot, I have a latitude and longitude field already: [ATTACH=CONFIG]29125[/ATTACH] What would be the best approach to use these two fields and create a point feature class? I initially was thinking about Add XY, but I do not think that works with my data. I stumbled upon tokens (SHAPE@XY, for instance), and I was wondering if that might be what I need to implement. Here is my current cursor in case that helps: cursor = arcpy.da.InsertCursor("E:/Redlands/MIP/Files/Twitter.gdb/TweetTable4", ("DateRun", "Username", "GeoEnabled", "Coordinates", "Latitude", "Longitude", "PostTime", "Tweet"))
Any advice is appreciated. Thank you!
... View more
11-14-2013
05:10 PM
|
0
|
1
|
611
|
POST
|
Hi everyone, I am using two dgrids in my application and either grid should show the result of a different query. I get both queries to work, and I get both to show up in the respective grid, but I do not get them to work at the same time. I am most likely missing a little detail and I would appreciate any advice on how to fix it. I have attached two scripts. QuerySchedule shows the query I want to incorporate into the other script (FinalApp). How to test this? The bottom grid will populate when clicking on one of the buttons in the Query Database tab and the second one, in the North Parcel Schedule tab, should automatically populate after the map loads. I realize that when I remove lines 548-561 and 628-681 then the query in the North tab will show up. Therefore I think that both grids or queries are interfering with each other, and that I am not implementing them correctly. Thank you very much.
... View more
11-14-2013
09:56 AM
|
0
|
4
|
557
|
POST
|
Just gave this a shot. In my case this will make the first selected row unselect when I click a second one, but from then on it will just add them all up again like before.
... View more
11-13-2013
10:55 PM
|
0
|
0
|
1109
|
POST
|
Hi Brett, thank you for asking this question, because I have the exact same one! I was working off a sample, and I must have deleted something that makes my grid behave the way you described it. Anyways, I have been attempting to solve the issue by changing CSS, looking at GitHub and this article, but I have not been successful. I would not mind if no selection at all showed up ever, but I am not sure how to access the blueish background. I have tried many rules but none of them seem to give me what I want. The closest I have come to making it showing up only once is when using this rule:
.dgrid-selected{visibility:hidden;}
But that obviously hides the whole thing and does not do what we want. I also noticed that using certain classes has no effect whatsoever, no matter which rule is applied. I hope my links can help to some degree. Please let me know if you figure it out. Thank you.
... View more
11-13-2013
08:42 PM
|
0
|
0
|
1109
|
POST
|
Here is an updated script. It is finally taking the edits. Although now I realize there is a logical mistake, and I would be interested if anyone has suggestions as to what should be changed. It will always only update the first three records in my table. This is due to the fact that it finds the Object ID of a parcel and then writes to the corresponding Object ID in the table (so the first three rows). Where should the script be changed to make the user add a new record each time they click a parcel? There is no need to edit previously submitted information (so, I guess it should not default to an existing record in the table in the first place, but show blank input fields). Each time the attribute inspector pops up the user would enter information which would add a new row to the table. As you can see I am avoiding a relationship query as I am struggling with that one a lot. But if anyone has suggestions how to implement one, please let me know. Thank you very much.
<!DOCTYPE html>
<html>
<head>
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<title>Attribute Inspector</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.7/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.7/js/esri/css/esri.css">
<style>
html, body {
height: 97%;
width: 98%;
margin: 1%;
}
#rightPane {
width: 250px;
}
.esriAttributeInspector .dijitTextBox {
width: 10em;
}
.esriAttributeInspector .atiLayerName {
display: none;
}
.esriAttributeInspector .atiLabel {
font-weight: bold;
color: #705B35;
}
.esriAttributeInspector .atiField {
background: #FFF6D9;
}
.esriAttributeInspector .atiButtons {
color: #705B35;
}
</style>
<script src="http://js.arcgis.com/3.7/"></script>
<script>
var map, operationalLayer;
require([
"esri/map", "esri/layers/FeatureLayer",
"esri/tasks/query",
"esri/symbols/SimpleFillSymbol",
"esri/dijit/Legend",
"esri/dijit/AttributeInspector",
"esri/config",
"dojo/dom",
"dojo/parser",
"dojo/_base/Color",
"esri/dijit/editing/Editor",
"dojo/_base/array",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/layout/AccordionContainer",
"dojo/domReady!"
], function(
Map,
FeatureLayer,
Query,
SimpleFillSymbol,
Legend,
AttributeInspector,
esriConfig,
dom,
parser,
Color,
Editor,
arrayUtils
) {
parser.parse();
//This sample requires a proxy page to handle communications with the ArcGIS Server services. You will need to
//replace the url below with the location of a proxy on your machine. See the 'Using the proxy page' help topic
//for details on setting up a proxy page.
//esriConfig.defaults.io.proxyUrl = "http://msgis-c23-03/Test/proxy.php";
map = new Map("map", {
basemap:"topo",
//center :[-118.407, 34.452],
//zoom :13
center :[-118.185, 33.8748],
zoom :18
});
//parcelLayer = new FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/Geology/FeatureServer/9", {
// mode: FeatureLayer.MODE_ONDEMAND,
// outFields: ["station_id", "lithology_type", "metamorphic_facies", "geomodifications", "objectid"]
//});
parcelLayer = new FeatureLayer("http://msgis-webdev-1.spatial.redlands.edu/arcgis/rest/services/numa_gremling/ParcelsAndTables/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["Id", "Name"]
});
parcelTable = new FeatureLayer("http://msgis-webdev-1.spatial.redlands.edu/arcgis/rest/services/numa_gremling/ParcelsAndTables/FeatureServer/1", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["OBJECTID", "Location", "Event", "Date", "YouTube", "Press"]
});
var symbol = new SimpleFillSymbol().outline.setColor(new Color([0, 255, 0, 1])).setWidth(5);
parcelLayer.setSelectionSymbol(symbol);
map.on("layers-add-result", function(results) {
//add the legend
//var legend = new Legend({
// map: map,
// layerInfos: [{
// layer: parcelLayer,
// title: ""
// }]
//}, "legendDiv");
//legend.startup();
var layerInfos = [{
featureLayer: parcelTable,
showAttachments: false,
isEditable: true,
showDeleteButton: false,
fieldInfos: [
{ fieldName: "OBJECTID", tooltip: "The station id.", label: "OBJECTID:", isEditable: true },
{ fieldName: "Location", tooltip: "The lithology type of the rock unit", label: "Location", isEditable: true },
{ fieldName: "Event", tooltip: "The lithology type of the rock unit", label: "Location", isEditable: true },
{ fieldName: "Date", tooltip: "The lithology type of the rock unit", label: "Date", isEditable: true },
{ fieldName: "YouTube", tooltip: "The lithology type of the rock unit", label: "YouTube", isEditable: true },
{ fieldName: "Press", tooltip: "The lithology type of the rock unit", label: "Press", isEditable: true }
]
}];
var selectQuery = new Query();
parcelLayer.on("click", function(e){
dom.byId("details").innerHTML = "";
// console.log(e.graphic);
selectQuery.objectIds = [e.graphic.attributes.OBJECTID];
parcelTable.selectFeatures(selectQuery);
});
var attInspector = new AttributeInspector({
layerInfos: layerInfos
}, "attributesDiv");
attInspector.on("attribute-change", function (evt) {
var feature = evt.feature;
var fids = {
'Date' : "dijit_form_FilteringSelect_2",
'Event' : "dijit_form_FilteringSelect_1",
'Location' : "dijit_form_FilteringSelect_0",
'OBJECTID' : evt.feature.attributes.OBJECTID,
'Press' : "dijit_form_TextBox_2",
'YouTube' : "dijit_form_TextBox_1"
};
//feature.attributes[evt.fieldName] = evt.newFieldValue;
//evt.newFieldValue is 'undefined' so it was dropped in the database.
feature.attributes[evt.fieldName] = dijit.byId(fids[evt.fieldName]).get('value');
feature.getLayer().applyEdits(null, [feature], null);
});
});
map.addLayers([parcelLayer]);
map.addLayers([parcelTable]);
///
});
</script>
</head>
<body class="claro">
<!--[if IE 7]>
<style>
html, body {
margin: 0;
}
</style>
<![endif]-->
<div id="content" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline', gutters:true" style="width: 100%; height: 100%; margin: 0;">
<div id="rightPane" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'">
<div data-dojo-type="dijit/layout/AccordionContainer">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Details', selected:true">
<span id="details">Click a geology outcrop to view details.</span>
<div id="attributesDiv"></div>
</div>
<div data-dojo-type="dijit/layout/ContentPane" id="legendPane" data-dojo-props="title:'Legend'">
<div id="legendDiv"></div>
</div>
</div>
<div id="editorDiv"></div>
</div>
<div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" style="overflow:hidden;">
</div>
</div>
</body>
</html>
... View more
11-08-2013
04:02 PM
|
0
|
0
|
187
|
POST
|
Hi everyone, I am using the attribute inspector to add records to a table. When you click on a parcel the attribute inspector will open, the user can enter values, and the newly entered values should write to a table. It all seems to work fine to a certain extent; I looked at it in fiddler and the apply edits is coming back successfully, but it does not seem to take it after all. I have attached my script and I would appreciate any advice on how to tackle this issue. Could it be linked to not using a proxy page?
<!DOCTYPE html>
<html>
<head>
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<title>Attribute Inspector</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.7/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.7/js/esri/css/esri.css">
<style>
html, body {
height: 97%;
width: 98%;
margin: 1%;
}
#rightPane {
width: 250px;
}
.esriAttributeInspector .dijitTextBox {
width: 10em;
}
.esriAttributeInspector .atiLayerName {
display: none;
}
.esriAttributeInspector .atiLabel {
font-weight: bold;
color: #705B35;
}
.esriAttributeInspector .atiField {
background: #FFF6D9;
}
.esriAttributeInspector .atiButtons {
color: #705B35;
}
</style>
<script src="http://js.arcgis.com/3.7/"></script>
<script>
var map, operationalLayer;
require([
"esri/map", "esri/layers/FeatureLayer",
"esri/tasks/query",
"esri/symbols/SimpleFillSymbol",
"esri/dijit/Legend",
"esri/dijit/AttributeInspector",
"esri/config",
"dojo/dom",
"dojo/parser",
"dojo/_base/Color",
"esri/dijit/editing/Editor",
"dojo/_base/array",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/layout/AccordionContainer",
"dojo/domReady!"
], function(
Map,
FeatureLayer,
Query,
SimpleFillSymbol,
Legend,
AttributeInspector,
esriConfig,
dom,
parser,
Color,
Editor,
arrayUtils
) {
parser.parse();
//This sample requires a proxy page to handle communications with the ArcGIS Server services. You will need to
//replace the url below with the location of a proxy on your machine. See the 'Using the proxy page' help topic
//for details on setting up a proxy page.
//esriConfig.defaults.io.proxyUrl = "http://msgis-c23-03/Test/proxy.php";
map = new Map("map", {
basemap:"topo",
//center :[-118.407, 34.452],
//zoom :13
center :[-118.185, 33.8748],
zoom :18
});
//parcelLayer = new FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/Geology/FeatureServer/9", {
// mode: FeatureLayer.MODE_ONDEMAND,
// outFields: ["station_id", "lithology_type", "metamorphic_facies", "geomodifications", "objectid"]
//});
parcelLayer = new FeatureLayer("http://msgis-webdev-1.spatial.redlands.edu/arcgis/rest/services/numa_gremling/ParcelsAndTables/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["Id", "Name"]
});
parcelTable = new FeatureLayer("http://msgis-webdev-1.spatial.redlands.edu/arcgis/rest/services/numa_gremling/ParcelsAndTables/FeatureServer/1", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["OBJECTID", "Location", "Event", "Date", "YouTube", "Press"]
});
var symbol = new SimpleFillSymbol().outline.setColor(new Color([0, 255, 0, 1])).setWidth(5);
parcelLayer.setSelectionSymbol(symbol);
map.on("layers-add-result", function(results) {
//add the legend
//var legend = new Legend({
// map: map,
// layerInfos: [{
// layer: parcelLayer,
// title: ""
// }]
//}, "legendDiv");
//legend.startup();
var layerInfos = [{
featureLayer: parcelTable,
showAttachments: false,
isEditable: true,
showDeleteButton: false,
fieldInfos: [
{ fieldName: "OBJECTID", tooltip: "The station id.", label: "OBJECTID:", isEditable: true },
{ fieldName: "Location", tooltip: "The lithology type of the rock unit", label: "Location", isEditable: true },
{ fieldName: "Event", tooltip: "The lithology type of the rock unit", label: "Location", isEditable: true },
{ fieldName: "Date", tooltip: "The lithology type of the rock unit", label: "Date", isEditable: true },
{ fieldName: "YouTube", tooltip: "The lithology type of the rock unit", label: "YouTube", isEditable: true },
{ fieldName: "Press", tooltip: "The lithology type of the rock unit", label: "Press", isEditable: true }
]
}];
var selectQuery = new Query();
parcelLayer.on("click", function(e){
dom.byId("details").innerHTML = "";
// console.log(e.graphic);
selectQuery.objectIds = [e.graphic.attributes.OBJECTID];
parcelTable.selectFeatures(selectQuery);
});
var attInspector = new AttributeInspector({
layerInfos: layerInfos
}, "attributesDiv");
attInspector.on("attribute-change", function(evt) {
var feature = evt.feature;
feature.attributes[evt.fieldName] = evt.newFieldValue;
feature.getLayer().applyEdits(null, [feature], null);
});
});
map.addLayers([parcelLayer]);
map.addLayers([parcelTable]);
///
});
</script>
</head>
<body class="claro">
<!--[if IE 7]>
<style>
html, body {
margin: 0;
}
</style>
<![endif]-->
<div id="content" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline', gutters:true" style="width: 100%; height: 100%; margin: 0;">
<div id="rightPane" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'">
<div data-dojo-type="dijit/layout/AccordionContainer">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Details', selected:true">
<span id="details">Click a geology outcrop to view details.</span>
<div id="attributesDiv"></div>
</div>
<div data-dojo-type="dijit/layout/ContentPane" id="legendPane" data-dojo-props="title:'Legend'">
<div id="legendDiv"></div>
</div>
</div>
<div id="editorDiv"></div>
</div>
<div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" style="overflow:hidden;">
</div>
</div>
</body>
</html>
Thank you for your help. PS: the script is based on the following sample, in case that helps.
... View more
11-07-2013
08:17 PM
|
0
|
1
|
834
|
POST
|
The way I understand hidden is that it hides it from displaying, but it is still there as a box. Have you tried adjusting the height? Such as: {height: 0px;}
... View more
11-05-2013
11:38 AM
|
0
|
0
|
510
|
POST
|
Hi everyone, I am trying to use a sample and make it work with my data, but it seems that it will not fully recognize my layer. Here is the sample I am using, and I have attached my code. I would assume that all I would have to do is change the feature layer and the outfields as well as the fields in the attribute inspector. Nothing shows up, however. When I click on my parcel the ???Click a geology outcrop to view details.??? will vanish, but the attribute inspector will not show up instead. Any suggestions?
... View more
11-05-2013
10:45 AM
|
0
|
2
|
835
|
POST
|
I have been testing many different addresses now, and I come to the conclusion that it behaves very strangely. Try this: Type in: 200 belmont avenue and hit Enter. It will take you to a place and add multiple markers somewhere on that street. Now type in the same thing, but instead of hitting Enter you will choose the first suggested address (the same address, actually) and see what happens. It will zoom out and not add markers anywhere (the ones you see are from your previous successful search). Does it attach the suffix to the suggested address and get confused? I hope I am making sense; it is very hard to describe a strangely behaving geocoder. This discussion might also have moved from adding a marker to understanding how the geocoder reacts to inputs; maybe I should start a new topic. Either way, thank you so much for your help! Oops, and while I was writing this your replied already! So would you say that using the geocoder to find an address might not be the best approach? First of all it is hard to see what the differences between the Geocoder and the Locator are when looking at the reference. They both have the same purpose? But the Geocoder offers more, especially styling etc.? So I'll pick that one... That would be my typical reasoning; not sure anymore how one is supposed to read the reference pages and make sense out of certain things.
... View more
11-05-2013
09:05 AM
|
0
|
0
|
361
|
POST
|
You are right; I copied the whole address although I only entered the beginning part. I now simply typed in 2127 E 17th St without using the dropdown to help me and it went to the right location and it added a marker (two, actually, huh?). Now, I just realized that anytime I type something in but do not use the results dropdown it will take me to a location and add marker. If I click on one of the suggestions in the results dropdown it will, in most cases, not add a marker (or add it in that one spot in the previous screenshot). Very, very strange.
... View more
11-05-2013
08:34 AM
|
0
|
0
|
361
|
POST
|
I just tried it again to make sure, and I realized something. The address I always use to test (77 Market, 2127 E 17th St, Long Beach, California) will not show a marker. However, I just realized that when I zoom out I suddenly see the marker; although in the wrong place. Generally, the marker will only show up after searching a second time (i.e. it will not show up when searching for the first time after the application has loaded). The marker also does not show up for every address, and most of the time it will just be dropped right at the place you can see in the attached screenshot. [ATTACH=CONFIG]28860[/ATTACH] I assume that we are close but that there might be a minor logical mistake. Thank you so much again for your help! PS: I am attaching an updated script, since a lot has happened since asking this question; although the geocoder part is the exact same. The geocoder part starts in line 632.
... View more
11-04-2013
08:24 PM
|
0
|
0
|
993
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|