What I have: OSM map of an area in US, and floor map of a building on that map. The building is tilted between 10 and 45 degrees from vertical. I also have the correct Lat/Lon coordinates for the building. The project uses ReactJS.
What I want: to rotate the floor map so that it fits correctly on the map. The floor map is incorporated into an image layer thus (code that I inherited)
const floorMapLayer = new ImageLayer({
source: new Static({
url: floorPlanUrl,
projection: rotateProjection("EPSG:4326", angle, extent),
imageExtent: extent
})
})
where rotateProjection() was copied from https://codesandbox.io/s/reprojection-image-z0uit, changing the British "EPSG:27700" to "EPSG:4326"
What is happening: the rotated image is being distorted. At non-90 angles, the image is a parallelogram. At 90, it is rectangular, but the original N/S (becoming E/W) is reduced, and original E/W (becoming N/S) is increased. Empirically, it seems that these changes correlate to cos(latitude), almost as though it is maintaining degree measurements, e.g., something that was 4 deg lat by 6 deg long rotates to 4 deg long by 6 deg lat.
What I've looked at:
The last reference above links to the above-mentioned rotateProjection(). It also links to https://codepen.io/mike-000/pen/qBapaBa, which had similar code.
I am new to OpenLayers, and am a bit frustrated because the code is not documented well enough so that a newbie can understand what is happening, why it works, and what I should do if it doesn't work - which is my situation.
Perhaps I am not understanding how to use one of the above links properly. As I said, I am new at this, and documenting code helps a lot.