Greetings everyone. I was thinking of adding a post to the other thread on Map View 2.0, but what I want to chat about might be sufficiently different that it warrants a new thread. But if someone wants to merge this with that other thread, that would be fine too.
I'm looking down the road a little bit and considering the number of applications where it will be necessary to create and edit layers of spatial data in a Tethys application. The “spatial data” that I am referring to is points, lines, and polygons. And not just the features, but the associated attributes which may vary from application to application.
To date, we have supported points, lines, and polygons (including rectangles) in Open Layers using the annotation tools. The annotation tools are simple and convenient, but very limited. For example, if you refresh your browser they disappear! That is fine for simple cases, but I'm looking at a more extensive case we're one may wish to create spatial features and/or edit both the geometry and the attributes of existing features. In other words, something similar in concept to the Map Module associated with GMS, SMS, and WMS.
I've been thinking about this quite a bit and we did a little brainstorming the other day when Jacob Fullerton was in my office. I jotted down a few notes and I wanted to throw them out there as a straw man or starting point for discussion.
It would be nice if we had a framework for special features that would allow you to do the following:
- Create new features manually
- Delete features
- Edit the geometry of features
- Edit attributes associated with the features
- Import features from shapefiles or other sources and then be able to edit them
- Save all of the edits to a spatial database
- Programmatically access the geometry and attributes of the features (we can do this now if they are in the spatial database)
So here is a general outline of how we may be able to accomplish that:
- We support a method of organizing special features into feature classes or layers in a Tethys app. This would be a standard GIS feature class where you have a table where each row in the table is a feature and it can have a set of attributes. GIS 101. Each layer would include points, lines, or polygons. In most cases, we would predefine the fields or attributes associated with a feature class depending on the application. There may be cases where we allow the user to establish the fields, but in most applications the fields needed will depend on the use case. These layers would have to be stored in PostGIS or GeoServer or some combination.
- When we want to allow the user to edit a layer, we would pop over into an edit mode (a new Tethys window) which would include a map view and some basic editing tools. Switching into edit mode would require us to take the features that are stored in a spatial database and convert them to annotation objects for editing. We would also need to assign a unique ID to each of those annotation objects and create a 2D array of attribute data.
- While in edit mode the user can create new futures, edit existing features, or delete features. Based on the type of layer, we would probably need to dim and undim the editing tools. For example if it was a point layer, only the point tool would be available and the line and polygon tools would be dimmed or not available. While in edit mode, we would allow the user to pop up an attribute table dialogue to edit the attributes associated with the features. We could have filters on the attribute table so that it display just the selected features or all features. This would provide a simple way to edit attributes that would be general and would not need to be customized for each application. Of course, this would also necessitate a selection tool.
- When one exits the edit mode, all of the changes made to the spatial features and the attribute table would be saved to the database.
- It would also be important to have a standardized methodology for managing the layers for general viewing. The other day I saw a demo of Shawn's HydroShare GIS app and I really liked what he has done where he lists map layers on the left in a format similar to the ArcGIS table of contents. One can toggle the layers on and off and edit the symbology. We really should be able to standardize this for spatial layers so that a developer could plug it right in.
Anyway that is a starting point. Feedback welcome.