F# and ArcObjects

Posted by Marko Apfel on Geeks with Blogs See other posts from Geeks with Blogs or by Marko Apfel
Published on Thu, 25 Mar 2010 08:58:26 GMT Indexed on 2010/03/25 16:03 UTC
Read the original article Hit count: 599

Filed under:

After having a first look on F# its time to ask: Who could i use F# with ArcObjects.

So my first steps was to do something with a feature in a F# interactive session.
And these are my first code lines:

open ESRI.ArcGIS.esriSystem;;
open ESRI.ArcGIS.DataSourcesGDB;;
open ESRI.ArcGIS.Geodatabase;;

let aoInitialize = new AoInitializeClass();;

let status = aoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcEditor);;

let workspacefactory = new SdeWorkspaceFactoryClass();;

// Spatial Database Connection, property "Service": sde:sqlserver:okul
let connection = "user=sfg;password=gfs;server=OKUL;database=Praxair;version=SDE.DEFAULT";;

let workspace = workspacefactory.OpenFromString(connection, 0);;

let featureWorkspace = (box workspace) :?> IFeatureWorkspace;;

let featureClass = featureWorkspace.OpenFeatureClass("Praxair.SFG.BP_L_ROHR");;

let feature = featureClass.GetFeature(100);;

printfn "%A" feature.OID;;

© Geeks with Blogs or respective owner