Modify

Opened 15 years ago

Closed 15 years ago

#3989 closed enhancement (fixed)

[patch] subprojection implemented in Lambert 4 Zones, Lambert CC9 Zones and UTM 20N France

Reported by: pieren Owned by: team
Priority: major Milestone:
Component: Core Version: latest
Keywords: projection subprojection Cc:

Description

Please apply the attached patch (projection.patch) implementing the subprojections for:

  • Lambert (Lambert 4 Zones (France))
  • LambertCC9Zones (Lambert CC9 Zones (France))
  • UTM_20N_France_DOM (UTM 20N (France))

With this subprojection patch, you can remove the three following source files:

  • UTM_20N_Guadeloupe_Fort_Marigot.java
  • UTM_20N_Guadeloupe_Ste_Anne.java
  • UTM_20N_Martinique_Fort_Desaix.java

I also removed all controls of the projection zones limits because of the MapView bug (see ticket #3987). I would like to reintroduce them later when it will be possible.

For the Lambert 4 Zones projection (Lambert.java), I finally implemented the full projection algorithm, means that the geodesic system is also fully translated from the NTF geodesic system used in Lambert 4 zones to the WGS84 geodesic system. For this full implementation, I have to load and parse a grid file (attached) in the NTV2 format, so I also added an extern NTV2 library for this:

  • NTV2Grid.bz2 is the archiv of four new classes NTV2GridShift.java, NTV2GridShiftFile.java, NTV2SubGrid.java and NTV2Util.java;
  • ntf_r93_b.gsb is the binary file I stored it in josm/core/data . But if you change its location, the file path must be updated in Lambert class constructor.

With this grid, the Lambert 4 Zones projection is accurate at submillimetric level where we have a differential of 1 to 5 meters with the current version, depending of the location.

Attachments (5)

LambertCC9Zones.png (94.8 KB ) - added by pieren 15 years ago.
NTV2Grid.bz2 (10.6 KB ) - added by pieren 15 years ago.
projection.patch (36.3 KB ) - added by pieren 15 years ago.
NTV2Grid.patch (38.2 KB ) - added by pieren 15 years ago.
classpath.patch (895 bytes ) - added by pieren 15 years ago.

Download all attachments as: .zip

Change History (25)

comment:1 by pieren, 15 years ago

I cannot attach the grid file because it's size is 271 Kb where trac is limited to 256 Kb. Please contact me at pieren3@… then I will send you the file.

Or download it from here:

http://lambert93.ign.fr/fileadmin/files/ntf_r93_b.gsb

by pieren, 15 years ago

Attachment: LambertCC9Zones.png added

comment:2 by pieren, 15 years ago

Oops, I forget to mention and attach the image file

LambertCC9Zones.png

located in images/data/projection but it might be located somewhere else (images/preferences ?). Its path is specified in LambertCC9Zones.getPreferencePanel().

comment:3 by pieren, 15 years ago

I reloaded a new version of the patch file projection.patch which provides a better getWorldBoundsLatLon method.

comment:4 by pieren, 15 years ago

In the patch, the grid file is loaded from /images/data/projection/ntf_r93_b.gsb in Lambert class constructor. I know that the images/ folder is not appropriate but there is not data/ folder currently in the jar file. So if you move the ressource file to another location, please update the path in Lambert class constructor accordingly. Thank you.

by pieren, 15 years ago

Attachment: NTV2Grid.bz2 added

comment:5 by pieren, 15 years ago

I uploaded a new version of the files fixing a bug when the grid file is read from a jar file.

comment:6 by stoecker, 15 years ago

Short first review:

Please use the return values of getPreferences() and args of setPreferences() instead of the prefs setting as you do now. These are a simple string list for parameters, which can be freely choosen. When we need persisting prefs for the different projections, then the prefs setting should handle that (i.e. by saving the prefs not generic, but projection related). As already said, there is much to be done here in improvement suggestions are wellcome.

Your approach was also first tried by xeen, but it brings too much trouble.

Also instead of an undefined zone I would choose a default setting. That makes code much clearer.

Everything else looks fine. Still we need a somehow generic approach for the outlying coordinates.

comment:7 by stoecker, 15 years ago

In r2491 I hopefully fixed the storage issues you worked around.

comment:8 by pieren, 15 years ago

Thanks for the separate preference for each projection, but with r2491, the zone is stored in the preference file only the first time. If we change later the zone number, it is not saved on the disk.

comment:9 by stoecker, 15 years ago

(In [2496]) see #3989 - subprojection fixes

comment:10 by stoecker, 15 years ago

(In [2499]) see #3989 - subprojection fixes

comment:11 by stoecker, 15 years ago

r2499 now passed JPanel as argument instead returning it from subprojections. This makes also the cleanup process much easier. In UTM I use component position to find the right component again and thus also don't need useless variables in projection class.

Now the world bounds and projection code are updated as one may expect. Design is much better than before I think.

Waiting for your fixed patch for inclusion.

P.S. Improvements still welcome.

comment:12 by pieren, 15 years ago

I've uploaded a new version of projection.patch to comply with projection/subprojection r2499.

Note: destroyCachedPanel() has been removed from ProjectionSubPrefs interface but is still present in the comments.

by pieren, 15 years ago

Attachment: projection.patch added

comment:13 by stoecker, 15 years ago

I can't extract the NTV file. It is zip and not .bz2, but I get "`(null)' method not supported". Could you use another archive format please.

by pieren, 15 years ago

Attachment: NTV2Grid.patch added

comment:14 by pieren, 15 years ago

I've attached a patch file "NTV2Grid.patch". Sorry about that.

comment:15 by stoecker, 15 years ago

Resolution: fixed
Status: newclosed

In r2507.

by pieren, 15 years ago

Attachment: classpath.patch added

comment:16 by pieren, 15 years ago

I've also attached a patch for the Eclipse .classpath project file which includes the new data/ folder in the resources.

comment:17 by pieren, 15 years ago

Priority: criticalmajor
Resolution: fixed
Status: closedreopened

Please note this bug in the environments where JOSM is newly installed : since projections have never been configured, you will get this exception at startup:
java.lang.NullPointerException

at org.openstreetmap.josm.data.projection.UTM.setPreferences(UTM.java:406)
at org.openstreetmap.josm.gui.preferences.ProjectionPreference.setupProjectionCombo(ProjectionPreference.java:231)

This is probably due to the fact that UTM is not yet configured. Thus:

public void setPreferences(Collection<String> args) {

zone = DEFAULT_ZONE;
try {

for(String s : args)

:

should be improved by:

public void setPreferences(Collection<String> args) {

zone = DEFAULT_ZONE;
if (args != null) {

try {

for(String s : args)

:

comment:18 by stoecker, 15 years ago

Resolution: fixed
Status: reopenedclosed

(In [2509]) fixed NPE - closes #3989

comment:19 by pieren, 15 years ago

Resolution: fixed
Status: closedreopened

The list of zones for the JComboBox in Lambert.java file has been modified for internationalisation:

    public static String[] lambert4zones = {
        tr("{0} ({1} to {2} degrees)", 1,"51.30","48.15"),
        tr("{0} ({1} to {2} degrees)", 1,"48.15","45.45"),
        tr("{0} ({1} to {2} degrees)", 1,"45.45","42.76"),
        tr("{0} (Corsica)", 4)
    };

but the zone number 2 and 3 are wrong in the text:

    public static String[] lambert4zones = {
        tr("{0} ({1} to {2} degrees)", 1,"51.30","48.15"),
        tr("{0} ({1} to {2} degrees)", 2,"48.15","45.45"),
        tr("{0} ({1} to {2} degrees)", 3,"45.45","42.76"),
        tr("{0} (Corsica)", 4)
    };

comment:20 by stoecker, 15 years ago

Resolution: fixed
Status: reopenedclosed

(In [2513]) fixed #3989 - typo

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.