Hot answers tagged

8

With help from Mark Cederholm I have a working solution using python and arcobjects. It's rough around the edges, but it got the job done. After following the recipe on that page, create a new script which uses the GetLibPath, NewObj, CType, OpenFeatureClass functions from snippets.py. Also create the rename lookup tables in .csv format: Field to Field ...


7

If the layer implements the IDataLayer interface (most layers do), you can access its IDataLayer.DataSourceName property. For example, for a feature layer, this property will return the FeatureClassName object, which provides various interfaces to examine the data source.


6

It should be possible to cast your featurelayer to ITableFields, then loop through each ITableField.FieldInfo and set IFieldInfo.Alias. Last time I checked no error was raised when I assigned more than one field the same alias, so be careful. Update: Field aliases can be confusing. There's an alias for fields that are stored in the database ...


5

This code works for me in 9.3.1 ... public static void TestAlterAlias(IApplication app) { // make a dictionary of old/new names Dictionary<string, string> nameDict = new Dictionary<string, string>(StringComparer.CurrentCultureIgnoreCase); nameDict.Add("qsectionalias", "qsectionalias2"); nameDict.Add("sursysalias", ...


2

As of version 10.1 AlterAliasName() can be used to re-alias tables: table = r"C:\path\to\connection.sde\OWNER.TABLE" arcpy.AlterAliasName(table, "table_alias") As of version 10.3 Alter Field can be used to re-alias fields: table = r"C:\path\to\connection.sde\OWNER.TABLE" arcpy.AlterField_management(table, "FIELD_NAME", new_field_alias="field_alias")


2

i know that the this post almost closed but i think it's not bad to say my solution. this solution is for user that use SQL server as geodatabase. you can manually change it by an SQL update command. all feature's name save in [sde].[GDB_OBJECTCLASSES] table. the alias name set simply if you change the alias column value . UPDATE ...


2

Another solution courtesy of Rob Clark: You could use featureclass_to_featureclass with field mapping. Yes it creates another feature class but you could just have an output area to copy data and change aliases whilst it's doing it. In python the syntax for the field_map part is tricky so go through it once interactively to set the parameters ...


2

This seems to work when you have a simple feature layer, however when the feature layer is joined the same code appears to run but actually has no effect. I am using ArcMap 9.1 and VB.Net. As I say this sub will work but only on the unjoined layer. On a joined layer the MessageBox returns false but looking in the Fields tab on properties shows all attributes ...


2

To simplify matters, I'll assume your excel spreadsheet is really a csv file with no headers and is formed like: field_name,alias: import arcpy, csv csvfile = "<path to file>" FC = "<path to feature class>" #List of tuples name_alias = [rows for rows in csv.reader(open(csvfile))] errors = [] for name,alias in name_alias: try: ...


2

Your function is expecting a feature class Shared Sub ShowDistinctFieldAliasNames(ByVal featureClass As IFeatureClass) but you're passing in a document ShowDistinctFieldAliasNames(My.ArcMap.Document) To pass in a feature class, you'll have to find a layer in that document and verify that it's a feature class. Something like this: dim pLayer As ...


1

Instead of a bug I would call it a WAD (Work As Designed). The changes has to be saved as a project, if you want to persist the changes. You could add a feature request to the QGIS development team (some help) to get the alias and metadata saved in a QGIS Layer Style File (*.qml). A side note: On of the strong things of qml-files is that if you name them ...


1

We tried to solve this problem directly inside the locator: <alias_list name="CityAliases"> <alias_def> <alt>New York</alt> <alt>NY</alt> <alt>etc</alt> </alias_def> <alias_def> <alt>Portland</alt> <altPT</alt> ...


1

This is not possible right now (without reimplementing the whole form view in python). Please open a feature request, consider creating a pull request or funding somebody to implement this.


1

This will fail as the source doesn't exist. Try using a property dialog...and retrieve the value from there. Refer this link and this forum link



Only top voted, non community-wiki answers of a minimum length are eligible