Spatial Relationships

 

I'd like to get some comments and advice on an implementation of spatial relationships for OpenJUMP using JTS as the underlying geometry model. I've written a coupel of articles about spatial relationships for the OSGeo Journal and this implementation will be part of an effort to provide working open source code as an example of the concepts discussed in the article.

 

Here is a list of the possible ways that I imagine a library or OpenJUMP plug-in that added support for spatial relationships could be used:

 

Enhanced Spatial Query Functionality

 

The spatial relationship code be used to add support for enhanced spatial queries. For example the user could ask for the billboard (represented by a point) that was closest to a segment of freeway (represented by a line string).

 

The spatial relationship code would enhance queries in two (2) ways. [1] By making existing query capability faster. This could be accomplished by storing the values of spatial relationships instead of recalculating them every time a query is run. [2] By supporting additional spatial query operators or "questions" that can be asked a query engine.

 

Support For Data Creation And Editing Rules

 

The spatial relationship code could be used to add support for rules that control creation of feature geometry and the edits that are allowed to those geometries. (For example: You might have a rule that prohibits line strings in one layer that bisect polygons in another layer.)

 

Ability To Export Spatial Relationship Attributes

 

The spatial relationship code might be used to export the values of the attributes of a spatial relationship in tabular format or some other format that would make it suitable for use in another program that lacks direction spatial computation abilities, like a relational database.

 

 

Here is a list of possible approaches to implementing spatial relationships:

 

A Java class or group of classes with no state and only static methods.

In this scenario the client code would need to pass the spatial relationship code the geometries participating in the realtionship. The attribute values of the relationship would be calculated and return.

 

Advantages

There is no need for persistence.

The responsibility to keep attribute values up-to-date is handed to the developer.

 

Disadvantages

There would be no storage or caching of attribute values, therefore query speed would not be enhanced.

The responsibility to keep attribute values up-to-date is handed to the developer.

 

An immutable Java object or group of immutable Java objects with state but no persistence.

In this scenario the client code would create an object representing a spatial relationship specifying the geometries that participate. They could then call methods of the object without passing the geometry objects participating as arguments to the methods.

 

Advantages

There is no need for persistence.

The responsibility to keep attribute values up-to-date is handed to the developer.

 

Disadvantages

There would be no storage or caching of attribute values, therefore query speed would not be enhanced.

The responsibility to keep attribute values up-to-date is handed to the developer.

 

A modifiable Java object or group of modifiable Java objects with state but no persistence.

In this scenario the client code would create an object representing a spatial relationship specifying the geometries that participate. They could then call methods of the object without passing the geometry objects participating as arguments to the methods.

 

Advantages

There is no need for persistence.

It would be possible to cache attribute values to enhance query speed.

 

Disadvantages

Caching of attribute values to enhance query speed would be limited by memory.

 

The responsibility to keep attribute values up-to-date must be incorporated in the spatial relationship code, with a refresh method at a minumum, and the ability to listen for geometry object changes in the best case.

 

A modifiable Java object or group of modifiable Java objects with state and persistence for spatial relationship attribute values, but not participating geomtries.

In this scenario the client code would create an object representing a spatial relationship specifying the geometries that participate. They could then call methods of the object without passing the geometry objects participating as arguments to the methods. The objects could also be persisted, but participating geomtries would not be stored.

 

Advantages

Memory does not limit the ability to cache attribute values for faster spatial queries.

 

The responsibility to keep attribute values up-to-date must be incorporated in the spatial relationship code, with a refresh method at a minumum, and the ability to listen for geometry object changes in the best case. We now have to incorporate this refresh mechanism with the persistence code.

Disadvantages

There could be caching of attribute values to enhance query speed, but it would be limited by memory.

 

A modifiable Java object or group of modifiable Java objects with state and persistence for spatial relationship attribute values and participating geomtries.

In this scenario the client code would create an object representing a spatial relationship specifying the geometries that participate. They could then call methods of the object without passing the geometry objects participating as arguments to the methods. The objects could also be persisted, and participating geomtries would be stored.

 

 

Advantages

Memory does not limit the ability to cache attribute values for faster spatial queries.

 

The responsibility to keep attribute values up-to-date must be incorporated in the spatial relationship code, with a refresh method at a minumum, and the ability to listen for geometry object changes in the best case. We now have to incorporate this refresh mechanism with the persistence code, and would have to ensure that spatial relationships retrieved from persistent storage  did not contain geometries and/or geometry references that out-of-synch with the actual geometries representing the features in the program.

 

Disadvantages

There could be caching of attribute values to enhance query speed, but it would be limited by memory.

 


Page Information

  • 8 months ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts