POST
|
Hello, I am trying to run an update on an ArcSDE FeatureClass using ArcPy. With the goal of my code starting an edit session, making a change to my FC and then saving the changes, so this change will show up in the (date_Changed) attribute like ArcSDE is supposed to. This is my code below: (Just an example of trying to use the insertcursor, normally I would try to deletefeatures then append, but I figured start small first)
import arcpy
from arcpy import env
arcpy.MakeFeatureLayer_management(r'Database Connections\GISAdmin@SBMPERDBS003.sde\GISAdmin.Leonora_Drilling\GISAdmin.LEO_DH_Collars','LeoDHCollars')
arcpy.MakeXYEventLayer_management(r'\\SBMPERTST001\Applications\GIS\DataShed Exploration_LEO Export\Arc_DHCollars.csv',"NAT_East","NAT_North","LeoDHCollarsNEW")
arcpy.MakeFeatureLayer_management("LeoDHCollarsNEW",'LeoDHCollarslyr')
arcpy.ChangeVersion_management('LeoDHCollars','Transactional','GISADMIN.DataUpdates','')
workspace=r'Database Connections\GISAdmin@SBMPERDBS003.sde'
edit= arcpy.da.Editor(r'Database Connections\GISAdmin@SBMPERDBS003.sde')
edit.startEditing(True,True)
edit.startOperation()
with arcpy.da.InsertCursor("LeoDHCollars", ('SHAPE@', 'Hole_Type')) as icur:
icur.insertRow([(7642471.100, 686465.725), 'New School'])
edit.stopOperation()
edit.stopEditing(True)
arcpy.DisconnectUser(r'Database Connections\SDE@SBMPERDBS003.sde', "ALL")
arcpy.ReconcileVersions_management(workspace,"ALL_VERSIONS","SDE.GIS_Default","GISADMIN.DataUpdates","LOCK_ACQUIRED","NO_ABORT","BY_OBJECT","FAVOR_TARGET_VERSION","POST","KEEP_VERSION")
The problem I am getting is RunTime Error: Workspace already in transaction mode. Any thoughts of why?
... View more
11-05-2013
05:23 PM
|
0
|
7
|
3682
|
POST
|
As Relic said. Instead of using graphicslayer.refresh(); Try map.removeLayer(graphicslayer); map.addLayer(graphicslayer); (So essentially breaking the refresh into the two stages)
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:s="library://ns.adobe.com/flex/spark"
pageTitle="Basic InfoSymbol example">
<fx:Style >
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@namespace esri "http://www.esri.com/2008/ags";
.myStyle
{
backgroundColor: #FF0000;
border-color: #578DB8;
border-thickness: 2;
info-placement: bottomright;
}
</fx:Style>
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
import mx.events.ColorPickerEvent;
protected function colorpicker1_changeHandler(event:ColorPickerEvent):void
{
// FlexGlobals.topLevelApplication.styleManager.getStyleDeclaration('.myStyle').setStyle('backgroundColor',event.currentTarget.selectedColor);
mygraphic.styleManager.getStyleDeclaration('.myStyle').setStyle('backgroundColor',event.currentTarget.selectedColor);
mygraphic.invalidateProperties(); // doesn't do anything
map.removeLayer(graphicslayer);
map.addLayer(graphicslayer);
graphicslayer.refresh(); // doesn't do anything
graphicslayer.invalidateDisplayList(); // doesn't do anything
}
]]>
</fx:Script>
<fx:Declarations>
<esri:InfoSymbol id="infoSymbol1" containerStyleName="myStyle" >
<esri:infoRenderer >
<fx:Component>
<s:DataRenderer>
<s:Label text="Label 1" color="0xFEFEFE"/>
</s:DataRenderer>
</fx:Component>
</esri:infoRenderer>
</esri:InfoSymbol>
</fx:Declarations>
<esri:Map>
<esri:extent>
<esri:Extent xmin="-17526410" ymin="-6369184" xmax="3557" ymax="13433510">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
<esri:GraphicsLayer id="graphicslayer" symbol="{infoSymbol1}">
<esri:Graphic id="mygraphic">
<esri:geometry>
<esri:MapPoint x="-13057025" y="3912271"/>
</esri:geometry>
</esri:Graphic>
<esri:Graphic id="mygraphic2">
<esri:geometry>
<esri:MapPoint x="-12057025" y="3912271"/>
</esri:geometry>
</esri:Graphic>
</esri:GraphicsLayer>
</esri:Map>
<s:BorderContainer top="100" horizontalCenter="0" backgroundColor="0xffffff" >
<s:HGroup left="20" right="20" top="20" bottom="20" verticalAlign="middle" >
<s:Label text="Change color and move map to update" />
<mx:ColorPicker top="200" horizontalCenter="0" change="colorpicker1_changeHandler(event)" />
</s:HGroup>
</s:BorderContainer>
</s:Application>
... View more
10-20-2013
11:32 PM
|
0
|
0
|
235
|
POST
|
Hi, I have a map service that is in 102100 Web Mercator, the layers in a custom spatial reference. There is a geographic transformation that is associated with this and it is 108263 GUX_1_To_WGS_1984. When I view my layers in my Web App they are in the correct locaton, however any operations I do that involve the widgets ignores the transformation (or maybe does it again?) So for example when I click on my feature in the attributetable widget, the buffer is not applied to the feature, but instead applied 200 meters south (which is the distance of the transformation 108263). I am experiencing the same occurence with export/load shapefile, esearch. etc. Anyone experienced similar things?
... View more
10-09-2013
11:26 PM
|
0
|
0
|
343
|
POST
|
sorry about the delay in getting back to you. I edited the uncompiled version of the esearch widget in Flashbuilder. The esearch widget is massive so I wont post all of the code, as I also added other features like the ability to export my search result to a shapefile. Here I create a Drop Down List, With a list of my services for the user to choose from
<s:DropDownList id="serviceDdl" change="serviceChanged(event)">
<s:ArrayList>
<fx:Object data="Tenements" label="Tenements" url="http://xxx/arcgis/rest/services/Tenements/MapServer"/>
<fx:Object data="Drilling" label="Drilling" url="http://xxx/arcgis/rest/services/Drilling/MapServer"/>
</s:ArrayList>
</s:DropDownList>
As the DDL is changed, it calls servicechanged which calls my private function loadLayer which holds the code below
if (serviceDdl.selectedItem.data == "Drilling")
{
cboLayerText.dataProvider.removeItemAt(0);
cboLayerText.dataProvider.removeItemAt(0);
} If Drilling service is selected then it removes the first two items of the cboLayerText combobox (Because those layers are not under the drilling service.
else if (serviceDdl.selectedItem.data == "Tenements")
{
cboLayerText.dataProvider.removeItemAt(3);
cboLayerText.dataProvider.removeItemAt(2);
} If tenements is selected then it removes my last two layers from the combobox, because they are layers from the drilling service and not tenements service cboLayerText is the combobox that grabs the url of the layer that is selected (which you set in the .xml config of the widget) Thus the search is done on my final selected layer I don't know if any of these concepts work in Python.
... View more
10-06-2013
08:14 PM
|
0
|
0
|
351
|
POST
|
It would depend on how big your data is. I have implemented a similiar ability to the eSearch widget. I have a drop down box that contains a list of my map services. Once the map service is selected, I have a drop down box populate with only the layers that relate to that specific selected Service. Its not doing a query but instead since I only have 3 services, I simply creating an if statement that removes layers from the dropdown that dont relate to my selected service. And then I can create an SQL statement for that layer, inside that service. Not a solution to this problem but might be relevant to you.
... View more
10-02-2013
06:59 PM
|
0
|
0
|
351
|
POST
|
I would like to use my own WKT (It does not have a WKID). Is this possible/ Will it require much alteration of the code?
... View more
09-30-2013
11:52 PM
|
0
|
0
|
212
|
POST
|
Take a look at the Export to Shapefile widget, it has a function that opens the dialog box prompting the user to select where to save a file, which should help you implementing where to place it. http://www.arcgis.com/home/item.html?id=d8dc9df78ec643a9a27c18a6f01b41c1 The private function doDownload() the function I'm referring to.
... View more
09-17-2013
11:54 PM
|
0
|
0
|
149
|
POST
|
Joe, Let me begin with a question. Why are you attempting to use a WKT when the WKID for NAD_1927_StatePlane_Kansas_North_FIPS_1501 is 26777? I am wanting to create and use my own WKT, but first I was checking to see if I could implement an already existing WKID just purely as a test, and I am getting an error trying to use it in my PrintParameters. NAD_1927_StatePlane_Kansas_North_FIPS_1501 just happens to be a random example I selected. I am trying to implement a WKT in the PrintParameters of my ExportWebMapForm.mxml But keep getting an error, as you can see in my above post. How do I pass my WKT into outSpatialReference?
... View more
09-17-2013
04:35 PM
|
0
|
0
|
789
|
POST
|
Full Code
<esri:PrintParameters id="printParameters"
format="{formatsDDL.selectedItem}"
layoutTemplate="{layoutTemplatesDDL.selectedItem}"
map="{hostBaseWidget.map}"
outSpatialReference= "{new SpatialReference('PROJCS["NAD_1927_StatePlane_Kansas_North_FIPS_1501",GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",2000000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-98.0],PARAMETER["Standard_Parallel_1",38.71666666666667],PARAMETER["Standard_Parallel_2",39.78333333333333],PARAMETER["Latitude_Of_Origin",38.33333333333334],UNIT["Foot_US",0.3048006096012192]]')}"
preserveScale="{scaleCheckbox.selected}">
<esri:exportOptions>
<esri:ExportOptions dpi="{dpiDD.selectedItem.dpi}"/>
</esri:exportOptions>
<esri:layoutOptions>
<esri:LayoutOptions id="layoutOptions"/>
</esri:layoutOptions>
</esri:PrintParameters> Error = Description Resource Path Location Type Element type "esri:PrintParameters" must be followed by either attribute specifications, ">" or "/>". ExportWebMapForm.mxml /FlexViewer/src/widgets/Print line 507 Flex Problem
... View more
09-17-2013
12:12 AM
|
0
|
0
|
789
|
POST
|
Hello, Is it possible to create my own Well Known Text (WKT) for a coordinate system that is not registered with a WKID. I am wanting to print into my own spatial reference so would be passing this WKT into <esri:PrintParamters outSpatialReference="{new SpatialReference(WKT)}" I cant seem to test this idea, because I get errors when I try test it with an existing WKT. for examples : outSpatialReference= "{new SpatialReference('PROJCS["NAD_1927_StatePlane_Kansas_North_FIPS_1501",GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",2000000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-98.0],PARAMETER["Standard_Parallel_1",38.71666666666667],PARAMETER["Standard_Parallel_2",39.78333333333333],PARAMETER["Latitude_Of_Origin",38.33333333333334],UNIT["Foot_US",0.3048006096012192]]')}" Gives me "PrintParameters must end with > or /> It seems the amount of quotation marks in the WKT is making it run wild.
... View more
09-16-2013
10:57 PM
|
0
|
6
|
1626
|
POST
|
Also, by "shapefile" I think you mean ArcSDE featureclass, right? right. I don't think you strictly need to script Archiving. As I understand it, it keeps track of changes to the Default version. I don't remember the specific details (the documentation has it though), but it adds a couple date fields that are sort of like "this feature looked like this from X to Y". The Historical Markers are for marking specific events in time ("Subdivision Blah Built"). Depending on needs it might be nice to script those I suppose, but if I understand correctly, once Archiving is setup for a feature it will capture the changes regardless. Okay I see, im thinking I could potentially archive by using python to open an edit session, and then using an update cursor, add my feature or update the current featues table with my changes from the new feature. hopefully this works.
... View more
08-13-2013
09:31 PM
|
0
|
0
|
678
|
POST
|
Are you running ArcSDE? As far as I know, FGDB and PGDB formats don't suport archiving/versioning. In the interest of keeping things simple and straightforward (which is always a good idea), I don't see much wrong with what you are doing. That same copy/rename/repost stategy can be applied to FGDB, GRID, SHP, PGDB, SDE, whatever. I do it all the time - it's great. It may be more "efficient" database/storage-wise to implement SDE enterprise archiving/versioning, but I know it isn't easier. Yes this is with ArcSDE. Whats wrong with what im doing with the copy/rename/repost is that it is leading to hundreds of archived shapefiles. But as I am aware with SDE you can just have the one shapefile and the archives will be documented within that one shapefile.... So if there is anyway I would much rather do that.
... View more
08-07-2013
05:09 PM
|
0
|
0
|
678
|
POST
|
Yes indeed, what you describe is quite possible using python, It is pretty straightforward. The similarity to Geodatabase Archiving is only superficial. Geodatabase Archiving is performed on an enterprise relational database utilizing versioning. What you are doing is very much simpler. The date functions in python (for example, strftime) give a great range of options for formatting the time stamp string you would (likely) want to add to base shape file name. Otherwise, it is basicaly finding and copying shapefiles.... In any event, one would want to build it as a custom tool rather than have a pre-built tool with the pethora of options a general tool would need to cover all cases. Sorry I worded my question very poorly. I already have the script to archive without the use of gdb. But now I want to utilize Geodatabase archiving. So the steps in my script would be 1. Enabling Archiving. 2. Create Historical Marker (Start an edit session, add my new features, save edit reconcile and post, click historical marker manager to create the new marker) Im not sure if this is possible as there seems to be now way to do it as a geoprocess. But if anyone has maybe tried it/alternative method?
... View more
08-06-2013
10:38 PM
|
0
|
0
|
678
|
POST
|
Hi, I am writing a python script, which is a weekly update of a shapefile. (if I was not going to use my geodatabase it is essentially create new shapefile from excel sheet, copy old shapefile renaming it and copying it to my archive folder, and then copying the new shapefile and placing it in my current folder) but I definently do want to use my geodatabase archiving methods. However with geodatabase I have seen there is archiving options that reduce the need to rename/ move folder. but as there is no toolbox methods to do this is it even viable via python? Essentially I am wanting to write a python script to automate Geodatabase Archiving (Enable Archiving, Creating Historical Markers) is this possible?
... View more
08-05-2013
10:36 PM
|
0
|
9
|
841
|
POST
|
Hello, When I attempt to move a layer up or down in my LayerList Widget and also inside the "More.." button, the layer interacts very strangely. Initially clicking move down will move the layer down one place. If I choose to move it down again it will jump about 4 places in the list, moving it up is no problem unless it has been moved up twice already and then it can go up no further. the order of the list correctly alters the layer drawing order fine. But just the sporadic jumps in the list that baffle me. Anyone have a similar scenario or solution?
... View more
07-31-2013
12:08 AM
|
0
|
3
|
664
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|