﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
9604	Projection problem with Import Image plugin	irene.pucci@…	team	"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:

  {{{#!java
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:

  {{{#!java
  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:


  {{{#!java
    @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


"	defect	new	normal		Plugin importimage			Projections, ImportImage, CoordinateReferenceSysrem	
