Hi, I got a heightmap, in which I understand, the URL lat/long to be for the center pixel. I'd like to sample the rest of the pixels given some projected coordinate(in the area covered by the map), but I'm not sure how that translates to pixel coordinates and back.
The map is exported using screen resolution(minus some pixels) and in my case, I get a 1920,920 map.
The only formula, from my attempts so far, that has kind of made sense was to query from the console the scene.view.size.meters and given the exported png dimensions, get the meter/pixel ratios per dimension, then find the top left pixel as a projected coordinate(subtracting from the central pixel's projected coordinates, scene.view.size.meters / 2.
Then given a projected coordinate in EPSG:3857(which I believe heighmapper uses), I convert that to pixels by subtracting the given projected_x from the top_left_x and and dividing with the (ViewMetersX/ViewWidth) ratio. For Y, I subtract the given projected.Y from the top_left_y since in pixel coordinates the positive direction for Y is down.
The result in pixels is correct for the X axis, but has error in Y. Any ideas on what I haven't factored in? Or perhaps misunderstood?
Hi, I got a heightmap, in which I understand, the URL lat/long to be for the center pixel. I'd like to sample the rest of the pixels given some projected coordinate(in the area covered by the map), but I'm not sure how that translates to pixel coordinates and back.
The map is exported using screen resolution(minus some pixels) and in my case, I get a 1920,920 map.
The only formula, from my attempts so far, that has kind of made sense was to query from the console the scene.view.size.meters and given the exported png dimensions, get the meter/pixel ratios per dimension, then find the top left pixel as a projected coordinate(subtracting from the central pixel's projected coordinates, scene.view.size.meters / 2.
Then given a projected coordinate in EPSG:3857(which I believe heighmapper uses), I convert that to pixels by subtracting the given projected_x from the top_left_x and and dividing with the (ViewMetersX/ViewWidth) ratio. For Y, I subtract the given projected.Y from the top_left_y since in pixel coordinates the positive direction for Y is down.
The result in pixels is correct for the X axis, but has error in Y. Any ideas on what I haven't factored in? Or perhaps misunderstood?
Thx!