Monthly Archives: April 2011

Tips & Tricks: FieldExists for ArcGIS 10 Python

Here is a way to check if a Field in a feature class already exists or not. I was looking for an existing ArcGIS Esri function / tool but couldn’t find one so I wrote my own.

def FieldExist(featureclass, fieldname):
    fieldList = arcpy.ListFields(featureclass, fieldname)

    fieldCount = len(fieldList)

    if (fieldCount == 1):
        return True
        return False

This is a function and it assumes you have already set the workspace environment.


        if (not FieldExist(myFeatureClass, "myField")):
          arcpy.AddError("Field 'myField' does not exist in " + myFeatureClass)

hope this is helpful.

Tips & Tricks: Extending your Entity Framework classes

There are different reasons why you would like to extend the existing properties on your entity framework classes, for instance when you want to add data validation attributes or the display attribute, commonly used in ASP.Net MVC to set the ‘display’ name of the property.

Here is how to do it without editing your auto generated Entity Framework (.edmx) file. ‘author’ is the entity framework class.

    public partial class author

    public class authorMetadata
        [Display(Name = "First name")]
        public string firstname { get; set; }

We further extend the original author class by adding another partial class and specify which class contains the metadata for the class using the Metadatatype attribute.

Windows Phone and the WriteableBitMapEx

I was investigating the use of the WriteableBitmap class and came across a great extension pack WriteableBitMapEx.

This also pointed me to a great demo written by Bill Reiss, explaining Blitting and Blending of images with the WriteableBitmap class. His original example was written in Silverlight and I was interested to see how easy it would be to port it to the Windows Phone and see how the performance would be.

Well it was really easy! I didn’t need to rewrite any code and hadn’t any problems with performance (in the emulator – Sadly enough i don’t have an actual Windows Phone yet)!

Here is the result:

Particle Windows Phone demo from Bjorn Kuiper on Vimeo.

Try it out yourself, here is the sourcecode of the Windows Phone solution:

Download the sourcecode.

Windows Phone development made easy! I love it that I don’t need to learn a new programming language to make my own phone apps!