arnis icon indicating copy to clipboard operation
arnis copied to clipboard

[FEATURE] The ability to rotate maps

Open faithsapling opened this issue 1 year ago • 16 comments

The streets of most cities don't go perfectly east to west or north to south, they tend to slant sideways. As seen in this image, when you create a rectangle, it's inevitable that you'll just be getting a diagonal section of a city. It would be nice if we could have maps rotated to solve this problem.

Screenshot 2024-12-29 082705

faithsapling avatar Dec 29 '24 13:12 faithsapling

That's a very good feature request, thanks! I will look into this and use this issue as an update thread for this feature :)

louis-e avatar Dec 29 '24 14:12 louis-e

There are quite a few American cities with Cartesian street grids that are not aligned with the cardinal directions, and the ability to rotate the Minecraft grid to match them would produce results that are as good as those that use Chicago. New York, Philadelphia, Boston, Minneapolis, and several others have such street grids.

omrischwarz avatar Jan 02 '25 03:01 omrischwarz

Hi, I just tried Arnis for our small village (in Germany) and it has also the characteristics, that the streets are not N/S or S/W oriented and even if most houses / buildings are rectangular, arnis is making them quite weird. Before starting a new request I searched and found this one, very good.

So please, if it's possible, add an angle parameter for rotating the map (easier way) or a slider to rotate the map before generation.

Kuki77 avatar Jan 04 '25 11:01 Kuki77

Thanks for the feedback! I have to fix a few other bugs right now, but I'm already thinking about how to implement this. Will follow hopefully soon! :)

louis-e avatar Jan 04 '25 13:01 louis-e

Would love this feature, great work by the way, this is incredible!

briward avatar Feb 14 '25 18:02 briward

I don't know where to tell so will do here. It's a good project but you difinitely gotta add some terrain. Like mate, satellites know how high the ground is, same as the ground under the water. But yeah, you are limited by height. Well, at least 50% relief scale could be cool! And some things like big objects needs to be added. Thank you for idea and realization! Hope it would be 3d in some time

CapaParlo avatar Feb 16 '25 00:02 CapaParlo

You can use this to add mountains under the buildings, it would be way recognizeable and comprehendable with landscape relief https://uk-ua.topographic-map.com Just make some nodes to adjust how buildings would touch the ground so it would look properly

CapaParlo avatar Feb 17 '25 19:02 CapaParlo

Any updates on the rotate feature? Many cities and universities unfortunately aren't designed for arnis and love to slant a lot... It'll help so much for people using arnis to create cute models of their surrounding

fish4terrisa-MSDSM avatar Feb 25 '25 04:02 fish4terrisa-MSDSM

I really want this feature too, so I spend a little time looking into how to potentially implement this feature. I didn't thoroughly read the codebase, so some of the following might be based on incorrect assumptions. I am also no GIS expert, and have little knowledge in this field. Please correct me if I got it wrong.

Observation: The OSM data we get from APIs are always a straight rectangle bbox. So if we want to have rotation in the final minecraft world, we will either get a rotated region populated in the world, or some cropping need to be done from the data we got from the APIs.

We also need to have a definition of the rotation movement, so each elements from OSM data can be rotated a certain degree with a defined coordinate as center of rotation. To ease implementation, we might want to support it from the CLI first, with 2 more parameters that user can set: coordinate of center of rotation (optional, if left unfilled will default to center of bbox), degree of rotation.

I naively think this can be accomplished by adding this rotation to all coordinates before feeding them into lat_lon_to_minecraft_coords(). A numeric library might need to be added to the dependency to ease this implementation.

Additionally we can add a crop flag so the generated minecraft world is only based on the biggest possible after-rotation bbox that can fit into the original bbox. This can be implemented by filtering osm elements that participates in the generation to the ones that at least partially fit into the after-rotation bbox.


If the proposal sounds correct and useful to the maintainer, please give me a go ahead and I'll proceed to implementation.

InternetOfTofu avatar Mar 18 '25 02:03 InternetOfTofu

I am thinking about something similar, and since there might be other potential manipulations and customizations of the map data, my suggestion is to add a middle editing layer after getting the OSM raw data and before sending to discretization. One will be able to inspect and modify the maps according to their needs.

Besides the rotation, what I am considering is the alignment: If the road is intentionally designed to be straight, but slightly off the grid in precise GIS data, snap the orientation to N-S or W-E direction and it will be much better for minecraft. And we can make the roads and blocks align to chunk, which opens up opportunity to embed refined architecture from others' works by simply copying chunks. I have already done a simple test of a snapping iteration algorithm. I work on numerical iterations and this should not be too difficult to accomplish.

If developing in my proposed way: The GUI will look like a common design software in the future. On left workflow bar there should be 'Import Maps Data', 'Edit', 'Convert to minecraft', 'Export world'. 'Import Maps Data' creates maps data in the memory, can be either loaded from OSM or from a previously editted case file. 'Edit' should have rotate/translate/scale, and 'snap to grid', etc. functions. 'Convert to minecraft' might have options like using customized terrain as base (generated by professional terrain generator), etc..

XianlinSheng avatar Mar 30 '25 02:03 XianlinSheng

Hi, any update about this rotation feature?!

Kuki77 avatar Aug 29 '25 08:08 Kuki77

I tested some necessary data structures needed for this a month ago, but I suddenly got many jobs to work on after that. I will turn back on this once I can make some time out. If you are curious, I can give you a more detailed overview of it:

  • [x] Maps Transformation Architecture: An extending architecture to edit object coordinates in the maps
  • [x] Cartesian/Geographical Coordinate System: A structured way to represent coordinates and the conversions
  • [x] Poly XZBBox: Enable city shapes not in xz-aligned boxes (including rotated boxes). This is the basis for rotation, clip, skew, and other free transforms. I am using ndarray to store vertex coordinates and a 2d mask field for performance.
  • [x] Rotation on coordinates and XZBBox: Simply applying a formula on previous data structures.
  • [x] Extra works on elevation data.
  • [ ] Cleanup, more tests

XianlinSheng avatar Aug 29 '25 20:08 XianlinSheng

Hello @XianlinSheng,

I would love to See this Feature, as well. When it will be ready, I will donate you and @louis-e , each 50€!

Thank you both for your time!

p1337 avatar Aug 30 '25 03:08 p1337

Rotation 28.8 deg about 7 Ave 59 St Manhattan. Only for maps elements now, further works needed for elevation data. Image Image Image Image

XianlinSheng avatar Sep 01 '25 00:09 XianlinSheng

@XianlinSheng That's impressive! Please also check / test it with much smaller buildings or houses. When the small one-family houses are ~ 10 x 10 meters big, it should be possible to get the walls completely straight, I hope.

Kuki77 avatar Sep 01 '25 05:09 Kuki77

@Kuki77 What you want aligns with mine, about making walls and roads completely straight. The idea is to first rotate the map for an approximate angle, and apply another snap to grid transform to make small angles completely straight. Before I even started to write the architecture, I had already tested an algorithm to completely snap the lines to grid (#400 ), so it is possible to make it straight, but that will be a next step extension.

XianlinSheng avatar Sep 06 '25 19:09 XianlinSheng