POST
|
Here are the specific versions that worked for me but my argis pro is still python 3.6. Fiona 1.8.19 GDAL 3.2.3 I am doing all the install and uninstall with pip and .whl files in the command line. I have successfully installed this way on local machine and EC2 machine as well but it is tricky. The python version off the .whl need to match your python version. Other than version between GDAL and the Fiona I have not had any issues installing like this.
... View more
12-06-2021
10:25 AM
|
0
|
0
|
3107
|
POST
|
I have had this issue before, I think you should get the precompiled whl files from here https://www.lfd.uci.edu/~gohlke/pythonlibs/ . I downloaded gdal,fiona and geopandas. First I uninstalled the gdal version that comes with arcgisPro then I installed gdal,fiona then geopandas. I have only had luck installing these through command line. Make sure you download the precompiled library for your specific python version and the versions of fiona and gdal must be compatible.
... View more
12-04-2021
07:13 AM
|
0
|
3
|
4622
|
POST
|
I implemented persistence on the Dimension Style and now the Dimensions show up when I open a map with dimensions,
... View more
06-30-2019
10:35 AM
|
0
|
0
|
434
|
POST
|
I am trying to persist a custom dimension style in ArcMap with Arcobjects, I am getting this error when adding the style from the Stream in the Load method. at ESRI.Carto.IDimensionStyles.AddStyle() as DimToolbar.ApplicationExtension1.Load() in ...\DimToolbar ApplicationExtension1.cs: line 254 Here is the Load method line 254 is line 59 below. public void Load(IVariantStream Stream)
{
//TODO: Load persisted data from document stream
if(Stream!=null)
{
var count = (int)Stream.Read();
MessageBox.Show(count.ToString());
if (count > c_Version || count <= 0)
throw new Exception("Wrong version!");
string sName = "";
int iRefScale = 0;
string sExpression = "";
ITextSymbol pTextSymbol = null;
ILineSymbol pLineSymbol = null;
IMarkerSymbol pMrkrSymbol = null;
if (count == 2)
{
sName = (string)Stream.Read();
iRefScale = (int)Stream.Read();
sExpression = (string)Stream.Read();
pTextSymbol = (ITextSymbol)Stream.Read();
pLineSymbol = (ILineSymbol)Stream.Read();
pMrkrSymbol = (IMarkerSymbol)Stream.Read();
ILayer pLayer = ReturnLayerByName("DIM");
IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
ISchemaLock pSchemaLock = (ISchemaLock)pFeatureClass;
try
{
pSchemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
IDimensionClassExtension pDimExt = (IDimensionClassExtension)pFeatureClass.Extension;
pDimExt.ReferenceScale = iRefScale;
pDimExt.ReferenceScaleUnits = esriUnits.esriFeet;
IDimensionStyle pDimStyle = new DimensionStyleClass
{
Name = sName
};
IDimensionStyleDisplay pNewDimDisplay = (IDimensionStyleDisplay)pDimStyle;
pNewDimDisplay.MarkerDisplay = esriDimensionDisplay.esriDimensionDisplayBoth;
pNewDimDisplay.DimensionLineSymbol = pLineSymbol;
pNewDimDisplay.BeginMarkerSymbol = pMrkrSymbol;
pNewDimDisplay.EndMarkerSymbol = pMrkrSymbol;
pNewDimDisplay.MarkerFit = esriDimensionMarkerFit.esriDimensionMarkerFitText;
pNewDimDisplay.MarkerDisplay = esriDimensionDisplay.esriDimensionDisplayBoth;
pNewDimDisplay.DrawLineOnFit = false;
IDimensionStyleText pNewDimText = (IDimensionStyleText)pDimStyle;
pNewDimText.Expression = sExpression;
pNewDimText.ExpressionParserName = "Python";
pNewDimText.TextDisplay = esriDimensionTextDisplay.esriDimensionTDExpression;
pNewDimText.TextSymbol = pTextSymbol;
IDimensionStyles pDimStyles = pDimExt.DimensionStyles;
pDimExt.UpdateProperties();
pDimStyles.AddStyle(pDimStyle);
}
catch (COMException comExcept)
{
MessageBox.Show(comExcept.StackTrace.ToString());
}
finally
{
pSchemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
}
}
}
Marshal.ReleaseComObject(Stream);
} I am reading the stream in the same order it was written the dimension style seems to be added but there is something wrong with the text, the expression is in the dimension style after Load method runs but the text is not displayed, Here is screenshot of the python expression in the extension.
... View more
06-23-2019
04:03 AM
|
0
|
0
|
392
|
POST
|
I have a dimension feature class with a custom text expression, I would like to persist this dimension style so that the dimensions in my map do not disappear. I am currently trying to get schema lock on dimension feature class and Add the dimension style back to the Feature Class when the map opens. When I save and then reopen the map all the dimension style is present except the bearing expression but when I look at properties of dimension style in the feature class the expression is there. The next thing I am going to try is to write the dimension shape and properties to the stream and then recreate the feature class and add the features when the map is reopened, These dimensions are really hard to work with is there a workaround that behave similarly to bearing and distance style dimension I can use for property plats? Here is the Load and Save methods I am using. public void Load(IVariantStream Stream)
{
//TODO: Load persisted data from document stream
if(Stream!=null)
{
string sName = "";
int iRefScale = 0;
string sExpression = "";
ITextSymbol pTextSymbol = null;
ILineSymbol pLineSymbol = null;
IMarkerSymbol pMrkrSymbol = null;
sName = (string)Stream.Read();
iRefScale = (int)Stream.Read();
sExpression = (string)Stream.Read();
pTextSymbol = (ITextSymbol)Stream.Read();
pLineSymbol = (ILineSymbol)Stream.Read();
pMrkrSymbol = (IMarkerSymbol)Stream.Read();
ILayer pLayer = ReturnLayerByName("DIM");
IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
ISchemaLock pSchemaLock = (ISchemaLock)pFeatureClass;
try
{
pSchemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
IDimensionClassExtension pDimExt = (IDimensionClassExtension)pFeatureClass.Extension;
pDimExt.ReferenceScale = iRefScale;
pDimExt.ReferenceScaleUnits = esriUnits.esriFeet;
IDimensionStyle pDimStyle = new DimensionStyleClass
{
Name = sName
};
IDimensionStyleDisplay pNewDimDisplay = (IDimensionStyleDisplay)pDimStyle;
pNewDimDisplay.MarkerDisplay = esriDimensionDisplay.esriDimensionDisplayBoth;
pNewDimDisplay.DimensionLineSymbol = pLineSymbol;
pNewDimDisplay.BeginMarkerSymbol = pMrkrSymbol;
pNewDimDisplay.EndMarkerSymbol = pMrkrSymbol;
pNewDimDisplay.MarkerFit = esriDimensionMarkerFit.esriDimensionMarkerFitText;
pNewDimDisplay.MarkerDisplay = esriDimensionDisplay.esriDimensionDisplayBoth;
pNewDimDisplay.DrawLineOnFit = false;
IDimensionStyleText pNewDimText = (IDimensionStyleText)pDimStyle;
pNewDimText.Expression = sExpression;
pNewDimText.ExpressionParserName = "Python";
pNewDimText.TextDisplay = esriDimensionTextDisplay.esriDimensionTDExpression;
pNewDimText.TextSymbol = pTextSymbol;
pDimExt.UpdateProperties();
IDimensionStyles pDimStyles = pDimExt.DimensionStyles;
pDimStyles.AddStyle(pDimStyle);
}
catch (COMException comExcept)
{
MessageBox.Show(comExcept.StackTrace.ToString());
}
finally
{
pSchemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
}
}
Marshal.ReleaseComObject(Stream);
} public void Save(IVariantStream Stream)
{
//TODO: Save extension related data to document stream
if (DimStyleModel.Name != "")
{
Stream.Write(DimStyleModel.Name.ToString());
MessageBox.Show(DimStyleModel.Name.ToString());
Stream.Write(DimStyleModel.RefScale);
Stream.Write(DimStyleModel.Expression);
Stream.Write(DimStyleModel.TextSymbol);
Stream.Write(DimStyleModel.LineSymbol);
Stream.Write(DimStyleModel.MrkrSymbol);
}
Marshal.ReleaseComObject(Stream);
}
... View more
06-15-2019
05:03 AM
|
0
|
0
|
331
|
POST
|
I create dimension feature class I change the style, add dimensions to my map but when I reopen the map the dimensions are gone? Is there documentation I can read about this behavior. I am also interested in creating dimensions with python code but I have found no examples. Update- I created a button that creates a dim with style inside a geodatabase, now when I close and open the map the dimensions are just red polygons. after close and open arcmap before close and open Here is the code I sued to create the dimension feature class. IFeatureLayer pFeatureLayer = (IFeatureLayer)pBoundaryLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
string strCatalogPath = GetCatalogPath(pFeatureClass);
IWorkspace pWorkspace = FileGDBWorkspaceFromPropertySet(strCatalogPath);
IObjectClassDescription ocDescription = new DimensionClassDescription();
IFields pRequiredFields = ocDescription.RequiredFields;
int intShapeFieldPosition = pRequiredFields.FindField("Shape");
IField pShapeField = pRequiredFields.get_Field(intShapeFieldPosition);
IGeometryDef pGeomDef = pShapeField.GeometryDef;
IGeometryDefEdit pGeomDefEdit = (IGeometryDefEdit)pGeomDef;
ISpatialReferenceFactory3 pSpatRefFac = new SpatialReferenceEnvironmentClass();
ISpatialReference pSpatRef = pSpatRefFac.CreateSpatialReference(6578);
IProjectedCoordinateSystem pProSpatRef = (IProjectedCoordinateSystem)pSpatRef;
ILinearUnit linUnit = pProSpatRef.CoordinateUnit;
pGeomDefEdit.SpatialReference_2 = pSpatRef;
IFeatureWorkspace pFeatWorkspace = (IFeatureWorkspace)pWorkspace;
string pName = "DIM";
IFeatureClass pNewFeatureClass = pFeatWorkspace.CreateFeatureClass(pName.ToString(), pRequiredFields, ocDescription.InstanceCLSID, ocDescription.ClassExtensionCLSID, esriFeatureType.esriFTDimension, "Shape", "");
ISchemaLock schemaLock = (ISchemaLock)pNewFeatureClass;
try
{
schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
IDimensionClassExtension dimExtension = (IDimensionClassExtension)pNewFeatureClass.Extension;
dimExtension.ReferenceScale = 12000;
dimExtension.ReferenceScaleUnits = esriUnits.esriFeet;
IDimensionStyle dimensionStyle = new DimensionStyleClass();
dimensionStyle.Name = "BEARING_DISTANCE";
IDimensionStyleText dimText = (IDimensionStyleText)dimensionStyle;
string expression = "def FindLabel ( [DIMLENGTH], [BEGINX] , [BEGINY] , [ENDX] , [ENDY] ):" + Environment.NewLine +
" import math" + Environment.NewLine +
" dY = float([ENDY]) -float( [BEGINY])" + Environment.NewLine +
" dX = float( [ENDX])-float( [BEGINX])" + Environment.NewLine +
" azimuth = math.atan2(dX, dY) * 180 / math.pi" + Environment.NewLine +
" if azimuth < 0:" + Environment.NewLine +
" azimuth = azimuth + 360" + Environment.NewLine +
" if azimuth > 270 and azimuth<= 360:" + Environment.NewLine +
" bearing = 360 - azimuth" + Environment.NewLine +
" minutes,seconds = divmod(bearing * 3600, 60)" + Environment.NewLine +
" degrees,minutes = divmod(minutes, 60)" + Environment.NewLine +
" dmsBearing = \"N \" + str(int(degrees)) + \"°\" + str(int(minutes)) + \"'\" + str(round(seconds, 2)) + \" W\"" + Environment.NewLine +
" return dmsBearing + \" \" + str(round(float( [DIMLENGTH]), 2))+\"'\"" + Environment.NewLine +
" if azimuth > 180 and azimuth<= 270:" + Environment.NewLine +
" bearing = azimuth - 180" + Environment.NewLine +
" minutes,seconds = divmod(bearing * 3600, 60)"+ Environment.NewLine +
" degrees,minutes = divmod(minutes, 60)"+ Environment.NewLine +
" dmsBearing = \"S \" + str(int(degrees)) + \"°\" + str(int(minutes)) + \"'\" + str(round(seconds, 2)) + \" W\"" + Environment.NewLine +
" return dmsBearing + \" \" + str(round(float( [DIMLENGTH]), 2))+\"'\"" + Environment.NewLine +
" if azimuth > 90 and azimuth<= 180:" + Environment.NewLine +
" bearing = 180 - azimuth" + Environment.NewLine +
" minutes,seconds = divmod(bearing * 3600, 60)" + Environment.NewLine +
" degrees,minutes = divmod(minutes, 60)" + Environment.NewLine +
" dmsBearing = \"S \" + str(int(degrees)) + \"°\" + str(int(minutes)) + \"'\" + str(round(seconds, 2)) + \" E\"" + Environment.NewLine +
" return dmsBearing + \" \" + str(round(float( [DIMLENGTH]), 2))+\"'\"" + Environment.NewLine +
" if azimuth >= 0 and azimuth<= 90:" + Environment.NewLine +
" minutes,seconds = divmod(azimuth * 3600, 60)" + Environment.NewLine +
" degrees,minutes = divmod(minutes, 60)" + Environment.NewLine +
" dmsBearing = \"N \" + str(int(degrees)) + \"°\" + str(int(minutes)) + \"'\" + str(round(seconds, 2)) + \" E\"" + Environment.NewLine +
" return dmsBearing + \" \" + str(round(float( [DIMLENGTH]), 2))+\"'\"" + Environment.NewLine +
" else:" + Environment.NewLine +
" if azimuth > 270 and azimuth<= 360:" + Environment.NewLine +
" bearing = 360 - azimuth" + Environment.NewLine +
" minutes,seconds = divmod(bearing * 3600, 60)" + Environment.NewLine +
" degrees,minutes = divmod(minutes, 60)" + Environment.NewLine +
" dmsBearing = \"N \" + str(int(degrees)) + \"°\" + str(int(minutes)) + \"'\" + str(round(seconds, 2)) + \" W\"" + Environment.NewLine +
" return dmsBearing + \" \" + str(round(float( [DIMLENGTH]), 2))+\"'\"" + Environment.NewLine +
" if azimuth > 180 and azimuth<= 270:" + Environment.NewLine +
" bearing = azimuth - 180" + Environment.NewLine +
" minutes,seconds = divmod(bearing * 3600, 60)" + Environment.NewLine +
" degrees,minutes = divmod(minutes, 60)" + Environment.NewLine +
" dmsBearing = \"S \" + str(int(degrees)) + \"°\" + str(int(minutes)) + \"'\" + str(round(seconds, 2)) + \" W\"" + Environment.NewLine +
" return dmsBearing + \" \" + str(round(float( [DIMLENGTH]), 2))+\"'\"" + Environment.NewLine +
" if azimuth > 90 and azimuth<= 180:" + Environment.NewLine +
" bearing = 180 - azimuth" + Environment.NewLine +
" minutes,seconds = divmod(bearing * 3600, 60)" + Environment.NewLine +
" degrees,minutes = divmod(minutes, 60)" + Environment.NewLine +
" dmsBearing = \"S \" + str(int(degrees)) + \"°\" + str(int(minutes)) + \"'\" + str(round(seconds, 2)) + \" E\"" + Environment.NewLine +
" return dmsBearing + \" \" + str(round(float( [DIMLENGTH]), 2))+\"'\"" + Environment.NewLine +
" if azimuth >= 0 and azimuth<= 90:" + Environment.NewLine +
" minutes,seconds = divmod(azimuth * 3600, 60)" + Environment.NewLine +
" degrees,minutes = divmod(minutes, 60)" + Environment.NewLine +
" dmsBearing = \"N \" + str(int(degrees)) + \"°\" + str(int(minutes)) + \"'\" + str(round(seconds, 2)) + \" E\"" + Environment.NewLine +
" return dmsBearing + \" \" + str(round(float( [DIMLENGTH]), 2))+\"'\"";
dimText.Expression = expression;
dimText.ExpressionSimple = false;
dimText.ExpressionParserName = "Python";
dimText.TextDisplay = esriDimensionTextDisplay.esriDimensionTDExpression;
dimText.ExtendLineOnFit = false;
stdole.IFontDisp iFont = new stdole.StdFontClass() as stdole.IFontDisp;
iFont.Name = "Arial";
iFont.Size = 8;
ITextSymbol txtSymbol = new TextSymbol();
txtSymbol.Font = iFont;
dimText.TextSymbol = txtSymbol;
IDimensionStyleDisplay dimDisplay = (IDimensionStyleDisplay)dimensionStyle;
dimDisplay.MarkerDisplay = esriDimensionDisplay.esriDimensionDisplayBoth;
IArrowMarkerSymbol mrkrSym = new ArrowMarkerSymbolClass();
mrkrSym.Size = 6;
IMarkerSymbol newMrkrSym = (IMarkerSymbol)mrkrSym;
dimDisplay.BeginMarkerSymbol = newMrkrSym;
dimDisplay.EndMarkerSymbol = newMrkrSym;
dimDisplay.MarkerFit = esriDimensionMarkerFit.esriDimensionMarkerFitText;
IDimensionStyles dimensionStyles = dimExtension.DimensionStyles;
dimensionStyles.AddStyle(dimensionStyle);
}
catch(COMException comExcept)
{
MessageBox.Show(comExcept.StackTrace.ToString());
}
finally
{
schemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
MessageBox.Show("The Dimension Feature Class Has Been Created");
} Is there something I can add to make this layer persist?
... View more
06-06-2019
01:27 AM
|
0
|
1
|
496
|
POST
|
I am wondering if it is possible to create dimensions in arcmap with python, arcmap version 10.7. I have looked and I see functions to list dims but not create them. Also when I create a dimension in esri dimension feature class the dimensions are gone when I reopen the map I get error "can not initialize COM object" then has layer name for dimension layer.
... View more
05-26-2019
11:45 AM
|
0
|
1
|
677
|
POST
|
Would you happen to have link for tech support or a best way to contact, do I need to go through my sales rep?
... View more
04-03-2019
03:35 PM
|
0
|
1
|
1014
|
POST
|
It looks like I should be able to run the software. I did not have problem with crashes until recently.
... View more
04-03-2019
02:31 PM
|
0
|
3
|
1014
|
POST
|
Here is the report, I did not have a problem with crashes until now.
... View more
04-03-2019
02:29 PM
|
0
|
0
|
1014
|
POST
|
Yes that i correct, 2.3.2 is the version of Pro I have,
... View more
04-03-2019
02:27 PM
|
0
|
0
|
1014
|
POST
|
I am having problems with arcgis pro crashing on projects that have been opened several times and that have imagery background. I don't have this problem in ArcMap. I can create a new project and it works but after the project has been saved and opened several times and if the project has imagery (WMTS) the project crash will crash on open. I have sent in error report. I have an NVIDIA graphics card with an integrated intel UHD 630.
... View more
04-03-2019
12:29 PM
|
0
|
8
|
1114
|
POST
|
I am trying to hide some fields with an add-in. The documentation says that the IsVisible property for a FieldDescriptions object can be get or set. I am coming from python so I am not sure if setting the property is quiet the same in c#. Here is link to IsVisible porperty ArcGIS Pro 2.2 API Reference Guide Here is the code I have so far internal class Hide : Button
{
protected async override void OnClick()
{
await HideFields();
}
public Task HideFields()
{
return QueuedTask.Run(() =>
{
List<string> fieldList = new List<string>() { "NORTH","EAST","HRMS","PDOP","SATELLITES","LATITUDE","LONGITUDE","PHOTO","PRODUCT_TYPE","LINE_TYPE","AFE","FILE_NAME","WELD_TYPE","WELD_LOCATION","XRAY_PERCENTAGE"};
var mapView = MapView.Active;
var listLayers = mapView.Map.Layers.OfType<FeatureLayer>();
foreach(var lyr in listLayers.ToList())
{
var fields = lyr.GetFieldDescriptions().Where(f => fieldList.Contains(f.Name, StringComparer.OrdinalIgnoreCase));
foreach(var field in fields)
{
FieldDescription fieldDesc = field;
fieldDesc.IsVisible=false;
//MessageBox.Show(field.Name.ToString());
}
}
});
}
}
... View more
10-17-2018
02:51 AM
|
0
|
1
|
879
|
Online Status |
Offline
|
Date Last Visited |
07-15-2023
06:24 PM
|