|
POST
|
Here is how I solved my problem. Probably could use a little clean up, but it is working on my application function featureCreate() { for (var x = 0; x < featureLayers.length; x++) { var featureLayer = COSMap.prototype.featureLayers drawSelectedFeature(featureLayer); drawNewFeature(featureLayer); } }; //draws newly added Feature function drawNewFeature(layer) { dojo.connect(layer, "onEditsComplete", function (addResults, updateResults, deleteResults) { dojo.forEach(addResults, function (addResult) { var query = new esri.tasks.Query(); query.where = "OBJECTID =" + addResult.objectId; var featureSelectionSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 2), new dojo.Color([0, 255, 255, 0.25])); layer.setSelectionSymbol(featureSelectionSymbol); layer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW); }); }); }; //Draws Currently selected Feature function drawSelectedFeature(layer) { dojo.connect(layer, "onClick", function (evt) { var featureSelectionSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 2), new dojo.Color([0, 255, 255, 0.25])); layer.setSelectionSymbol(featureSelectionSymbol); var query = new esri.tasks.Query(); query.geometry = evt.mapPoint; query.returnGeometry = true; query.maxAllowableOffset = 500; layer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW); }); }
... View more
10-18-2012
09:07 AM
|
0
|
0
|
889
|
|
POST
|
Here is what I ended up doing. var layers = dojo.map(results, function (result) { var layer = result.layer; var fields = layer.fields; var fieldinfo = []; for (var n = 0; n < fields.length; n++) { var field = fields ; if (field.name == 'Asset_ID') { var obj = { fieldName: field.name, isEditable: false } } else { var obj = { fieldName: field.name, isEditable: true } } fieldinfo.push(obj); } return { 'featureLayer': layer, 'fieldInfos': fieldinfo } }); var attInsp = new esri.dijit.AttributeInspector({ layerInfos: layers }, 'attr');
... View more
10-18-2012
09:03 AM
|
0
|
0
|
765
|
|
POST
|
We have an application which allows users to edit Feature Classes in SDE via a Feauture Server. We have a uniqure identifier field called "Asset_ID" in ten feature layers that will be populated with a unique number each time a feature is added using code similar to that below: //Added to update asset_id in feature before editing function beforeEdit(layer) { dojo.connect(layer, "onBeforeApplyEdits", function (adds, updates, deletes) { dojo.forEach(adds, function (add) { add.attributes.Asset_ID = 1234; }); }); } I would like the Asset_ID field to be read-only to the user so I tried to set the Read Only property for Asset_ID in the MXD when publishing the feature service, but then my code does not update the field, which makes sense so I have to set the read-only property to "no" for the field in the MXD. I then tried to change fieldInfos property for Asset_ID to 'isEditable':true for the Feature Layers used by the Attribute Inspector, but the problem I found was that I had to specify each field in the fieldInfos collection that I would like to show in the Attribute Inspector, but our feature classes have different attributes so I feeld it would be cumbersome to handle ten feature layers in this manner. How can I update the Asset_ID field while showing it as Ready-Only in the Attribute Inpsectore and aslo prevent the user from changing its value. Thanks for any assistance. Mele
... View more
10-15-2012
01:11 PM
|
0
|
1
|
1525
|
|
POST
|
Are there an Events that I can use to get the selected features being used by the attribute inspector and when features are added to the map? I am using the editor widget in combination with the Attribute Inspector. I have also created a Template picker and used that with the editor widget. In my application, I am editing points, lines, and polygons from a Feature Server using the On Demand Mode. I have seen examples that show selected features using the On Selection mode, but was not pleased with having to add both the map server and the featureServer layers so I am trying to find another way. I would like to be able to start a function that draws a graphic for the point features when they are selected and displayed in the attribute inspector, as well as when the features are first completed. What I am currently doing is using the "onClick" event and then I get the colleciton of feature layers in the map, loop through each to find those that have a geomtryType of "esriGeometryPoint", and then using the getSelectedFeatures() method to retrieve any features that may be selected. This process does not always seem to work that well as the selected features are not always displayed. Thanks for any assitance, Mele
... View more
09-26-2012
01:54 PM
|
0
|
1
|
1282
|
|
POST
|
Kelly, Thanks for your code. This works great and is what I was looking for. Mele
... View more
09-19-2012
02:28 PM
|
0
|
0
|
1670
|
|
POST
|
I am using the editor widget to add features to SDE feature classes via an ArcGIS Server Feature Server, but have found the infowindow used by the editor widget to be cumbersome because it displays on top of the map. I would like to use a Div outside of the map to contain the infowindow contents used by the Editor widget. Does anyone have some code that shows how to use to redirect the infowindow used when editing to a location other than in the map div HTML element? Thanks, Mele
... View more
09-19-2012
09:24 AM
|
0
|
5
|
2198
|
|
POST
|
I have updated a JavaScript web application created in Visual Studio 2010 to the new 3.1 API and am using the Intellisense VSDOC file available here: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/api_codeassist.htm This looks to be very handy for Visual Studio users, but I was not able to get it work within my HTML file. I have my HTML file, scripts, and styles in seperate files so I placed the following in my .html file: <script type="text/javascript" src="Assets/scripts/jsapi_vsdoc_v31.js"></script> But when I run the project, I get an error in IE that says "Expected identifier, string or number" which refers to the above JavaScript file and there is no intellisense. I can get intellisense to work in my JavaScript files by using the following reference /// <reference path="~/Assets/Scripts/jsapi_vsdoc_v31.js" />, but the problem is that I have several JavaScript files and I have to add the reference to each JavaScript file. Has anyone been able to get this to work in the HTML file or is there another way to use Intellisens without having to add the 'reference' to each JavaScript file? Thanks, Mele
... View more
08-06-2012
02:57 PM
|
0
|
1
|
865
|
|
POST
|
I have noticed that I have to reload my page in order to get the TOC to display. I can see that the agsjs.dijit.TOC is created on the initial load of the page, but the results do not show up in my 'tocDiv'. I have also experienced this behavior on the internet example site http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.02/examples/toc.html on the initial load the TOC does not show, but if I refresh in IE8, it does. Just wondering if there is a work around to address this behavior. Thanks, Mele
... View more
07-24-2012
01:29 PM
|
0
|
0
|
3518
|
|
POST
|
Thanks for answering this forum post and providing instructions on how to use your dijit in the 3.0 api. I have downloaded the latest JS from the link you provided and followed your instructions and things are working in 3.0 Mele
... View more
07-18-2012
11:44 AM
|
0
|
0
|
3518
|
|
POST
|
I have been using the Table of Contents widget from https://code.google.com/p/gmaps-utility-gis/ with ArcGIS Javasript API 2.8 but wanted to update my API to 3.0 and have not had luck doing so. I am not clear on how to migrate to 3.0 even after reading the documention. I did update my dojoconfig to use the "packages" property. dojoConfig = { parseOnLoad: true, packages: [{ name: "agsjs", location: "http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/1.07/build/agsjs" }] However, when using dojo.require("agsjs.dijit.TOC"); the table of contents does not load and the rest of my page does not load either. Has anyone been able to use this Table of Contents widget with 3.0? If so, can you provide instructions on how you got it to work? Thanks, Mele
... View more
06-21-2012
10:39 AM
|
0
|
13
|
9857
|
|
POST
|
I would like to implement the same flash feature command that ESRI uses when accessing the context menu on a table row. I have used the following to flash a selected feature: IActiveView activeView = ArcMap.Document.ActiveView; IFeatureIdentifyObj featIdentify = new FeatureIdentifyObject(); featIdentify.Feature = feature; IIdentifyObj identify = featIdentify as IIdentifyObj; identify.Flash(activeView.ScreenDisplay); This code works, but does not have the 'crosshairs' that the ESRI flash command does. I was looking possibly executing a command with ICommand.Execute, but could not find an ID for the Flash Command form the table context menu. Anyone have success with implmenting the same Flash Command that ESRI uses within custom code? Thanks, Mele
... View more
04-26-2012
08:48 AM
|
0
|
3
|
1006
|
|
POST
|
After further investigation, this code does work. The problem I was having was trying to rebuild a locator which was moved from ArcSDE 9.x to our Development ArcSDE 10.x database. ArcGIS 9.x Locators must be recreated in 10 http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00250000001w000000.htm%20
... View more
04-03-2012
01:32 PM
|
0
|
0
|
509
|
|
POST
|
Trying to use ArcObjects to rebuild locators in an IWorkspace, but enounter 'COMException was unhandled' error when trying to use the 'rebuildlocator' method on ILocatorWorkspace2. Here is the code I am using: private static IWorkspace ws; IWorkspaceFactory2 wsf = new SdeWorkspaceFactoryClass(); ws = wsf.Open(propertySet, 0); private static void RebuildLocators() { System.Object obj = Activator.CreateInstance(Type.GetTypeFromProgID("esriLocation.LocatorManager")); ILocatorManager locManager = (ILocatorManager)obj; ILocatorWorkspace2 locWs = (ILocatorWorkspace2)locManager.GetLocatorWorkspace(ws); IEnumLocatorName enumlocName = locWs.get_LocatorNames(esriLocatorQuery.esriLocator, "Address"); ILocatorName locName = enumlocName.Next(); //IEnumLocator enumloc = locWs.get_Locators(esriLocatorQuery.esriLocator, "Address"); //ILocator loc = (ILocator)enumloc.Next(); while (locName != null) { locWs.RebuildLocator(locName.Name, null); locName = (ILocatorName)enumlocName.Next(); } } I have tried to pass both the ILocator.Name and ILocatorName.Name, but I suspect the problem might be the ITrackCAncel. Has anyone had success with rebuilding locators with ILocateWorkspace2? Please let me know if you can assist. Thanks, Mele
... View more
03-31-2012
06:46 AM
|
0
|
1
|
1014
|