Automatic code selection based on database attributes when loading Shapefiles or Geomedia

September 30, 2016 conditions geomedia shapefile

If you load a map contained in a database, such as Geomedia or Shapefile, the coordinates of the geometry are one more field among all the fields that each of the tables in the database has. For example, suppose a Shapefile named Road that stores road geometries: In the table we have an identifier of the geometry, the geometry itself, as well as a field that stores the number of lanes of the road and its name, as you can see below...

ID geometry* Carriles Name
1233 100,100, 110, 100, ... 2 C230
1234 200,200, 210, 200, ... 6 M-30
* Actually in a shapefile the geometries are stored in the .SHP file and not in the database itself, but there is a relationship 1 <-> 1 between the number of records in the database and the number of geometries stored in the .SHP file, so we can assume that what is in the .SHP is one more field of the database.

We could create a code table with the code Vias that simply links to this database table, in this way Digi3D.NET when loading the Shapefile of vías would create two entities with the code Vias, but maybe we want to differentiate the type of road based on the number of lanes. This can be done using the option Conditions that appears in the Database section for each of the codes that appear in the Codes tab of the program Code table editor. Conditions consist of triples [field][operator][value]. You can use the following operators:

Operator Meaning
< Less than
<= Less than or equal to
= Equal to
>= Greater than or equal to
> Greater than

You can put as many conditions as you want (separated by commas), you can even use the same field name several times, and all of them must be met in order for a code to be selected. So in our example we would have to specify the following conditions:

Code Condition
Road Lanes=2
Motorway Rails>2

Download the files with which we have created the video of the following link. You can see this feature in action in the following video:


Back to the blog