Hello!  

I would like to clear the strategy of CRS determining in UDIG.

I see it as follows:

1) Each layer has its own CRS coming from georesource. Viewport of the map
has a CRS to which all layers' CRS's are transformed to render layers.


2) When the new empty map is created, its viewport gets configured CRS from
preferences or default one (Cartesian).


3) When the layer is added to the map:

- Layer's CRS is trying to be determined from geo resource (prj. file for
shapefiles, etc). If it is determined then it becomes the CRS of the layer. 

- If the layer's CRS is determined and it is a first layer on the map then
layer's CRS is set as a viewport's CRS. This case should be configured in
preferences: should the first layer set its CRS (if determined) to the
viewport even if default viewport CRS is also configured in preferences.

- If layer's CRS is not determined but viewport has a default CRS configured
in preferences then the layer TRIES to set CRS from current viewport.
Whether it's so? It can be also configured in prefs whether layer should try
to set its CRS from current viewport if the georesource itself does not know
about its own CRS.



So, there are several strategies:
- whether viewport gets CRS from first added layer if layer's CRS is
determined (checkbox in preferences)
- whether layer always tries to get CRS from viewport if it can not
determine CRS of the georesource itself(checkbox in preferences)
- Layer's CRS and viewport's CRS does not depend on each other. Viewport's
CRS is always comes from preferences during map creation if configured or
manually by user after creation. Layer's CRS comes from georesource or by
user if was not determined automatically. If layer's CRS is undetermined -
the user can configure it manually.

My opinion that straightforward way of "first layer rule" is not flexible
and full enough. What is about rule "viewport CRS to layer CRS if the last
one is undetermined"? The user can work with hundreds layers with
undetermined automatically CRS (but known for user) and would like to
configure viewport default CRS once while layers always gets its own CRS
always from viewport. This is a case for us. Just a checkbox in prefs.

I just want to clarify the understanding of CRS settings behavior. Any
comments?

Also we should remember about CRS determining is expensive operation. Lazy
loading whenever it is possible. UDIG needs small improvements in this
direction.

Anyway, everything here is just about usability....
- 


P.S. The rule of first layer is not applicable when project model is
restored from EMF XMI model because layers are added to context model of map
object before viewport is restored and set and no need to determine layer
CRS (it breaks lazy approach during restoring of project) because viewport
will be restored later. But seems I fixed this case in code to avoid routine
of CRS determining from georesource (Revision: 20992).

Vitali Diatchkov.

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to