Wednesday, October 14, 2009

Find free end points with GeoMedia


I wanted to find free end points of some linear geometry features using only GeoMedia or GeoMedia Professional's built-in tools without resorting to using third party applications like MRF Clean. An example linear feature set is shown below. Note that the line work is already broken up at the intersection.

I tried GeoMedia Professional's Validate Connectivity command but it doesn't quite give me a completely satisfying result. After some trial and error, I finally worked out a solution using GeoMedia's Functional Attributes, Union, Spatial Query, Attribute Query, Spatial Intersection, and Spatial Difference commands. In a nutshell, the idea can be broken down into the following parts:
  • Get a list of all the starting and ending points of the line geometries
  • Use Spatial Intersection to determine which points are intersecting with which points
  • Use Spatial Difference command to subtract away the points connected to 2 or more line segments to get the free end points
Here are the steps.

Find all the end points
  1. In GeoMedia, select Analysis > Functional Attributes.

    The Functional Attributes dialog box appears.


  2. In the Add functional attributes for combo box, choose the linear feature e.g. rcl. Click New.

    The Functional Attribute dialog box appears.

  3. In the Categories list, click Geometry. Then in the Functions list, double click STARTPOINT. In the Attributes list, double click the linear feature's geometry field e.g. Input.Geometry.

    In the Expression field, STARTPOINT(Input.Geometry) should be displayed.

  4. In the Functional attribute name field, type in EndpointGeometry.

    The Functional Attribute dialog box should be similar to the figure below.


  5. Click Add.

    The EndpointGeometry functional attribute is added.

  6. Click Close.

    The Functional Attribute dialog box is closed.

  7. In the Query name field, type in Start of rcl. Toggle off Display functional attributes in data window as shown below..



  8. Click OK.

    The Start of rcl query is displayed in the map window.


  9. Now repeat the previous steps to find the linear geometries' end points. Select Analysis > Functional Attributes.

    The Functional Attributes dialog box appears. The previous linear feature rcl and its EndpointGeometry functional attribute should still be selected.


  10. Click Properties.

    The Functional Attribute dialog box appears.


  11. Clear the Expression field.

  12. In the Functions list, double click ENDPOINT. In the Attributes list, double click the linear feature's geometry field, e.g. Input.Geometry.

    The string ENDPOINT(Input.Geometry) should be displayed in the Expression field.


  13. Click OK.

  14. In the Query name field, type in End of rcl. Click OK.

    The End of rcl query is displayed in the map window.
  15. Now select Analysis > Union.

    The Union dialog box appears.

  16. In the Union features in tree view, expand the Queries node and toggle on Start of rcl and End of rcl. In the Query name field, type in Endpoints of rcl.

    The Union dialog box should look similar to the figure below.


  17. Click OK.

    The Endpoints of rcl query is displayed.


We have now created a list of all the end points for the linear geometry feature. From this list we can use the Spatial Intersection command to find out which points are intersecting with which points. That's described below.

Find out which end points are intersecting with which end points
  1. Select Analysis > Spatial Intersection.

    The Spatial Intersection dialog box appears.

  2. In the Generate intersections for Features in combo box, choose the Endpoints of rcl query.

  3. In the That combo box, choose are spatially equal.

  4. In the second Features in combo box, choose the Endpoints of rcl query again.

    The Spatial Intersection dialog box may look like this now.


  5. Click OK.

    The spatial intersection query is created.


    Note 1: The Data Window shows the attributes of the spatial intersection query result. The example linear feature rcl has the field 'id' as the primary key.
    Note 2: Since both input features to the Spatial Intersection command are the same feature and hence the same primary key 'id', GeoMedia will rename the second input feature's primary key by appending a number '1' to it resulting in 'id1'.

A spatial intersection record is the result from two overlapping geometry features. In this example, GeoMedia will append the records from both feature (the same rcl feature) into one intersection record. Therefore, we can say for sure that at the free end points, the spatial intersection record's id and id1 values would be the same. We can also say for sure that at the line intersections, the spatial intersection records' id and id1 values may be the same or may not be the same. Given these two facts, to find out the free end points, all we have to do is to spatially subtract the points at the line intersections from the list of all end points. That is described below.

Use Spatial Difference to subtract away the points at the line intersections
  1. Select Analysis > Spatial Difference.

    The Spatial Difference dialog box appears.


  2. In the From features in combo box, choose the query Spatial Intersection of Endpoints of rcl and Endpoints of rcl.

  3. In the Subtract features in combo box, choose the same query Spatial Intersection of Endpoints of rcl and Endpoints of rcl.

  4. In the Subtract features in section, click Filter.

    The Spatial Intersection of Endpoints of rcl and Endpoints of rcl filter dialog box appears.

  5. Either type in or use the controls to form the string "id <> id1" in the Filter field as shown below.

  6. Click OK.

  7. In the Output difference as Query name field, type in "Free Endpoints of rcl".

    The Spatial Difference dialog box may look similar to this.


  8. Click OK.

    The free end points of the linear geometry feature are displayed in the map window.


2 comments:

oscar granizo said...

Hi dominoc925,
i've tried to find your e-mail but i haven't found it, so i write to you in this post that has been very useful to me.
i have a problem and i don't know how to solve it. i have a roads net split in several parts but all the roads have to have continuity. I don't know what query i have to use.
tnaks

dominoc925 said...

Hi Oscar
I no longer use or have access to GeoMedia unfortunately. That said, what do you mean "have to have continuity"? Is it information about from node to nodes?
My email is dominoc925 _at_ ymail.com btw.

Related Posts with Thumbnails