POST
|
I've written a python script that I want to run before I publish a mxd as a map service, i want to make sure all Object ID fields are hidden, and all geometry fields are visible. I've added some messages and the script runs fine, no problem, but it doesn't alter the visibility of the fields for the layers in my map document? I've attached my code if anyone has time to take a look. Any ideas much appreciated. Kind Regards, Rob import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
# Create a describe object
#
desc = arcpy.Describe(lyr)
# If a feature layer, continue
#
if desc.dataType == "FeatureLayer":
# Create a fieldinfo object
#
fieldInfo = desc.fieldInfo
index = 0
fldlistgeom = arcpy.ListFields(lyr,"","Geometry")
fldlistoid = arcpy.ListFields(lyr,"","OID")
arcpy.AddMessage("Now processing layer: " + desc.Name)
# Use the count property to iterate through all the fields
#
while index < fieldInfo.count:
# Print fieldinfo properties to the screen
#
if fldlistgeom[0].name == fieldInfo.getFieldName(index):
arcpy.AddMessage("Setting " + fldlistgeom[0].name + " as visible...")
fieldInfo.setVisible(index, "VISIBLE")
arcpy.AddMessage("Geometry field Visible.")
if fldlistoid[0].name == fieldInfo.getFieldName(index):
arcpy.AddMessage("Setting " + fldlistoid[0].name + " as hidden...")
fieldInfo.setVisible(index, "HIDDEN")
arcpy.AddMessage("Object ID field hidden.")
index += 1
arcpy.AddMessage("OK")
mxd.save()
... View more
02-18-2012
10:58 AM
|
0
|
3
|
2950
|
POST
|
I want to add a feature class from our database to the FlexViewer application, usually this isn't a problem because all our users connect to the database with a read only password, I would just add the feature class via a reaad only connection to the MXD and publish as a service. However, this database restricts access as to what can be read, each user can see different feature in the feature class. So I thought I would publish a geoporcessing model that prompts the user for their username and password, and expose the model via the GP widget for the flex viewer. At the moment, I am stuck creating the model. I can make the connection file, but I can't seem to reference feature classes that exist within the database? The model remains white. How do I use the result of the 'Create ArcSDE Connection File' tool in model builder to work with a feature class contained within the database I'm conencting to? I've exported the model as python, but it looks ok to me, am I missing something obvious?
# Set the necessary product code
import arceditor
# Import arcpy module
import arcpy
# Script arguments
Username = arcpy.GetParameterAsText(0)
Password = arcpy.GetParameterAsText(1)
# Local variables:
Test_sde = Username
Connections = "\\\\myserver.com\\somewhere\\Scripts\\Connections"
PROSPECTS_GIS = "PROSPECTS_GIS"
Output = "%ScratchWorkspace%\\Output"
# Process: Create ArcSDE Connection File
arcpy.CreateArcSDEConnectionFile_management(Connections, "Test", "DBSERVER.COM", "4150", "DB", "DATABASE_AUTH", Username, Password, "SAVE_USERNAME", "sde.DEFAULT", "SAVE_VERSION")
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(PROSPECTS_GIS, Output, "", "", "")
... View more
12-01-2011
12:39 AM
|
0
|
0
|
2012
|
POST
|
Same issues here. Tried shape file, SDE, checked CRS of dataframe and rasters. Extract Values to Points works fine, Multi Values returns null?
... View more
11-22-2011
10:20 AM
|
0
|
0
|
1587
|
POST
|
Is it possibel to configure the scale range at which a popup for a layer will display? For example, I would like a popup to fire for my countries layer when I am out at full extent viewing the whole world, but when I zoom into North America or Europe, i would still like my countries displayed, but not the popups because I have more content with popups at that scale? Any ideas appreciated, I have looked in the help but couldnt see it? Rob
... View more
08-14-2011
02:31 AM
|
0
|
0
|
201
|
POST
|
We're seeing odd behaviour using Apply Edits from the REST API (called from a Silverlight App). We have a double field and if we insert a double 10 digits in length (or less) it inserts, but if the double is greater than 10 digits in length it fails to insert? Has anyone seen this, or confirm this behaviour? Kind Regards, Rob BTW we run ArcSDE 9.2 on an Oracle database, with ArcGIS Server 10.
... View more
03-25-2011
11:42 AM
|
0
|
0
|
1140
|
POST
|
Thanks Kelly - that helped - Fixed the problem. Thanks. Rob
... View more
08-18-2010
07:55 AM
|
0
|
0
|
318
|
POST
|
Hi Jeff, Like Keith we also have a problem with some python automation, we are prompted for a username and password for 'secured' arcims feature class services. This is a nightmare as we need to run overnight. Reading the help for ListBrokenDataSources I spotted: �??The arcpy.mapping scritping environment will, by default, supress these dialogs during execution�?� Any ideas how we can get this to work? Rob
... View more
08-16-2010
06:12 AM
|
0
|
0
|
795
|
POST
|
Hello Everyone, I'm trying to configure one of the editing samples with the Dojo Accordian panes: I've taken this simple editor sample: http://resources.esri.com/help/webapi/javascript/arcgis/help/jssamples_start.htm ...and I am trying to wire it up with the Accordian panel as illustrated in the San Diego Neighborhood example from the 2009 UC: http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=codeGalleryDetails&scriptID=16445 The problem is I'm just getting the blue outline for the template picker and no options to pick from. The template picker works prior to adding it to the accordian. The contents of my JavaScript File is below, but am I missing something obvious, should it be possible to place a template picker inside an accordian pane or not? Any thoughts appreciated, Rob /* * Copyright 2009 ESRI * * All rights reserved under the copyright laws of the United States * and applicable international laws, treaties, and conventions. * * You may freely redistribute and use this sample code, with or * without modification, provided you include the original copyright * notice and use restrictions. * *See use restrictions at http://resources.esri.com/help/9.3/usagerestrictions.htm. */ //This application was developed by Sterling Quinn and Praveen Ponnusamy // for a demo theater presentation at the 2009 ESRI International User // Conference: "Enhancing ArcGIS JavaScript Applications Using Dojo Dijits" //Modified by Robert Dunfey 2010 - attempting to wire up accordian editor to editor template picker dojo.require("esri.map"); dojo.require("esri.tasks.query"); dojo.require("esri.dijit.editing.Editor"); dojo.require("esri.layers.FeatureLayer"); dojo.require("esri.tasks.geometry"); dojo.require("dijit.layout.AccordionContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("dojox.charting.action2d.MoveSlice"); dojo.require("dojox.charting.Chart2D"); dojo.require("dojox.charting.action2d.Highlight"); dojo.require("dojox.charting.action2d.Tooltip"); //Global variables var resizeTimer; var map, navToolbar; var selectedNeighborhood; var showingAllNeighborhoods = false; //var layers = []; var layers1, layers2; //Initial extent copied from neighborhood service extent in Services Directory var initialExtent = new esri.geometry.Extent(-117.28, 32.65, -116.99, 32.86, new esri.SpatialReference({ wkid: 4326 })); //Show map on page load dojo.addOnLoad(init); //Runs when the page loads function init() { //Set up proxy for editing esri.config.defaults.io.proxyUrl = "../proxy.ashx"; map = new esri.Map("mapDiv", { extent: initialExtent }); //Add the navigation toolbar navToolbar = new esri.toolbars.Navigation(map); //Do all of the following once the map has loaded dojo.connect(map, 'onLoad', function(theMap) { dojo.connect(map, "onLayersAddResult", extractResults); //Listen for resize of map div dojo.connect(dijit.byId('mapDiv'), 'resize', function() { resizeMap(); }); zoomToInitialExtent(); }); //Add the base map from ArcGIS Online. Adding this first layer loads // the map. var tiledUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"; var tiledLayer = new esri.layers.ArcGISTiledMapServiceLayer(tiledUrl); map.addLayer(tiledLayer); var editFieldsLayer = new esri.layers.FeatureLayer("http://myserver.com/ArcGIS/rest/services/Folder/go/FeatureServer/3",{ mode: esri.layers.FeatureLayer.MODE_ONDEMAND, outFields: ['*'] }); //layers.push(editFieldsLayer); map.addLayers([editFieldsLayer]); //Register event listener for accordion container //Switch statement determines which pane the user selected var accordion = dijit.byId("myAccordionContainer"); dojo.connect(accordion, "selectChild", function(childPane) { switch (childPane.id) { case "paneWelcome": displayWelcome(); break; case "paneEdit": displayEdit(); break; case "paneIHS": displayIHS(); break; } }); } function extractResults(results) { //alert('test'); var layers = dojo.map(results, function(result) { return {featureLayer:result.layer, htmlFields:["description"]}; }); var templateLayers = dojo.map(results,function(result){ return result.layer; }); layers1 = layers; layers2 = templateLayers; initEditor(); } function initEditor() { var templatePicker = new esri.dijit.editing.TemplatePicker({ featureLayers: layers2,//templateLayers grouping: true, rows: 'auto', columns: 4, style: "height: 100px;" },'divFeatureServiceDijit');// templatePicker.startup(); var settings = { templatePicker: templatePicker, map: map, geometryService: new esri.tasks.GeometryService("http://myserver.com/ArcGIS/rest/services/Geometry/GeometryServer/"), layerInfos:layers1, toolbarVisible: false, createOptions: { polygonDrawTools:[esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYGON] } } var params = {settings: settings}; var myEditor = new esri.dijit.editing.Editor(params); myEditor.startup(); //dijit.byId("paneEdit").setContent(div); //Tried update but no difference //updateAccordionPanes(); } //"Starts over" by deselecting curren neighborhood and returning // to the initial extent function zoomToInitialExtent() { selectedNeighborhood = null; updateAccordionPanes(); map.setExtent(initialExtent, true); } //Creates welcome div content function displayWelcome() { var div = document.createElement("div"); div.style.width = "300px"; div.style.height = "200px"; dijit.byId("paneWelcome").setContent(div); } //Creates div for editor function displayEdit() { var div = document.createElement("div"); div.style.width = "350px"; div.style.height = "200px"; //dijit.byId("paneEdit").setContent(div); //initEditor(); } //Creates div for IHS function displayIHS() { var div = document.createElement("div"); div.style.width = "300px"; div.style.height = "225px"; dijit.byId("paneIHS").setContent(div); } //Re-selects the selected accordion pane to force an update function updateAccordionPanes() { var accordion = dijit.byId("myAccordionContainer"); accordion.selectChild(accordion.selectedChildWidget); } //Handles resize of browser function resizeMap() { clearTimeout(resizeTimer); resizeTimer = setTimeout(function() { map.resize(); map.reposition(); }, 800); } And my accordian pane HTML snippet: <div dojotype="dijit.layout.ContentPane" region="center"> <!--Neighborhood statistics accordion container--> <div id="myAccordionContainer" dojoType="dijit.layout.AccordionContainer" style="height:400px"> <div dojoType="dijit.layout.ContentPane" id="paneWelcome" title="Welcome" selected="true"></div> <div dojoType="dijit.layout.ContentPane" id="paneEdit" title="Add to Map"><div id="divFeatureServiceDijit"></div></div> <div dojoType="dijit.layout.ContentPane" id="paneIHS" title="IHS"></div> </div>
... View more
08-16-2010
04:41 AM
|
0
|
3
|
2853
|
POST
|
Only had a quick glance at the code - the FeatureLayer layer that you've connected to is being 'masked' by the highlight graphic that's added when the mouseover occurs.
var highlightGraphic = new esri.Graphic(evt.graphic.geometry,highlightSymbol);
map.graphics.add(highlightGraphic); //Comment out this line to see what I mean!
Why not make the hyperlink an infoWindow item, since the infoWindow is already popped-up for you by the mouseover event? 🙂 HTH Thanks, that helped. In the end I took a different approach, and used a feature layer, make a selection on mouseover. Thanks. Rob
... View more
08-09-2010
11:26 AM
|
0
|
0
|
253
|
POST
|
I want to add a character countdown to the Editor dijit when someone is entering a value for my description field, so that they know how many characters they have left to write. I've looked at the examples and can't see how or if this is possible, anybody have any ideas? Rob
... View more
08-09-2010
11:23 AM
|
0
|
0
|
312
|
POST
|
Hello, I'm sure these are simple answers? I'm trying to modify the Identify task sample to work with any number of layers, instead of just the 3 which are specified in the sample, but I'm a bit lost on the purpose for some of the lines of code, some comments would be useful. For example, what happening here: layer2results = {displayFieldName:null,features:[]}; layer3results = {displayFieldName:null,features:[]}; layer4results = {displayFieldName:null,features:[]}; for (var i=0, il=idResults.length; i<il; i++) { var idResult = idResults; if (idResult.layerId === 2) { if (!layer2results.displayFieldName) {layer2results.displayFieldName = idResult.displayFieldName}; layer2results.features.push(idResult.feature); How come displayFieldName is so important? What is the feature:[] array, where does that come from? Any help appreciated, Rob
... View more
08-04-2010
02:10 PM
|
0
|
0
|
601
|
POST
|
Hi, I'm trying to modify an ESRI sample: http://resources.esri.com/help/webapi/javascript/arcgis/demos/featurelayer/fl_hover.html I use the OnMouseOver event to hightlight the feature, then I want to use the onMouseUp or onClick to open a hyperlink (stored as a value in an attribuite field in a new window). I can't get the OnMouseUp event to fire? I understand that this should be inherited from the Graphics Layer class? Any ideas appreciated, Rob function init() { var startExtent = new esri.geometry.Extent(-160, -60, 170, 75, new esri.SpatialReference({wkid:4326})); //create map var map = new esri.Map("mapDiv",{extent:startExtent}); dojo.connect(map, "onLoad", function() { //listen for when map.graphics onMouseOut event is fired and then clear the highlight graphic //and hide the info window dojo.connect(map.graphics, "onMouseOut", function(evt) { map.graphics.clear(); map.infoWindow.hide(); }); }); //create and add new layer var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"); map.addLayer(layer); var southCarolinaCounties = new esri.layers.FeatureLayer("http://myserver.com/ArcGIS/rest/services/Countries/FeatureServer/1", { mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, outFields: ["CNTRY_NAME", "SITE_URL_1"] }); southCarolinaCounties.setDefinitionExpression("1=1"); var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,215,0,0.35]), 1),new dojo.Color([255,215,0,0.10])); southCarolinaCounties.setRenderer(new esri.renderer.SimpleRenderer(symbol)); map.addLayer(southCarolinaCounties); var infoTemplate = new esri.InfoTemplate(); infoTemplate.setTitle("${CNTRY_NAME}"); infoTemplate.setContent("<b>2000 Population: </b>${SITE_URL_1}<br/>"); map.infoWindow.resize(245,125); var highlightSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([205, 38, 38]), 3), new dojo.Color([255,215,0, 0.35])); //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 dojo.connect(southCarolinaCounties, "onMouseDown", function(evt) { //This alert isnt being fired??? alert('hello'); //Open New Window with URL from attribute field //window.open(evt.graphic.attributes.SITE_URL_1, "blank") }); dojo.connect(southCarolinaCounties, "onMouseOver", function(evt) { //This all fires fine? map.graphics.clear(); var highlightGraphic = new esri.Graphic(evt.graphic.geometry, highlightSymbol); map.graphics.add(highlightGraphic); });
... View more
07-28-2010
05:22 AM
|
0
|
3
|
2413
|
POST
|
I'm looking at the feature service editing samples, but the live samples appear not to be live? http://help.esri.com/en/webapi/javascript/arcgis/demos/editor/ed_attribute_inspector.html I checked yesterday and again today, are they live at the moment?
... View more
03-11-2010
11:26 AM
|
0
|
1
|
849
|
POST
|
Keyur, Thanks for the clear and prompt response. It would be good if this could be logged as an enhancement request. We're currently crawling our own network drives and build a Lucene index which we then expose as a REST API to other web apps throughout the company, it would be of great value if we could integrate further with our investment in AGS. Also, do you know if there are plans to expose the schema for the index built by AGS search services? Rob
... View more
02-17-2010
12:07 PM
|
0
|
0
|
273
|
POST
|
I notice search services aren't available vai the REST API? Is this intentional? Are the any plans to expose search services via the REST API? It would be a very useful feature. Rob
... View more
02-16-2010
11:40 AM
|
0
|
2
|
694
|
Title | Kudos | Posted |
---|---|---|
25 | 03-22-2020 11:27 AM | |
1 | 03-13-2020 05:06 AM | |
6 | 11-12-2019 02:23 PM | |
1 | 11-12-2019 11:16 PM |
Online Status |
Offline
|
Date Last Visited |
11-18-2023
04:17 PM
|