Advanced

Re: Country polygons break the map

Country polygons break the map
August 31, 2024 08:09AM
Hello!
I'm currently developing a new Country / Region / County checker script that shall visualize the found areas on the map.

To show a country, I first get its polygon data:
local polygonData = PGC.GetCountryPolygonInfo('Germany')

This returns a table, whose index 1 looks like this:
{
maxLon = 15.0419309
name = Germany
minLon = 5.8663153
id = country:79
minLat = 47.2701114
maxLat = 55.0586617
area = 357648511915.3576
}

To show it on the map, I add a polygon with this "id" like this:
table.insert(map.polygons, {color = 'green', polygon = 'country:79', fillOpacity = 0.1 })

However, this completely breaks the map. The polygon is not shown and also the OpenStreetMap background is not shown anymore. Everything is just grey.

Using the same approach for regions (i.e. 'region:13959') and counties (i.e. 'county:298404') works fine.

So I guess there is a bug with the map feature for country polygons somewhere?

I also found a small bug in PGC.GetCountyPolygonInfoFromRegion(). That function returns polygon IDs with a dash ('-') instead of the double-colon (':'). Those IDs don't work on the map. All other polygon info functions return polygon IDs with double-colon, which work at least for region and county, but not for country.
Re: Country polygons break the map
December 02, 2024 07:22PM
PolygonInfo functions and showing country polygons on the map now work as expected.
Thanks to Magnus for fixing it!
Sorry, you do not have permission to post/reply in this forum.