POST
|
All, 1/ I do query and zoom to selection in layout view. 2/ If I have only 1 map frame, the below codes work just fine. 3/ When I added a another map frame for locator map, I got the error "layer does not exist". I guess I have to specify which map it should use but I don't know how. Thanks for your help. var myLyr =
MapView.Active.Map.FindLayers(featureLayerName).FirstOrDefault() as FeatureLayer;
if (myLyr == null) throw new Exception(string.Format("The feature class: {0} does not exist", featureLayerName));
... View more
09-15-2020
12:45 PM
|
0
|
1
|
752
|
POST
|
Hi Uma Harano, Line 12 returns an error : graphic shape property can not be null or empty. What did I do wrong? maxPoint is not null. Thank you! var poly = shape.GetShape() as Polygon;
var maxX= poly.Extent.MMax;
var maxY= poly.Extent.YMax;
MapPoint maxPoint = MapPointBuilder.CreateMapPoint(maxX, maxY);
if (maxPoint != null)
{
myLabelGraphic.Shape = maxPoint;
myLabelGraphic.Placement = Anchor.CenterPoint;
myLabelGraphic.Text = myText;
myLabelGraphic.Symbol = myTextSymbol.MakeSymbolReference();
graphicsLayer.AddElement(myLabelGraphic);
}
... View more
09-15-2020
12:01 PM
|
1
|
2
|
867
|
POST
|
Hi I'm trying to have an element placed at the bottom left corner of the selected feature but can't figure out how to do it. I can place it at the center of the polygon fine but not at any other positions. Your help is much appreciated. while (foundCursor.MoveNext()) { using (var row = foundCursor.Current) { var shape = row as Feature; var poly = shape.GetShape() as Polygon; myLabelGraphic.Shape = poly.Extent; myLabelGraphic.Placement = Anchor.BottomLeftCorner; }
... View more
09-13-2020
11:49 PM
|
0
|
4
|
914
|
POST
|
I guess I didn't have it defined. I'm not familiar with python so please excuse my stupid questions above. I'll try to see if I can define the argv. Thank you!
... View more
08-21-2020
10:36 AM
|
0
|
0
|
994
|
POST
|
All, My python codes were generated from ModelBuilder. At the process of "Table To Excel" I need to have 2 parameters: File_Path and File_Name. So in "Properties" of Script, I add those 2 parameters but the parameter for File Path doesn't work. No error but file was saved to the "Scratch" folder. What step that I missed? Thanks for your help. # Model Environment settings
with arcpy.EnvManager(scratchWorkspace=r"C:\ModelBuilder\Scratch\Output.gdb", workspace=r"C:\ModelBuilder\Scratch\Output.gdb"):
Output_gdb = "C:\\ModelBuilder\\Scratch\\Output.gdb"
# Process: Table To Excel (Table To Excel) (conversion)
arcpy.conversion.TableToExcel(Input_Table=Parcels_Lots_DeleteIdentical, Output_Excel_File=ExcelFileName_xls, Use_field_alias_as_column_header="ALIAS", Use_domain_and_subtype_description="DESCRIPTION")
if __name__ == '__main__':
SqftMapToExcelNewLoc(*argv[2:])
... View more
08-21-2020
05:42 AM
|
1
|
2
|
1018
|
POST
|
That's it. Triple quotes solved my issue. Thank you so much Dan Patterson.
... View more
08-21-2020
04:31 AM
|
0
|
0
|
634
|
POST
|
All, My model works fine but when I export it to python I got syntax error SyntaxError: "EOL while scanning string literal" . Any idea why? I've tried many simple calculation functions. Got same errors for all. Thank you! EX: # Process: CalField_Ac (Calculate Field) (management)
ToAcres = arcpy.management.CalculateField(in_table=FromSqft, field="Acres", expression="round((float(!Sqft!)/43560),4)", expression_type="PYTHON3", code_block="", field_type="TEXT")[0]
or # Process: CalField_BlkNum (Calculate Field) (management)
Calculate_BlkNum = arcpy.management.CalculateField(in_table=myTable, field="Blk_Num", expression="fn(!Blk_Num!,!Acct_Num!)", expression_type="PYTHON3", code_block="def fn(Blk_Num,Acct_Num):
if (Blk_Num) is not None:
return Blk_Num
else:
return 1
", field_type="TEXT")[0]
... View more
08-20-2020
02:22 PM
|
0
|
2
|
667
|
POST
|
Hi Rich, I'm a little confused here so let's clarify more about my table. Yes I can have my table live inside a geodatabase but my table is just a tabular table. In ArcObjects for Arcmap addin, I used these codes to update a sql table doesn't matter where my table is. So you say in ProSDK I can no longer do that? Thanks Rich! Dim sqlConnection As New SqlConnection(sConStr) Dim cmdUpdate As New SqlCommand cmdUpdate.Connection = sqlConnection cmdUpdate.CommandType = CommandType.StoredProcedure cmdUpdate.CommandText = "sp_CalculateRate" cmdUpdate.Parameters.Add(New SqlParameter With {.ParameterName = "@ABCD", .SqlDbType = SqlDbType.VarChar, .Value = strABCD}) cmdUpdate.Parameters.Add(New SqlParameter With {.ParameterName = "@EFGH", .SqlDbType = SqlDbType.VarChar, .Value = strEFGH}) sqlConnection.Open() cmdUpdate.ExecuteNonQuery() cmdUpdate.Dispose() sqlConnection.Close()
... View more
07-23-2020
08:36 AM
|
0
|
2
|
1190
|
POST
|
Correct it's just a sql table in database NOT a geodatabase. My end goal to to have a sql table with a common field with my feature layer and the two joined so I can label my feature layer using a field from the sql table since I'm not allowed to edit the feature layer. Or is there a better way to achieve what I need to do? Thank you Rich.
... View more
07-22-2020
06:14 AM
|
0
|
4
|
1190
|
POST
|
Hi, I'd like to update my stand alone sql table base on values returned from my selection set. I was able to get the selection part but I couldn't find any snippets for updating sql table. Thank you for your help. Your help is greatly appreciated.
... View more
07-21-2020
11:09 AM
|
0
|
6
|
1319
|
POST
|
In ArcObjects I placed text element at centroid of selected features. If I want to do the same thing in Pro SDK what snippets should I look for ? Is it the overlay? Can I do this in layout view ? My users asked me to keep the old way so they can move the callouts around to their taste . Thank you. Public Sub AddCompCallout_mapview(pFeature As IFeature, strCompLabel As String, strCompNum As String)
'add callout text
Dim pTextElement As ITextElement
pTextElement = New TextElement
Dim pElement As IElement
pElement = pTextElement
pTextElement.Text = strCompLabel + " " + strCompNum
Dim pArea As IArea
Dim pPointCentroid As IPoint = New Point
Dim pPointAnchor As IPoint = New Point
Dim pEnv As New Envelope
pEnv = pActiveview.Extent
pEnv.XMax = pFeature.Shape.Envelope.XMax
pEnv.XMin = pFeature.Shape.Envelope.XMin
pEnv.YMax = pFeature.Shape.Envelope.YMax
pEnv.YMin = pFeature.Shape.Envelope.YMin
pArea = pFeature.Shape
pPointCentroid.PutCoords(pEnv.LowerRight.X, pEnv.UpperRight.Y)
pPointAnchor = pArea.Centroid
pElement.Geometry = pPointCentroid
'font
Dim pFontDisp As stdole.IFontDisp
pFontDisp = New stdole.StdFont
pFontDisp.Name = "Arial"
pFontDisp.Bold = True
pFontDisp.Size = 14
'color
Dim pColor As ESRI.ArcGIS.Display.IRgbColor = New RgbColor
pColor.Blue = 255
pColor.Green = 0
pColor.Red = 0
Dim pTextSymbol As IFormattedTextSymbol
pTextSymbol = New TextSymbol
Dim pCallout As ICallout
pCallout = New BalloonCallout
pTextSymbol.Background = pCallout
pTextSymbol.Color = pColor
pTextSymbol.Font = pFontDisp
pCallout.AnchorPoint = pPointAnchor
Dim pMargin As ITextMargins
pMargin = pCallout
With pMargin
.LeftMargin = 1
.RightMargin = 1
.BottomMargin = 1
.TopMargin = 1
End With
pTextElement.Symbol = pTextSymbol
Dim pGraphicsContainer As IGraphicsContainer
pGraphicsContainer = pMxDoc.ActiveView
'pGraphicsContainer.DeleteAllElements()
pGraphicsContainer.AddElement(pElement, 0)
pElement.Activate(pMxDoc.ActiveView.ScreenDisplay)
pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Nothing, Nothing)
End Sub
... View more
06-23-2020
12:30 PM
|
0
|
0
|
689
|
POST
|
Yes there's order. I have a listbox that store all accounts to search for in order. Thanks.
... View more
06-22-2020
10:03 AM
|
0
|
2
|
689
|
POST
|
Hi all, My ultimate goal to add callout text to my selected features with an incremental value like "sale 1", "sale 2"," sale 3" ect... What I have right now is to set up label to display label in callout text and use this snippet to turn the label on for selected features. My issue is my label doesn't come from attribute table and each label is different from the others. How do I modify this code to make it work or if this approach doesn't work in my case, what else could I use to accomplish it? Thank you very much. //Layer to label. US Cities lyr was used
var lyrOfInterest = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
QueuedTask.Run(() => {
var selection = MapView.Active.Map.GetSelection();
//Get the OIDs of the selected features
//We will use this to label those features only
var selectedOIDs = selection[lyrOfInterest];
//Get the layer's definition
var lyrDefn = lyrOfInterest.GetDefinition() as CIMFeatureLayer;
if (lyrDefn == null) return;
//Get the label classes - we need the first one
//Or you could create a new label class
var listLabelClasses = lyrDefn.LabelClasses.ToList();
var theLabelClass = listLabelClasses.FirstOrDefault();
//set the label class Expression to use the Arcade expression
theLabelClass.Expression = "$feature.CITY_NAME"; //label using city name
//Where clause is set to the OIDs of the selected features
theLabelClass.WhereClause = $"OBJECTID IN ({string.Join(",", selectedOIDs)})";
//theLabelClass.TextSymbol = Set to any text symbol you want
//Set the label definition back to the layer.
lyrOfInterest.SetDefinition(lyrDefn);
lyrOfInterest.SetLabelVisibility(true);
});
... View more
06-22-2020
06:45 AM
|
0
|
4
|
946
|
POST
|
Hello Uma, I hope you could help me a bit more regarding labeling issue above. My end goal is to loop through the selection and assign an incremental # to the label for each selected feature. Ex: Sale 1, Sale 2, Sale 4. These customized labels won't be from in any attribute field. How do I do that? Thanks in advance.
... View more
06-18-2020
11:11 AM
|
0
|
0
|
805
|
Title | Kudos | Posted |
---|---|---|
1 | 08-21-2020 05:42 AM | |
1 | 09-28-2021 05:11 AM | |
1 | 09-17-2021 10:17 AM | |
1 | 05-19-2020 04:39 AM | |
1 | 09-21-2018 02:06 PM |
Online Status |
Offline
|
Date Last Visited |
01-19-2022
01:25 PM
|