I am new to GIS but I am working on a project mapping a building using floor plans and JOSM.
Using the PicLayer plugin I added the .png floor plan as a layer.
I wrote a .cal file to set the scale, rotation, and center position of the image.
In the JOSM default Mercator projection, the image moved only slightly when the center was changed (using lat and lon decimal degrees). The image was still centered somewhere around zero. In WGS84 the image moved to the correct location but was sheared and stretched.
I found this reference on converting lat/lon to a Mercator projection: http://wiki.openstreetmap.org/wiki/Mercator
The Python code under Elliptical Mercator correctly converts my longitude, but the latitude is off by about 0.5% (a few metres).
import math
def merc_x(lon):
r_major=6378137.000
return r_major*math.radians(lon)
def merc_y(lat):
if lat>89.5:lat=89.5
if lat<-89.5:lat=-89.5
r_major=6378137.000
r_minor=6356752.3142
temp=r_minor/r_major
eccent=math.sqrt(1-temp**2)
phi=math.radians(lat)
sinphi=math.sin(phi)
con=eccent*sinphi
com=eccent/2
con=((1.0-con)/(1.0+con))**com
ts=math.tan((math.pi/2-phi)/2)/con
y=0-r_major*math.log(ts)
return y
My nodes and ways were lined up correctly with the image with this latitude and longitude in WGS84, so I think they are correct and the conversion is not. I am in the northern hemisphere and using an area near 49 N, -122 E.