Maptitude GISDK Help

Fields in a Layer

GISDK also includes a function that returns the field names and field specs for all the fields that are mappable to a layer. These lists contain all the fields from any view that is mappable to the layer, with duplicates eliminated. Here is the summary:

 

GISDK Function

Summary

GetMappableFieldIndices()

Determines the positions of mappable fields in the arrays returned by GetMappableFields()

GetMappableFields()

Create a list of the fields that are mappable to a layer

 

Here is an example that shows how you read the field names from views and layers.

 

// Open a layer and two dBASE files

// The State layer has three fields: ID, Name, Population

// sales80.dbf has three fields: State, Region, Sales80

// sales90.dbf has three fields: State, Region, Sales90

 

State_lyr = AddLayerToWorkspace("States", "c:\\cdf\\state001", "States")

sales_80 = OpenTable("1980 Sales", "DBASE", "c:\\dbffiles\\sales80.dbf", )

sales_90 = OpenTable("1990 Sales", "DBASE", "c:\\dbffiles\\sales90.dbf", )

 

// Now get a list of all the fields in the state layer

tmp = GetFields(state_lyr, "All")

state_fld_names = tmp[1]

// {"ID", "Name", "Population"}

state_fld_specs = tmp[2]

// {States.ID", "States.Name", "States.Population"}

 

// Get a list of all numeric fields in the sales80 layer

tmp = GetFields(sales_80, "Numeric")

sales80_fnames = tmp[1

// {"Sales80"}

sales80_fspecs = tmp[2]

// {"[1980 Sales].Sales80"}

 

// Get a list of all string fields in the sales90 layer

tmp = GetFields(sales_90, "String")

sales90_fnames = tmp[1]

// {"State", "Region"}

sales90_fspecs = tmp[2]

// {"[1990 Sales].State", [1990 Sales].Region"}

 

// Join the state layer to each of the sales views

jv1 = JoinViews("1980 Sales by State", state_lyr + ".Name", sales_80+ ".State", )

jv2 = JoinViews("1990 Sales by State", state_lyr + ".Name", sales_90+ ".State", )

 

// Now get a list of all the fields in one of joined views

tmp = GetFields(jv1, "All")

state_fld_names = tmp[1]

// {"ID", "Name", "Population", "State", "Region", "Sales80"}

state_fld_specs = tmp[2]

// {"[1980 Sales by State].ID",

 

// "[1980 Sales by State].Name",

 

// "[1980 Sales by State].Population",

 

// "[1980 Sales by State].State",

 

// "[1980 Sales by State].Region",

 

// "[1980 Sales by State].Sales80"}

 

// Finally, get a list of all fields that are mappable to the state layer...

tmp = GetMappableFields(state_lyr, "All")

mfld_names = tmp[1]

// {"ID", "Name", "Population",

 

// "[1980 Sales].State", "[1980 Sales].Region", "Sales80",

 

// "[1990 Sales].State", "[1990 Sales].Region", "Sales90"}

mfld_specs = tmp[2]

// {"States.ID", "States.Name", "States.Population",

 

// "States.[1980 Sales].State", "States.[1980 Sales].Region",

 

// "States.Sales80", "States.[1990 Sales].State",

 

// "States.[1990 Sales].Region", " States.Sales90"}

 

 

©2025 Caliper Corporation www.caliper.com