The map data for all events and tiles seem to be stored in $game_map.map It doesn't have an attr_reader, so you will need to add one to the class Game_Map to get the data from any other objects.
From the Game_Map class, you can get the general event map data by calling @map
This seems to mostly contain a list of all the events on the map, including all their event code. It also has all the settings for the map in the editor, like what tileset to use, what music to play, region paint, and so on.
------------
The actual tile data is found in the @map.data object.
The map tile data lives in $game_map.map.data during runtime.
Note: The map normally doesn't have an attr_reader, you will need to add one if you want to access it from other script objects. If you do not add one, the only object that can get to the data is the class Game_Map.
In Game_Map's script, access the map data with @map.data
The map.data array seems to be a 4 dimensional array, accessed with [X, Y, Z]. It contains the map tile data and region paint settings.
-----------
Z level 0 seems to have the tile data.
I'm not sure entirely how this works yet. Some tiles seem to use Z level 1 as well, and I have yet to test auto tiling situations properly.
My best guess is that Z level 0 tells it what auto tile to use as a base, and Z level 1 tells it what tile to "stack" or "mix" with it. If you look at the data below, all 4 water tiles have the same Z 0 level ID, but obviously they look different as they are the two water depth levels and then the rocks and iceburgs. All these tiles have the same basic blue water base, so I think the 0 slot is a sort of "use this as a base or for auto tiling", and the Z 1 is "display this tile instead of the one in Z 0".
overworld tile data output for example/analysis purposes:
tile number in editor - level 0 number - level 1 number
row 1 Tile 1 - 2048 - 0
row 1 Tile 2 - 2048 - 2096
row 1 Tile 3 - 2048 - 2144
row 1 tile 4 - 2048 - 2230
row 1 tile 5 - 2278 - 0
row 1 tile 6 - 2288 - 0
row 1 tile 7 - 2374 - 0
row 1 tile 8 - 2384 - 0
row 2 tile 1 - 2470 - 0
------------------------------
Z level 2 is the id of the B,C,D,E, tile that is mixed on top of the terrain tile. They seem to start at 0 and just go up by 1 each tile. Each tab in the default tilesets has 256 tiles and the ids start at 0, so:
ID 0 to 255 is tab B's tiles.
ID 256 to 511 is tab C's tiles.
and so on. Pretty straight forward compared to the other two numbers.
--------------------------------
Z level 3 is for shadowing and region paint.
This data is only accurate with no shadows. I need to do some research to figure out exactly which numbers match which shadow/regions. So far an offset of 256 seems to indicate the next region paint number.
Values are:
Code Number = Editor Encounter Paint Number
0 = 0
256 = 1
512 = 2
768 = 3
It seems to be intervals of 256 all the way through. The last number is 16128 for region paint 63, which is 256 * 63.
There doesn't appear to be anything beyond z level 3 in the default, and the editor cannot access anything past that point. I guess technically one could extend this further, but what's here seems to cover everything needed.
------------------
The Game_Map class loads the map data by calling
@map = load_data(sprintf("Data/Map%03d.rvdata2", @map_id))
So long as you pass a valid ID to this function, any code object in the game can call data from the editor data, and get map data in memory. The data this pulls in will be in the same format as the Game_Map's @map.
To actually write data to the editor map data, you would probably call save_data() with presumably the same variables. I haven't tested to see if this works though. It's rather useless for now, as you'll be overwriting all the editor work, and potentially crashing the editor itself(I don't know how stable RPG ace is with invalid map data), so I'd recommend strongly against doing it.