Opened 14 years ago
Closed 14 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)
Change History (25)
comment:1 Changed 14 years ago by
Changed 14 years ago by
Attachment: | LambertCC9Zones.png added |
---|
comment:2 Changed 14 years ago by
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 Changed 14 years ago by
I reloaded a new version of the patch file projection.patch which provides a better getWorldBoundsLatLon method.
comment:4 Changed 14 years ago by
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.
Changed 14 years ago by
Attachment: | NTV2Grid.bz2 added |
---|
comment:5 Changed 14 years ago by
I uploaded a new version of the files fixing a bug when the grid file is read from a jar file.
comment:6 Changed 14 years ago by
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:8 Changed 14 years ago by
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:11 Changed 14 years ago by
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 Changed 14 years ago by
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.
Changed 14 years ago by
Attachment: | projection.patch added |
---|
comment:13 Changed 14 years ago by
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.
Changed 14 years ago by
Attachment: | NTV2Grid.patch added |
---|
Changed 14 years ago by
Attachment: | classpath.patch added |
---|
comment:16 Changed 14 years ago by
I've also attached a patch for the Eclipse .classpath project file which includes the new data/ folder in the resources.
comment:17 Changed 14 years ago by
Priority: | critical → major |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
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 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:19 Changed 14 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
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 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
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