Opened 9 years ago
Last modified 9 years ago
#9604 new defect
Projection problem with Import Image plugin
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Plugin importimage | Version: | |
Keywords: | Projections, ImportImage, CoordinateReferenceSysrem | Cc: |
Description
I have used JOSM version 5485 with a personalized projection and until now it works properly also with an old version of about two years ago of ImportImage plugin.
Now I start to use the JOSM version 6388 with the latest ImportImage plugin (I have downloaded it from the josm plugins web page) and I found a lot of problem. Especially, I'm not able to load my georeferenced images in the right position using my projection.
My projection doesn't have an authority number (for example Mercator is EPSG:3857) and also a
coordinate reference system, that now is used into ImportImage plugin.
To add my projection I have put this code into my projection plugin:
private static MYProjection proj; static { proj = new MyProjection(); ProjectionPreference.registerProjectionChoice(proj); String str = "+proj=" + MyProjection.id2 + "+ellps=WGS84 +datum=WGS84+bounds=-180,-85.05112877980659,180,85.05112877980659"; Pair<String, String> p = Pair.create(proj.toString(), str); Projections.inits.put(MyProjection.id2, p); Projections.registerBaseProjection("josm:" + MyProjection.id2, MyProjection.class, "core"); }
where MyProjection.id2 has to be the authority number, but I don't have it for my projection.
The class that I create to give the parameters of my projection extends SingleProjectionChoice and implements Projection and Proj.
Into the contructor method I put something like that:
super(projCode, "core:" + id2, id2);
where projCode is the String that give the name to MyProjection and id2 has to be again the authority number.
I ovveride the methods getDefaultZoomInPPD(), latlon2eastNorth(LatLon p), eastNorth2latlon(EastNorth p) in order to create my projection parameters. Than I have:
@Override public String toCode() { return projCode; } @Override public String getCacheDirectoryName() { return myProjName; } @Override public Bounds getWorldBoundsLatLon() { return new Bounds( new LatLon(-85.05112877980659, -180.0), new LatLon(85.05112877980659, 180.0)); } @Override public String getName() { return tr(myProjName); } @Override public String getProj4Id() { return "josm:smerc"; } @Override public void initialize(ProjParameters params) throws ProjectionConfigurationException { } @Override public double[] project(double lat_rad, double lon_rad) { return new double[]{lon_rad, log(tan(PI / 4 + lat_rad / 2))}; } @Override public double[] invproject(double east, double north) { return new double[]{atan(sinh(north)), east}; }
This work properly with WMS and TMS. All the downloaded tiles are put into the right position.
When I use ImportImage plugin to load my georeferenced pictures, I supposed that JOSM use always Mercator projection (also for the Coordinate Reference System), because I note that with the old version of JOSM and ImportImage (that work properly with MyProjection), if I chose Mercator as JOSM projection, the position of loaded pictures is the same if I use new JOSM, new MyProjection and new ImportImage, also if I choose MyProjection as JOSM projection.
I hope that these information should be usefull to understand and, hopefully, to resolve my problem.
Let me know if you have questions or ideas about that.
Thanks,
Irene
Attachments (1)
Change History (5)
comment:1 Changed 9 years ago by
Component: | Core → Plugin importimage |
---|---|
Priority: | critical → normal |
Version: | tested |
comment:2 Changed 9 years ago by
Hi Irene,
first of all, let me note that the normal way to install a plugin is via Preferences > Plugins. This way you will automatically get a compatible version.
Please have a look at the wiki page for the ImportImage plugin, if you haven't done so already: http://wiki.openstreetmap.org/wiki/JOSM/Plugins/ImportImagePlugin
Maybe the note at the bottom is related to your problem? (It would still be a bug.)
In Preferences > Map Settings you can change the displayed coordinates to projected coordinates. This way you can easily check which CRS is currently used by JOSM (look at the numbers in the status line).
Then also note, that there are 2 modes of operation for the ImportImage plugin:
1) warp the image from the image projection to josm's projection
2) assume that the image projection is the same as josm's current projection and display the image as is
If you are only using mode 2), then it is highly recommended that you switch to the PicLayer plugin because it is much more stable and better maintained.
Changed 9 years ago by
Attachment: | StatusReport.txt added |
---|
comment:3 follow-up: 4 Changed 9 years ago by
Dear all,
thanks for your answers.
I've tried to follow all of your suggestion (update JOSM, update the plugins, use PicLayer..), but the problem remain the same: my pictures are downloaded using Pseudo-Mercator, and not MyProjection.
In attach you can find my status report.
I've used JOSM 5485 because it was stable and it worked properly for my scope and when I decide to update JOSM the latest tested version was 6338.
So, at the end, I always think that my problem is related to the AUTHORITY:NUMBER and the CRS that I have to use, but I have no idea to how to set these parameters
Thanks again for your help.
Irene
comment:4 Changed 9 years ago by
Replying to anonymous:
Dear all,
thanks for your answers.
I've tried to follow all of your suggestion (update JOSM, update the plugins, use PicLayer..), but the problem remain the same: my pictures are downloaded using Pseudo-Mercator, and not MyProjection.
Then I do not understand your workflow. PicLayer and ImportImage do not download any pictures as far as I'm aware. You need to open a local image file (*.jpg, *.png, ...), usually along with a world file.
Some questions unrelated to your problem but that trouble me:
If you don't use at least the current tested version, there's a good chance you will never be able to use latest versions of plugins as well.
Can you please also attach your status report ? Thanks.