Open Daylen69 opened 3 months ago
Although it is possible to obtain elevation data at various zoom levels, it will ultimately resize to 4,096px in CS2. Using an overly large image can reduce the size significantly and make the image appear pixelated. This is a common result in image processing.
Note that the maximum zoom level for Mapbox elevation data is 15, so there is no point in acquiring more data. Additionally, Mapbox's elevation data is primarily sourced from SRTM, so its resolution is only about 30 meters. Of course, some areas may have higher resolution, while others may have even lower resolution.
CS2 has a playable area resolution of 3.5 meters, so there is no free, easily, and globally available elevation data that meets this requirement.
@nonta1234 But would it be possible for you to increase the quality (zoom level and size) of image styles (streets, outdoor, satellite, etc.)? It would help a lot since there's a mod for CS2 where you can use those images as overlay and the higher their quality is the better we can work with them.
I have several ideas for getting static images, so I would like to consider them a little more.
@nonta1234 Would you mind to tell your ideas?
Simply put, it splits the map image, retrieves the pieces, and then combines them. The problem is that rotated grids can introduce artifacts at the seams, and some zoom levels require a large number of images.
So the images would be combined to one large image before they get downloaded or how would it work?
Pieces are combined before downloading. However, if the combined image size exceeds 16,384px, it will be resized.
Is this pixel resolution a limitation and if so from what? I mean it could be sufficient enough as long as the resolution has the power of two and is at least twice as big as the resolution of the images we currently get from your generator. It would be nice if we can read the names of each street on the image.
This is a limitation of the Canvas API (or rather, a limitation of Chrome) and a limitation of Image Overlay Mod.
NVM, i guess 16,384px should be enough to be able to see an read the names of all streets on the map. Thanks for hinting to the description of Image Overlay Mod. I seem to forgot that it only supports the vanilla play area and not the entire in-game worldmap. Would it be possible anyways to also optionally get images of the surrounding area in the selection? This may won't help within C:S 2 by now but could probably be useful for creating maps in other games or software.
That sounds better. I will create an option that allows for the inclusion of unplayable areas.
That's great!
@nonta1234 Thanks for adding the feature! 😍 I neither know which zoom level I'm currently on nor do I know in which direction the value should go to get more details. Maybe it would be helpful if users could see which zoom level they're currently using (e.g. as info in the left window?) when zooming in or out on the live map, especially if they want to use this zoom level for downloaded images.
I understand. I would consider displaying it in the settings panel.
@nonta1234 Omg, you're so amazing! 😍 Thanks for the quick implementation!
@nonta1234 One more question: When looking into the settings of "Customize Map Image", what does "Auto" for "Zoom Type" and "Size Type" mean? Will there be used the default values or will there be used the values based on the current zoom of the live map?
I did some testing with following Custom Map Image settings:
Zoom Type = Custom Zoom Level = 18:00 Size Type = Auto Image Size = 16.384px Full Area (CS2) = Enabled
I tried to get a street image as well as a satellite image and it seems like there's an issue with the final results (s. pic.).
Satellite Image:
Street Image:
@nonta1234 One more question: When looking into the settings of "Customize Map Image", what does "Auto" for "Zoom Type" and "Size Type" mean? Will there be used the default values or will there be used the values based on the current zoom of the live map?
If one is set to Auto, the value closest to the original data with almost no scaling will be calculated according to the setting of the other.
I did some testing with following Custom Map Image settings:
Zoom Type = Custom Zoom Level = 18:00 Size Type = Auto Image Size = 16.384px Full Area (CS2) = Enabled
I tried to get a street image as well as a satellite image and it seems like there's an issue with the final results (s. pic.).
Satellite Image:
Street Image:
Perhaps your zoom level is too high and you've reached Mapbox's concurrent download limit. Try setting the zoom level to about 15. Anyway, each time the zoom level increases, the number of tile requests increases exponentially. Support for circumventing request limits is a matter for future consideration.
Upon further investigation, it appears that the browser's queue limit is being exceeded due to a large number of asynchronous processing requests. In Chrome, this queue has a hard-coded limit of 25MB. There needs to be some workaround around this as well.
v1.5.2
@nonta1234 Unfortunately, with zoom level set to 15 I wouldn't get displayed all the street names on the map. The lowest useful zoom level seems to be 18. I'm just giving it another try to see what your update has improved. However, the API request count for this project is at 22801, so I probably won't be able to download more than 2 images per month 😅 But I'm okay with that if it works! I'll announce the results here.
Hmkay, it seems like there's an issue with my request:
Do you know what it means?
Chrome throws an error when a large number of requests occur. What's more, this error is not thrown, which is annoying. Maybe that's it?
Anyway, fixed the calculation logic for custom map images. try it.
I just tried it and got the same message again
I would like to see if I can reproduce it here as well, so please let me know the settings for longitude/latitude, zoom, size, etc.
Here are the settings I use:
Left Window Longitude: 8.79100 Latitude: 50.21524 Map Size: 57.344 km
Customize Map Image Style: Streets Zoom Type = Custom Zoom Level = 18:00 Size Type = Auto Full Area (CS2) = Enabled
I tried, but it seems like there are simply too many requests. Chrome was significantly exceeding its queue limit. For reference, Mapbox's static image API has a limit of 600 requests per minute. I experimented with different settings, but it appears that errors occur when the number exceeds 1000. However, since these errors can vary depending on the environment and settings, we haven't imposed uniform restrictions on the app side.
So are both, Chrome and Mapbox, blocking requests that go above 600 respectively 1000 per minute and there's no workaround to get the results I'm looking for?
Chrome has a 25 MB queue limit, which suggests that the number of possible requests can increase significantly. This specification requires more careful consideration. Finding a solution is not easy. Also, implementing the Semaphore class may be a good way to work around Mapbox's limitations. However, processing 20,000 requests can take more than 30 minutes to complete.
Well, if that helps to get the results, then I would put up with the wait until there are better solutions. If you should consider and find a way to implement the Semaphore class, could you then also add an info about the estimated time how long the process will take?
Do you think it would be possible to offer the download of the playable area map at different zoom levels in addition to the default map ?