[0.11.x] Factorio Maps

Topics and discussion about specific mods
jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

[0.11.x] Factorio Maps

Post by jeroon »

As requested here

This mod creates a Google Map of your Factorio game. It will create a local html file, nothing has to be uploaded for it to work.

Usage :

- Click "Generate Images". This will start taking the screenshots, and generate an index.html in the script-output folder. Script-output is in the same folder as Saves.
- Open index.html in your browser (Double click it/Open With/Drag in browserwindow)

For info on the advanced options, click Help.

ToDo:
- Add markers to the map/ set center of map (need to figure out Google Maps pixel to Latitude)
- Make advanced stuff disappear with the click of a button ; )

Changelog:
17 nov 2014: v0.4.1
- Small change to make it work in 0.11.3
changelog older versions
Attachments
FactorioMaps_0.4.1.zip
(8.88 KiB) Downloaded 3204 times
Last edited by jeroon on Mon Nov 17, 2014 8:18 pm, edited 17 times in total.
_aD
Fast Inserter
Fast Inserter
Posts: 212
Joined: Sat Apr 12, 2014 12:03 am
Contact:

Re: [0.10.x] Factorio Maps

Post by _aD »

Easy to run and the output works flawlessly. A good way of planning long term expansion! Would purchase again A++++***
User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by cube »

Image

Two minor additions into the todo list:
- Rename the zip so that it works with https://forums.factorio.com/forum/vie ... =14&t=5364 (FactorioMaps_0.0.1.zip )
- Set daytime to noon before making the screenshots and set it back afterwards.
User avatar
Skellitor301
Fast Inserter
Fast Inserter
Posts: 157
Joined: Mon Aug 04, 2014 10:04 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by Skellitor301 »

You do realize you can already do this and make labeled markers in the game right?

Image

Just place a single track and put down a trainstop next to it, then remove the track, and finally rename the stop.
jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

Re: [0.10.x] Factorio Maps

Post by jeroon »

Skellitor301 wrote:You do realize you can already do this and make labeled markers in the game right?

Just place a single track and put down a trainstop next to it, then remove the track, and finally rename the stop.
You posted this in the original thread as well, and I didn't understand what you meant then, and I still don't :D What does that do?
User avatar
Skellitor301
Fast Inserter
Fast Inserter
Posts: 157
Joined: Mon Aug 04, 2014 10:04 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by Skellitor301 »

Train Stops can be renamed, and the names will show up in both the minimap and the full map at the location. I've used them to label my bases and sites

basically the same as the google maps api with labled locations, just vanilla
jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

Re: [0.10.x] Factorio Maps

Post by jeroon »

Skellitor301 wrote:Train Stops can be renamed, and the names will show up in both the minimap and the full map at the location. I've used them to label my bases and sites
I see. But this mod takes screenshots, it doesn't use the map or the minimap.
User avatar
Skellitor301
Fast Inserter
Fast Inserter
Posts: 157
Joined: Mon Aug 04, 2014 10:04 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by Skellitor301 »

I use screenshooter for things like that, been using it for years. But yea, just wanted to point out the same thing can be achieved in vanilla
User avatar
StoneLegion
Filter Inserter
Filter Inserter
Posts: 687
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by StoneLegion »

Works! Here is an example :)
http://stonelegion.com/kane/Map2/
User avatar
micomico
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Thu Jul 24, 2014 10:55 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by micomico »

Awesome mod. Works really well.

It's a pity that the screenshot function doesn't capture the Alt info.
User avatar
StoneLegion
Filter Inserter
Filter Inserter
Posts: 687
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by StoneLegion »

micomico wrote:Awesome mod. Works really well.

It's a pity that the screenshot function doesn't capture the Alt info.
I think he might be able to add that as the screenshot function if I recall has the ability to set true for gui.
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

Re: [0.10.x] Factorio Maps

Post by DaCyclops »

Wow, Nicely Done! A pity it cant (currently) show the Alt overlay information, but if you turn it on always it does show F4 Debug information.

EDIT: sniped while I was typing :P
The built in Screenshot feature can capture the Alt information as part of the GUI, but then it would get the entire GUI. From my knowledge of how the google maps custom maps API works, turning that on would break how he currently generates it so fast without an external app. unless they update the function to allow Alt info without full GUI....
User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by cube »

If you change extensions from png to jpg, the file size and saving time both drop about 10 times :-)
jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

Re: [0.10.x] Factorio Maps

Post by jeroon »

cube wrote:If you change extensions from png to jpg, the file size and saving time both drop about 10 times :-)
Oh wow, I was about to test that, but I never realized the difference was that big. The next version will use jpg, and once I figure out how to zoom in past the current min/max level, I might add an option to do the maps in .png. I don't think you do only the max zoom level in png, and the rest in jpg, because you have to specify the format in the index.html
Devcod
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Aug 08, 2014 8:14 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by Devcod »

jeroon wrote:I don't think you do only the max zoom level in png, and the rest in jpg, because you have to specify the format in the index.html
You can use if statement in JavaScript part of index.html to load files based on zoom level.
This should theoretically work, but I can't test it right now:

Code: Select all

CustomMapType.prototype.getTile = function(coord, zoom, ownerDocument) {
    var div = ownerDocument.createElement('DIV');
    var baseURL = 'Images/';
    var ext = "";
    if (zoom === CustomMapType.prototype.maxZoom) {
        ext = "png";
    } else {
        ext = "jpg";
    }
    baseURL += zoom + '_' + coord.x + '_' + coord.y + '.' + ext;
    div.style.width = this.tileSize.width + 'px';
    div.style.height = this.tileSize.height + 'px';
    div.style.backgroundColor = '#1B2D33';
    div.style.backgroundImage = 'url(' + baseURL + ')';
    return div;
};
If statement, that I added, should change ext variable to png if zoom level is same as maxzoom level. If it is not, then it is set to jpg.

Edit:

Code: Select all

center: new google.maps.LatLng(-15.07,-20.08)
I think that 0,0 would be better :)
User avatar
Phillip_Lynx
Filter Inserter
Filter Inserter
Posts: 541
Joined: Mon Jul 21, 2014 6:00 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by Phillip_Lynx »

Devcod wrote:..Edit:

Code: Select all

center: new google.maps.LatLng(-15.07,-20.08)
I think that 0,0 would be better :)
Maybe centered on Player position at start??
Devcod
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Aug 08, 2014 8:14 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by Devcod »

Phillip_Lynx wrote:Maybe centered on Player position at start??
Setting it to 0,0 will give more consistency in case of map update (player position may change, 0,0 should always be in same place).
jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

Re: [0.10.x] Factorio Maps

Post by jeroon »

cube wrote:- Set daytime to noon before making the screenshots and set it back afterwards.
I'm running into something weird here:

using (just a test)

Code: Select all

game.onload(function()
	game.daytime = 0
	game.takescreenshot{}
end)
works like I expect, taking a screenshot in broad daylight. When I change it to

Code: Select all

game.onload(function()
	game.daytime = 0
	game.takescreenshot{}
	game.daytime = .5
end)
It takes a screenshot in the dark. I've seen this before, where it printed info to the screen before it completed taking all screenshots. Does it complete all code before it starts taking screenshots perhaps?
Phillip_Lynx wrote:Maybe centered on Player position at start??
I'll try to make an option, Player position or center. But 0,0 is not the center unfortunately :D
Devcod
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Aug 08, 2014 8:14 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by Devcod »

jeroon wrote: using (just a test)

Code: Select all

game.onload(function()
	game.daytime = 0
	game.takescreenshot{}
end)
works like I expect, taking a screenshot in broad daylight. When I change it to

Code: Select all

game.onload(function()
	game.daytime = 0
	game.takescreenshot{}
	game.daytime = .5
end)
It takes a screenshot in the dark. I've seen this before, where it printed info to the screen before it completed taking all screenshots. Does it complete all code before it starts taking screenshots perhaps?
Maybe instead use game.alwaysday ? Here you have information about it: https://forums.factorio.com/wiki/inde ... #alwaysday
User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.10.x] Factorio Maps

Post by cube »

takescreenshot only creates a request and requests are processed after everything in the current tick updates.
Post Reply

Return to “Mods”