POST
|
This was working for over a week and now all of a sudden I am getting the following error: Error {code: 400, message: "Failed to execute query.", details: Array[0], log: undefined, httpCode: 400???} I am just calling a simple query...the query actually works and filters out the proper data but it never makes it inside my showResults function...the code is below including where it is failing: var myQuery,
myQueryTask;
myQueryTask = new QueryTask(railLocationsURL + "/0");
myQuery = new Query();
myQuery.returnGeometry = true;
myQuery.outFields = ["QUALIFICAT","NAME","GECFACILIT","CITY"];
function execute() {
var shopName = dojo.byId('shopName').value;
myQuery.where = "NAME IN ('" + shopName + "')";
myQueryTask.execute(myQuery, showResults);
filter();
}
//create symbol for selected features
// symbol = new SimpleMarkerSymbol();
// symbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE);
// symbol.setSize(10);
// symbol.setColor(new Color([255,255,0,0.5]));
function filter(){
var layerDefinitions = [];
//var selectBusiness = dojo.byId('selectBusiness');
//var selectCategory = dojo.byId('selectCategory');
layerDefinitions[0] = myQuery.where;
railLocationsLayer.setLayerDefinitions(layerDefinitions);
console.log(railLocationsLayer.layerDefinitions);
console.log("after query");
}
//IT NEVER MAKES IT THIS FAR
function showResults(featureSet)
{ console.log("inside ShowResults");
map.graphics.clear();
var graphicsArray = [];
var resultFeatures = featureSet.features;
var railLocationTemplate = new InfoTemplate("Shop Location",
"<b>Shop Name: </b>${NAME}<br/>" + "<b>Address: </b>${ADDRESS1}<br/>" );
//featureSet.setInfoTemplate(railLocationTemplate);
//Loop through each feature returned
for (var i=0, il=resultFeatures.length; i<il; i++) {
var graphic = resultFeatures;
graphic.setInfoTemplate(railLocationTemplate);
graphicsArray.push(graphic);
}
var extent = calcGraphicsExtent(graphicsArray);
map.setExtent(extent.expand(1), true).then(function(){
for(var i=0; i<graphicsArray.length; i++) {
map.graphics.add(graphicsArray);
}
});
}
function calcGraphicsExtent(graphicsArray)
{
var g = graphicsArray[0].geometry,
fullExt = g.getExtent(),
ext, i, il = graphicsArray.length;
if (fullExt === null) {
fullExt = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
for (i=1; i<il; i++) {
ext = (g = graphicsArray.geometry).getExtent();
if (ext === null) {
ext = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
fullExt = fullExt.union(ext);
}
return fullExt;
}
... View more
06-11-2014
06:22 AM
|
0
|
1
|
1428
|
POST
|
I am a novice javascript programmer. I have my site working very well now to do most everything I want. I am stuck on the last couple pieces though. I have a select button working where a user clicks the button then draws around an area to highlight points. These points then sum up a total amount and displays this total amount to the user. This part works great. Where I am stuck is that I want to take the regions that these points fall within and then subtract that total from the whole regions total. So for instance: A region might have 100 points which total $10,000...another region might have 50 points that total $5,000...If a user selects points from region A and region B then I want to pass back to the user the total of the new region and the new totals of region A and region B. As a test in my code I am passing back the region ID to the user currently just to see if everything is working. I am only getting one region ID back though if the user selects points from multiple regions. How do I get all of the region ID's to come back? And then in turn after I get the region id's how do I do the other calculation on the fly? Below is my code for the function that sums the points selected and displays that value and just one region id. Thanks in advance! // Sum Accounts Function
function sumAccounts(features) {
var imputedSum = 0;
var regionSSO;
dojo.forEach(features, function(feature) {
imputedSum = imputedSum + feature.attributes.F80_Q_num;
regionSSO = feature.attributes.EMPLOYEENUMBER;
});
var formattedImputedSum = dojo.number.format(imputedSum)
dojo.byId('messages').innerHTML = "Total 80Q Accounts: $" + formattedImputedSum + "";
dojo.byId('messages2').innerHTML = "Rep SSO: " + regionSSO + "";
}
... View more
06-06-2014
05:27 PM
|
0
|
1
|
549
|
POST
|
Got it thanks all! I did forget this: "esri/geometry/Extent"
... View more
06-05-2014
09:31 AM
|
0
|
0
|
1034
|
POST
|
I am getting the following in chrome: ReferenceError: Extent is not defined Do I need to require anything at the top? require(["dojo/ready",
"dojo/on", "esri/map",
"esri/InfoTemplate",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/tasks/IdentifyTask",
"esri/tasks/IdentifyParameters",
"esri/dijit/Popup",
"dojo/_base/array",
"esri/Color",
"dojo/dom-construct",
"esri/tasks/QueryTask",
"esri/tasks/query", "esri/urlUtils",
"esri/dijit/BasemapToggle", "esri/symbols/SimpleMarkerSymbol", "dojo/domReady!", "esri/Credential",
"esri/config"
],
function(ready, on, Map, InfoTemplate, ArcGISDynamicMapServiceLayer, SimpleFillSymbol, SimpleLineSymbol, IdentifyTask, IdentifyParameters,
Popup, arrayUtils, Color, domConstruct, QueryTask, Query, urlUtils, BasemapToggle, SimpleMarkerSymbol)
... View more
06-05-2014
09:20 AM
|
0
|
0
|
1034
|
POST
|
I came across this thread when I was trying to do the same thing...I tried using what you have here but I can't get it to work. Below is my code that works for multiple graphic points. How do I incorporate what you have here into my code below? Thanks in advance! function showResults(featureSet) {
//remove all graphics on the maps graphics layer
map.graphics.clear();
var extent = esri.graphicsExtent(featureSet.features);
map.setExtent(extent.expand(1), true);
//Performance enhancer - assign featureSet array to a single variable.
var resultFeatures = featureSet.features;
var railLocationTemplate = new InfoTemplate("Shop Location",
"<b>Shop Name: </b>${NAME}<br/>");
for (var i=0, il=resultFeatures.length; i<il; i++) {
//Get the current feature from the featureSet.
//Feature is a graphic
var graphic = resultFeatures;
// graphic.setSymbol(symbol);
//Set the infoTemplate.
graphic.setInfoTemplate(railLocationTemplate);
console.log("BUTTON CLICKED");
//Add graphic to the map graphics layer.
map.graphics.add(graphic);
}
}
... View more
06-04-2014
12:11 PM
|
0
|
0
|
1034
|
POST
|
I have a filter by points working so when a user types something into a text box and hits a button it queries the map and zooms them to the queried results. This works fine for multiple points but is not working when the result is just a single point. Below is my code. Thanks in advance! //remove all graphics on the maps graphics layer
map.graphics.clear();
var extent = esri.graphicsExtent(featureSet.features);
map.setExtent(extent.expand(1), true);
... View more
05-30-2014
10:46 AM
|
0
|
2
|
973
|
POST
|
Sorry I am not following. I must be overlooking something...
... View more
05-28-2014
01:05 PM
|
0
|
0
|
245
|
POST
|
I want to have a map load as soon as the page is open...it will plot all 1000+ points on the map...then at the top of the page there is a text box where the user can filter the map. Once the button is clicked it should kick off a query task and query the layer only showing those that were typed in the text box. I keep getting the error executeQueryTask is not defined...I know I am missing something simple but cant figure it out. My code is below: function init() {
queryTask = new esri.tasks.QueryTask("https://myserver/Locations/MapServer/0");
//initialize query
query = new Query();
query.returnGeometry = true;
query.outFields = ["*"];
}
function executeQueryTask() {
//set query based on what user typed in for population;
query.where = "QUALIFICAT IN " + QUALIFICAT;
//execute query
queryTask.execute(query,showResults);
}
function showResults(featureSet) {
//remove all graphics on the maps graphics layer
map.graphics.clear();
//Performance enhancer - assign featureSet array to a single variable.
var resultFeatures = featureSet.features;
//Loop through each feature returned
for (var i=0, il=resultFeatures.length; i<il; i++) {
//Get the current feature from the featureSet.
//Feature is a graphic
var graphic = resultFeatures;
graphic.setSymbol(symbol);
//Set the infoTemplate.
graphic.setInfoTemplate(infoTemplate);
//Add graphic to the map graphics layer.
map.graphics.add(graphic);
}
}
<body>
<br/>
Qualification Type: <input type="text" id="QUALIFICAT" value="OT" />
<input type="button" value="Get Details" onclick="executeQueryTask(dojo.byId('QUALIFICAT').value);" />
<div id="map"></div>
<div id="footer"
data-dojo-TYPE="dijit.layout.ContentPane"
data-dojo-props="region:'bottom'">
</div>
... View more
05-28-2014
12:04 PM
|
0
|
3
|
897
|
POST
|
I have a simple mapping site working on my machine which just plots some points and then has an infowindow that opens up on click. It works perfectly fine on my machine but when trying to copy the javascript code directly into a preexisting webpage the map loads fine and the info window loads fine but there are no values coming back. The only thing that is different between what I have working on my machine and what is on the webserver is just the header and footer pieces of the webpage. The web server is JBoss too if that helps. Below is my code as well...everything works except this is not returning anything: ${SHOP_LOCAT} Here is the IdentifyTask code: function executeIdentifyTask(event) {
identifyParams.geometry = event.mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams).addCallback(function(response) {
// response is an array of identify result objects
// Let's return an array of features.
return arrayUtils.map(response, function(result) {
var feature = result.feature;
var layerName = result.layerName;
feature.attributes.layerName = layerName;
if (layerName === 'Shop_locations') {
var LocationTemplate = new InfoTemplate("Shop Location Information",
"<b>Shop Name: </b>${SHOP_LOCAT}<br/>" + "<b>City: </b>${CITY}<br/>" +
"<b>State: </b>${STATE}<br/>" + "<b>Contact Name: </b>${CONTACT_NA}<br/>" +
"<b>Contact Phone Number: </b>${CONTACT_PH}<br/>" + "<b>Facility: </b>${FACILITY}<br/>" +
"<b>Type: </b>${TYPE}<br/>");
feature.setInfoTemplate(LocationTemplate);
}
return feature;
});
});
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(event.mapPoint);
... View more
05-23-2014
02:11 PM
|
0
|
0
|
342
|
POST
|
I was wondering what the best method would be to show flying destinations? You see those maps when you are on a plane that show what cities the planes fly to and from. So a plane might fly out of JFK airport and fly to multiple cities and you would see the lines attaching jfk to say LAX or ATL or BOS etc...I have similar data that I would like to do something similar with but wasn't sure the best method to use. Thanks in advance!
... View more
12-10-2013
06:33 AM
|
0
|
0
|
584
|
POST
|
sorry about the code...here it is...I tried changing fieldList too and that didnt work either: tableList = ["DATABASE CONNECTIONS/prod.odc/sales"]
fieldList = ["sales.id",'id']
whereClause = "sales.CREATED_DATE between to_date(sysdate, 'DD-MON-YYYY') AND SYSDATE"
keyField = "sales.id"
lyrName = "live_sales"
#Create the spatial reference for the output layer.
sr = arcpy.SpatialReference("WGS 1984 UTM Zone 12N")
# Create a query layer
arcpy.MakeQueryTable_management(tableList, lyrName,"USE_KEY_FIELDS", keyField, fieldList, whereClause)
# save the created query layer
arcpy.SaveToLayerFile_management(lyrName,"I:/sales.lyr", "ABSOLUTE")
# Print the total rows
print arcpy.GetCount_management(lyrName)
... View more
10-31-2013
09:13 AM
|
0
|
0
|
284
|
POST
|
Not sure if this is the right forum for this question. I created an Oracle OLEDB connection in ArcCatalog and it connected successfully. The problem is when I double click to open the connection it is empty. Could it be that I am timing out as this is a production database and it will kick you out after x period of time. I also have other OLEDB connections that seem to take FOREVER to open in ArcCatalog on the server. On my local machine they open quickly but on the server they take forever...could i have some setting missing on the server? Thanks in advance
... View more
10-31-2013
06:46 AM
|
0
|
2
|
2673
|
POST
|
I had this working on my local computer but when switching it over to the server it is failing with the following error: Failed to execute. Parameters are not valid. ERROR 000793: Invalid data element type ERROR 000840: The value is not a Raster Layer. Failed to execute (MakeQueryTable). I think is has something to do with the OLE DB connection...when I open the connection in arcCatalog it takes a longgggg time to open. Maybe it is timing out in the script and thus that is why it is failing? I have included my code below too. tableList = ["DATABASE CONNECTIONS/prod.odc/sales"] fieldList = ["sales.id",'id'] whereClause = "sales.CREATED_DATE between to_date(sysdate, 'DD-MON-YYYY') AND SYSDATE" keyField = "sales.id" lyrName = "live_sales" #Create the spatial reference for the output layer. sr = arcpy.SpatialReference("WGS 1984 UTM Zone 12N") # Create a query layer arcpy.MakeQueryTable_management(tableList, lyrName,"USE_KEY_FIELDS", keyField, fieldList, whereClause) # save the created query layer arcpy.SaveToLayerFile_management(lyrName,"I:/sales.lyr", "ABSOLUTE") # Print the total rows print arcpy.GetCount_management(lyrName) Thanks in advance!
... View more
10-31-2013
04:45 AM
|
0
|
2
|
693
|
POST
|
nevermind I think I got it! Thanks that appears to work perfectly!
... View more
10-29-2013
09:41 AM
|
0
|
0
|
850
|
POST
|
Unless I'm missing the point, calling the Summary Statistics tool will do this in one line of code? arcpy.Statistics_analysis("Export_Output","in_memory/x",[["ID","COUNT"]],"ID") This creates a table called X in the in_memory workspace and returns a count on a field called ID. How do I get this out of memory and saved as an actual .dbf file?
... View more
10-29-2013
09:38 AM
|
0
|
0
|
850
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|