|
POST
|
so i am looking to replicate the "find unmatched query wizard" from microsoft access in python. basically i have 2 tables and i want to output all the records from the one table that do not match the records of the other table based on a common ID. in theory it seems simple enough but i can't figure out how to do it. any help would be greatly appreciated! thanks, max You could use arcpy.TableSelect_analysis or arcpy.TableToTable_conversion. First, find the other table ids (using search cursor) and compiled them into string like ids ="1,2,3,...22". Secondly define the expression parameter (where_clause) like where_clause ="YouIDfield not in (" + ids + ")". Then using either one of the methods i mentioned above with the where_clause as the expression parameter....
... View more
08-11-2011
12:47 PM
|
0
|
0
|
2657
|
|
POST
|
Hello I'm having problems using the geometry service project method. I get the following error: " Message: 'spatialReference' is null or not an object Line: 48 Char: 410823 Code: 0 URI: http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4 " The code is very simple, I am just trying to project a mapPoint from projected (26911 ) UTM NAD81 Z11 to WGS84 (4326 ) using the geometry service.
// explicit SR definition for input point
var ptUTM = new esri.geometry.Point(mapPoint.x, mapPoint.y, new esri.SpatialReference({ wkid: 26911 }));
var outSR = new esri.SpatialReference({ wkid: 4326 });
var ptWGS;
gsvc.project(ptUTM, outSR, function (projectedPoints) {
ptWGS = projectedPoints[0];
});
Any Inputs? gsvc.project([ptUTM], outSR, function (projectedPoints) { ptWGS = projectedPoints[0]; }); The first parameter is Geometry[].
... View more
08-11-2011
05:11 AM
|
0
|
0
|
922
|
|
POST
|
Thanks for your reply.I think your advice is good.If I don't understanding somewhere,Can i ask your help again?^_^ No problem.
... View more
08-11-2011
04:39 AM
|
0
|
0
|
1836
|
|
POST
|
Writing a python script and attempting to use the SelectLayerByAttribute_management command. I've tried it several different ways and keep getting a syntax error on the variable set, or if the variable set works, get invalid expression. I am querying against a file geodatabase. python snippet: where_clause = (r"Status = 'U'") arcpy.SelectLayerByAttribute_management("Crimes", "NEW_SELECTION", where_clause) I'd like to add .outputCount to this to see if there are any rows selected. I have done this once in the python window but can't remember how I did it now and didn't put it in my script when it worked. I've also tried various ways of putting quotes and single quotes with and without the r or the parenthesis. Syntax error or it doesn't get passed properly to the query and gives the Invalid expression. Help! Forgot to add: In the ArcMap window using the Select by Attributes dialog, the proper syntax is "Status" = 'U' and it works as expected. Just can't get the translation to python to work properly. If the layer came from file GDB, your where_clause ="Status" ='U' should work. One way you can test is using string literal in the function: arcpy.SelectLayerByAttribute_management("Crimes", "NEW_SELECTION", "\"Status\"='U'")
... View more
08-10-2011
10:07 AM
|
0
|
0
|
3801
|
|
POST
|
Excuse me for my fool,as I'm a newer,I don't understand you still.I didn't do that before. Can I ask your MSN or other?Pardon me my clumsiness.I want to learn more from you and make friend with you. My MSN is [email protected] There is an online help on how to GP on Server. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/An_overview_of_geoprocessing_with_ArcGIS_Server/002v00000001000000/. They are good articles for newer. You probably will understand them better than what i said here. I found out reading online help is a good way of learning JS API or Other GIS stuff. You are welcome to contact me to discuss GIS issues. My Email is [email protected]. (thought I log on Forum more times than i check my email -full of junk mails).
... View more
08-10-2011
05:11 AM
|
0
|
0
|
1836
|
|
POST
|
Thanks for your reply.I have taken your advice,but after I publish a result map service,nothing is displayed in the map.when the job complete I use the "getResultImageLayer" to get the image layer like this: function completeCallback(jobInfo) { if(jobInfo.jobStatus != "esriJobFailed") { //isosurfaceGP.getResultData(jobInfo.jobId,"Output_Polygon", addIsosurface); imgParam = new esri.layers.ImageParameters(); imgParam.format = "PNG24"; imgParam.imageSpatialReference = map.spatialReference; imgParam.layerDefinition = ["GRIDCODE"]; isosurfaceGP.getResultImageLayer(jobInfo.jobId,"Output_Polygon",imgParam,function(gpLayer) { map.addLayer(gpLayer); }); } } when I try the job in the rest,though the job is displayed "succeed",but I can't see the result,it displayed : "Data Type: GPFeatureRecordSetLayer Unable to get tool layers for task 'IsosurfaceAnalyze' and parameter 'Output_Polygon' Supported Interfaces: REST " I'm so confused.Can I ask your help? One thing you can try is to put this layer on the result .mxd. In your GP Model, set the source at Your tool folder\Scratch\scratch.gdb. What happen is when you run GP on the server, ArcGIS server will create scratch.gdb at \\arcgisserver\arcgisjobs\jobid\scratch\. So the result layer will guarantee to be put in that .gdb.
... View more
08-09-2011
09:27 AM
|
0
|
0
|
1836
|
|
POST
|
up~up~up~up~up~
dojo.connect(map, "onExentChange", function(extent){
var scale =esri.geometry.getScale(map);
if (scale >your down limit && scale < your up limit)
yourGraphicLayer.setVisibility(true);
else yourGraphicLayer.setVisibility(false);
});
... View more
08-09-2011
07:33 AM
|
0
|
0
|
667
|
|
POST
|
Heming, I'm not having any luck with this. Below is the code I'm trying (a modification of the Query No Map sample with the relevant changes highlighted):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Query State Info without Map</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.4/js/dojo/dijit/themes/claro/claro.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4"></script>
<script type="text/javascript" language="Javascript">
dojo.require("esri.tasks.query");
dojo.require("esri.map");
var queryTask, query;
var queryEvent;
function init() {
//build query
queryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5");
//dojo.connect(queryTask, "onComplete", showResults);
//build query filter
query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["SQMI","STATE_NAME","STATE_FIPS","SUB_REGION","STATE_ABBR","POP2000","POP2007","POP00_SQMI","POP07_SQMI","HOUSEHOLDS","MALES","FEMALES","WHITE","BLACK","AMERI_ES","ASIAN","OTHER","HISPANIC","AGE_UNDER5","AGE_5_17","AGE_18_21","AGE_22_29","AGE_30_39","AGE_40_49","AGE_50_64","AGE_65_UP"];
}
function execute(population) {
query.where = "POP2007 >" + population;
//execute query
try {
dojo.stopEvent(queryEvent);
}catch(e){
console.log("error");
}
queryEvent = queryTask.execute(query,showResults);
}
function showResults(results) {
var s = "";
for (var i=0, il=results.features.length; i<il; i++) {
var featureAttributes = results.features.attributes;
for (att in featureAttributes) {
s = s + "<b>" + att + ":</b> " + featureAttributes[att] + "<br />";
}
}
dojo.byId("info").innerHTML = s;
}
dojo.addOnLoad(init);
</script>
</head>
<body>
Population is greater than: <input type="text" id="population" value="50000" />
<input type="button" value="Get Details" onclick="execute(dojo.byId('population').value);" />
<br />
<br />
<div id="info" style="padding:5px; margin:5px; background-color:#eee;">
</div>
</body>
</html>
Rather than monitoring the query's state in a variable I figured a try/catch statement should do the same thing, right? The problem is that the dojo.stopEvent declaration doesn't seem to have any effect. The NET tab in Firebug shows that the query takes around 2 seconds to execute. Pressing the button a few times quickly shows that the previous processes are not cancelled. Any clues? Cheers, Steve When you code runs the first time, the queryEvent is null or undefined. So it will almost be certain that you will catch an exception -dojo.stopEvent(undefined);. You might want to define the queryEvent in your init. The purpose of using a variable to monitor is to avoid uncessary broken flow(catch). After a second thought, I think stopping a query complete event does not really service your purpose. It basically tries to stop an already completed query process not an query that is under process. That is probably why it does not working. Sorry for misleading.
... View more
08-09-2011
06:25 AM
|
0
|
0
|
2400
|
|
POST
|
Hi, i have a trouble for a few days,I generalize a isosurface by submit a job to a GP Service,when i get the isosurface from the server,I add them to a GraphicLayer,now I want to create a legend for the graphiclayer,but i have no idea,is there anyone help me? now below is my code partly: function addIsosurface(outputFeat) { var symbol = new esri.symbol.SimpleFillSymbol(); symbol.setColor(new dojo.Color([150, 150, 150, 0.5])); var renderer = new esri.renderer.ClassBreaksRenderer(symbol, "GRIDCODE"); renderer.addBreak(0, 26, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([56, 168, 0, 1]))); renderer.addBreak(26, 28, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([139, 209, 0, 1]))); renderer.addBreak(28, 30, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 255, 0, 1]))); renderer.addBreak(30, Infinity, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 0, 0, 1]))); var features = outputFeat.value.features; var isoLayer = new esri.layers.GraphicsLayer(); dojo.forEach(features,function(feature) { isoLayer.add(feature); }) isoLayer.setRenderer(renderer); map.addLayer(mapLayer); dojo.connect(map,'onLayersAddResult',function(results) { var layerInfo = dojo.map(results, function(layer,index){ return {layer:layer.layer,title:'temperature'}; }); if(layerInfo.length > 0){ var legendDijit = new esri.dijit.Legend({ map:map, layerInfos:layerInfo },"legendDiv"); legendDijit.startup(); } }); map.addLayers([isoLayer]); } Have you thought about adding your GP result as a layer on your .xmd (being a result map service)? If you add your GP to your .mxd as a layer and then add GP result as a layer at the same .mxd. Thay way you can define symbology for your result layer in .mxd and do not have to add code logic to symbolize. There are docs on ESRI online show how.
... View more
08-08-2011
06:46 AM
|
0
|
0
|
1836
|
|
POST
|
Hello All, Probably not strictly a JS API topic, but I'm seeking advice on the best way to handle a particular situation. We often have a mapservice that is cached down to a particular level and below that level want to use a dynamic version of the mapservice. Currently I accommodate this by creating two mapservices using the same mxd and loading them both into the Map - one as a ArcGISDynamicMapServiceLayer and one as a ArcGISTiledMapServiceLayer. Then, using the JS API, toggle the visibility depending on the zoom level so that only one is ever visible. This works but seems rather clumsy and requires that I have two mapservices instantiated for each mxd. I'd hoped that I could simply use the cached mapservice in a ArcGISDynamicMapServiceLayer, but that still doesn't display once I've zoomed in beyond the limits of the cache. I don't want to enable dynamic tile creation to populate the higher zoom levels - both out of performance concerns and control of disk space. Can anyone suggest an alternative to the approach I'm currently using? Ideally, I'd like the ArcGISTiledMapServiceLayer to have the option of switching to dynamically generate images once the limits of the cache have been passed. Thanks! --john You could achieve your goal by setting up different visible scale range for your tiled .mxd and your dynamic .mxd. For example, set your dynamic .mxd display only at the scales beyond your tiled .mxd. So once your cache limit is reached, your dynamic .mxd will automatically display. The only minor issue you have to deal with is how to set up scale slider so that it allows zooming beyond your cache .mxd.
... View more
08-08-2011
06:37 AM
|
0
|
0
|
1559
|
|
POST
|
in your layerInfos set 'isEditable': false To be more specific, if you want certain attribute read-only, set the layerInfos isEditable to true, and set fieldName isEditable to false.
var layerInfos = [{
'featureLayer': selectedTemplate.featureLayer,
'isEditable': true,
'fieldInfos': [
{ 'fieldName': 'STN_NAME', 'isEditable': false, 'tooltip': 'Station Name', 'label': 'Station Name:' },
{ 'fieldName': 'SITE_NAME', 'tooltip': 'Site Name', 'label': 'Site Name:' },
{ 'fieldName': 'STN_TYPE', 'tooltip': 'Station Type', 'label': 'Station Type:' }]
}];
... View more
08-08-2011
05:17 AM
|
0
|
0
|
975
|
|
POST
|
Hi, I've created a new Geodata Service with WFS capability. The feature layer is stored in a file geodatabase. The feature layer is initialised in my JS, and I can see the symbol for the layer in the Template Picker. However, when running myFeatureLayer.isEditable() it comes back as false. How can I make the service/feature layer editable? I'm using ArcGIS Server 9.3.1. Thanks, Jerry Feature layer has to be in SDE with edit permission.
... View more
08-05-2011
05:24 AM
|
0
|
0
|
725
|
|
POST
|
I know very little about the use of domNode element and interested in learning more. I had a look at the attribute inspector and could see the domNode but dont understand now it works. Any pointers would be good. Basically the second parameter of the attribute inspector is either an existing DOM node -html element or newly created dom (dojo.create("div") etc). Once you create that, you could place it in your popup: yourPopup.setContent(yourAttrInspector.domNode); Please look at this ESRI sample or some others: http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples/widget_attributeInspectorPane.html.
... View more
08-05-2011
05:19 AM
|
0
|
0
|
1219
|
|
POST
|
I create a gp service on ArcGIS server. Within this GP service there is a sub model which basically is Feature Class to Feature Class system tool except that Input Features parameter is a featureSet instead of featue class. The purpose of that is I want to save a featureSet from a query result to a feature class in %scratchworkspace%\scratch.gdb. It successfully save the featureset except for one thing: it only saved OBJECTID and Shape fields. all the other fields are lost in the process! Do someone have any ideas or Do i missing something? I have tried Copy Features, Table to Table and Copy Rows. They all have the same results. If i used the gp service on a mxd. It worked perfectly. That lead me to suspect it might have something to do with the FeatureSet. I wish someone can enlighten me on this.
... View more
08-04-2011
01:32 PM
|
0
|
4
|
4108
|
|
POST
|
I have an application of ArcGIS Extension for Google Maps API. I need to know how to create Legend tool for it? Please help. Thanks! I don't think ArcGIS Extension for Google Maps API has a control for lengend. However, you could integrate a Legend dijit from JS API in your app. Since both api using javascript, it shouldn't be that hard to accomplish your goal.
... View more
08-04-2011
06:22 AM
|
0
|
0
|
945
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-11-2011 12:16 PM | |
| 1 | 05-25-2017 08:26 AM | |
| 1 | 06-02-2017 07:37 AM | |
| 1 | 06-28-2011 07:02 AM | |
| 1 | 06-12-2017 10:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-01-2024
09:57 PM
|