Opened 10 years ago

Last modified 10 years ago

#9604 new defect

Projection problem with Import Image plugin

Reported by: irene.pucci@… Owned by: team
Priority: normal Milestone:
Component: Plugin importimage Version:
Keywords: Projections, ImportImage, CoordinateReferenceSysrem Cc:


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();
      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:

  public String toCode() {
      return projCode;

  public String getCacheDirectoryName() {
      return myProjName;

  public Bounds getWorldBoundsLatLon() {
      return new Bounds(
              new LatLon(-85.05112877980659, -180.0),
              new LatLon(85.05112877980659, 180.0));

  public String getName() {
      return tr(myProjName);

  public String getProj4Id() {
      return "josm:smerc";

  public void initialize(ProjParameters params) throws ProjectionConfigurationException {

  public double[] project(double lat_rad, double lon_rad) {
      return new double[]{lon_rad, log(tan(PI / 4 + lat_rad / 2))};

  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.


Attachments (1)

StatusReport.txt (21.0 KB ) - added by irene.pucci@… 10 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Don-vip, 10 years ago

Component: CorePlugin importimage
Priority: criticalnormal
Version: tested

Some questions unrelated to your problem but that trouble me:

  • Why were you using JOSM 5485 ? This version is still used by some people, but I don't understand why as it it very old and all major Linux distributions offer versions newer than this. The problem is this version is so old it doesn't send back OS information in it's User-Agent to us, so we cannot know for sure why it is used.
  • Why did you update to an old tested version (6388) ? Version 6502 has been released last year.

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.

comment:2 by bastiK, 10 years ago

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:
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.

by irene.pucci@…, 10 years ago

Attachment: StatusReport.txt added

comment:3 by anonymous, 10 years ago

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.

in reply to:  3 comment:4 by bastiK, 10 years ago

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.

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to irene.pucci@….
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment

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