mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added calibration to map generator
This commit is contained in:
parent
2118ded496
commit
c99b5ed19f
@ -458,7 +458,7 @@ module.exports = function (configLocation) {
|
||||
};
|
||||
|
||||
mission(req, res){
|
||||
var ret = {mission: {theatre: "Nevada"}};
|
||||
var ret = {mission: {theatre: "Syria"}};
|
||||
ret.time = Date.now();
|
||||
|
||||
ret.mission.dateAndTime = {
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
"request": "launch",
|
||||
"program": "main.py",
|
||||
"console": "integratedTerminal",
|
||||
"args": ["./configs/Caucasus/HighResolution.yml"]
|
||||
"args": ["./configs/Test/MediumResolution.yml"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,15 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<Document>
|
||||
<name>Senza titolo</name>
|
||||
<name>Low resolution</name>
|
||||
<open>1</open>
|
||||
<gx:CascadingStyle kml:id="__managed_style_280E5494AE2F24E92C22">
|
||||
<Style>
|
||||
<IconStyle>
|
||||
<scale>1.2</scale>
|
||||
<Icon>
|
||||
<href>https://earth.google.com/earth/rpc/cc/icon?color=1976d2&id=2000&scale=4</href>
|
||||
<href>https://earth.google.com/earth/rpc/cc/icon?color=1976d2<![CDATA[&]]>id=2000<![CDATA[&]]>scale=4</href>
|
||||
</Icon>
|
||||
<hotSpot x="64" y="128" xunits="pixels" yunits="insetPixels"/>
|
||||
<hotSpot x="64" y="128" xunits="pixels" yunits="insetPixels"></hotSpot>
|
||||
</IconStyle>
|
||||
<LabelStyle>
|
||||
</LabelStyle>
|
||||
@ -24,14 +25,13 @@
|
||||
<displayMode>hide</displayMode>
|
||||
</BalloonStyle>
|
||||
</Style>
|
||||
</gx:CascadingStyle>
|
||||
<gx:CascadingStyle kml:id="__managed_style_1EB9027B622F24E92C22">
|
||||
</gx:CascadingStyle><gx:CascadingStyle kml:id="__managed_style_1EB9027B622F24E92C22">
|
||||
<Style>
|
||||
<IconStyle>
|
||||
<Icon>
|
||||
<href>https://earth.google.com/earth/rpc/cc/icon?color=1976d2&id=2000&scale=4</href>
|
||||
<href>https://earth.google.com/earth/rpc/cc/icon?color=1976d2<![CDATA[&]]>id=2000<![CDATA[&]]>scale=4</href>
|
||||
</Icon>
|
||||
<hotSpot x="64" y="128" xunits="pixels" yunits="insetPixels"/>
|
||||
<hotSpot x="64" y="128" xunits="pixels" yunits="insetPixels"></hotSpot>
|
||||
</IconStyle>
|
||||
<LabelStyle>
|
||||
</LabelStyle>
|
||||
@ -50,31 +50,35 @@
|
||||
<StyleMap id="__managed_style_0F57E9B9782F24E92C22">
|
||||
<Pair>
|
||||
<key>normal</key>
|
||||
<styleUrl>#__managed_style_1EB9027B622F24E92C22</styleUrl>
|
||||
<styleUrl>#failed0</styleUrl>
|
||||
</Pair>
|
||||
<Pair>
|
||||
<key>highlight</key>
|
||||
<styleUrl>#__managed_style_280E5494AE2F24E92C22</styleUrl>
|
||||
<styleUrl>#failed</styleUrl>
|
||||
</Pair>
|
||||
</StyleMap>
|
||||
<Style id="failed">
|
||||
</Style>
|
||||
<Style id="failed0">
|
||||
</Style>
|
||||
<Placemark id="0975D432582F24E92C1E">
|
||||
<name>Poligono senza titolo</name>
|
||||
<name>Low resolution</name>
|
||||
<LookAt>
|
||||
<longitude>37.25019544589698</longitude>
|
||||
<latitude>44.41771380726969</latitude>
|
||||
<altitude>-138.6844933247498</altitude>
|
||||
<heading>0</heading>
|
||||
<tilt>0</tilt>
|
||||
<gx:fovy>35</gx:fovy>
|
||||
<range>3831683.119853139</range>
|
||||
<altitudeMode>absolute</altitudeMode>
|
||||
<gx:fovy>35</gx:fovy>
|
||||
</LookAt>
|
||||
<styleUrl>#__managed_style_0F57E9B9782F24E92C22</styleUrl>
|
||||
<Polygon>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
32.46459319237173,45.67416695848307,0 32.2740650283415,45.2221541106433,0 33.22174616520244,44.4837859435444,0 34.05427109764131,44.2149221586376,0 34.96485577272431,44.60230684639296,0 35.50552864748745,44.8069362633187,0 36.446105774871,44.84425518198143,0 36.76914203317659,44.70347050722764,0 38.22313992004164,44.3163345847565,0 39.43106567523965,43.72064977016311,0 40.23832274382622,43.06831352526857,0 41.01327578994438,42.67925159935859,0 41.34464189582403,42.34329512558789,0 41.16749495371268,41.74956946999534,0 40.80780496107725,41.39360013128164,0 39.98364177441992,41.27272565351572,0 39.42209428526464,41.27830763089842,0 38.82136897872954,41.2291415593637,0 38.78900701766597,39.59331113999448,0 46.4826445997655,39.11657164682355,0 46.83937081793388,45.04996086829865,0 46.88987497227086,47.59122144470205,0 32.29992865035658,47.73230965442627,0 32.46459319237173,45.67416695848307,0
|
||||
32.46459319237173,45.67416695848307,0 32.2740650283415,45.2221541106433,0 33.22174616520244,44.4837859435444,0 34.05427109764131,44.2149221586376,0 34.96485577272431,44.60230684639296,0 35.50552864748745,44.8069362633187,0 36.446105774871,44.84425518198143,0 36.76914203317659,44.70347050722764,0 38.22313992004164,44.3163345847565,0 39.43106567523965,43.72064977016311,0 40.23832274382622,43.06831352526857,0 41.01327578994438,42.67925159935859,0 41.34464189582403,42.34329512558789,0 41.16749495371268,41.74956946999534,0 40.80780496107725,41.39360013128164,0 39.98364177441992,41.27272565351572,0 39.42209428526464,41.27830763089842,0 38.82136897872954,41.2291415593637,0 38.82458556682658,39.86622166029085,0 45.8381687868953,39.59275112715873,0 45.98912922607954,43.86743059613963,0 46.10445698500042,45.31544913665732,0 34.15598911357598,46.421850808793,0 32.46459319237173,45.67416695848307,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
{
|
||||
'output_directory': '.\NTTR', # Where to save the output files
|
||||
'boundary_file': '.\configs\NTTR\boundary.kml', # Input kml file setting the boundary of the map to create
|
||||
'boundary_file': '.\configs\NTTR\LowResolution.kml', # Input kml file setting the boundary of the map to create
|
||||
'zoom_factor': 0.5 # [0: maximum zoom in (things look very big), 1: maximum zoom out (things look very small)]
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<Document>
|
||||
<name>MediumResolution.kml</name>
|
||||
<StyleMap id="m_ylw-pushpin">
|
||||
<Pair>
|
||||
<key>normal</key>
|
||||
<styleUrl>#s_ylw-pushpin</styleUrl>
|
||||
</Pair>
|
||||
<Pair>
|
||||
<key>highlight</key>
|
||||
<styleUrl>#s_ylw-pushpin_hl</styleUrl>
|
||||
</Pair>
|
||||
</StyleMap>
|
||||
<Style id="s_ylw-pushpin">
|
||||
<IconStyle>
|
||||
<scale>1.1</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
<Style id="s_ylw-pushpin_hl">
|
||||
<IconStyle>
|
||||
<scale>1.3</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
<Placemark>
|
||||
<name>Untitled Polygon</name>
|
||||
<styleUrl>#m_ylw-pushpin</styleUrl>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
-114.934770823132,36.0279645610818,0 -114.8423692017325,36.14486669307939,0 -114.8222988019772,36.33833555517232,0 -115.1043264248258,36.37857716972037,0 -115.4103523219488,36.37739101654672,0 -115.4685702901508,36.22908230367275,0 -115.3526428993333,35.95526029180954,0 -115.070949845899,35.9300532859497,0 -114.934770823132,36.0279645610818,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
</Placemark>
|
||||
</Document>
|
||||
</kml>
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
'output_directory': '.\Syria', # Where to save the output files
|
||||
'boundary_file': '.\configs\Syria\airbases.kml', # Input kml file setting the boundary of the map to create
|
||||
'zoom_factor': 0.1 # [0: maximum zoom in (things look very big), 1: maximum zoom out (things look very small)]
|
||||
}
|
||||
77
scripts/python/map_generator/configs/Syria/LowResolution.kml
Normal file
77
scripts/python/map_generator/configs/Syria/LowResolution.kml
Normal file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<Document>
|
||||
<name>LowResolution.kml</name>
|
||||
<StyleMap id="msn_ylw-pushpin">
|
||||
<Pair>
|
||||
<key>normal</key>
|
||||
<styleUrl>#sn_ylw-pushpin</styleUrl>
|
||||
</Pair>
|
||||
<Pair>
|
||||
<key>highlight</key>
|
||||
<styleUrl>#sh_ylw-pushpin</styleUrl>
|
||||
</Pair>
|
||||
</StyleMap>
|
||||
<Style id="sh_ylw-pushpin">
|
||||
<IconStyle>
|
||||
<scale>1.3</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
<BalloonStyle>
|
||||
</BalloonStyle>
|
||||
<LineStyle>
|
||||
<color>ccffffff</color>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>ccffffff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="sn_ylw-pushpin">
|
||||
<IconStyle>
|
||||
<scale>1.1</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
<BalloonStyle>
|
||||
</BalloonStyle>
|
||||
<LineStyle>
|
||||
<color>ccffffff</color>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>ccffffff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Placemark>
|
||||
<name>Untitled Polygon</name>
|
||||
<snippet></snippet>
|
||||
<styleUrl>#msn_ylw-pushpin</styleUrl>
|
||||
<MultiGeometry>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
32.41977350619059,35.86470912083693,0 33.56465531835013,35.91338825318785,0 34.80465378369205,36.47063196055174,0 35.60801631485135,36.34864532719317,0 35.49398676174558,34.21289059062669,0 34.5206672018921,31.81057604629355,0 43.95360383704013,31.37489080200468,0 44.25820669948404,37.93208169895772,0 30.99244388115055,37.7086326320776,0 31.19610811985261,36.49739270534763,0 32.41977350619059,35.86470912083693,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
32.49633696227876,34.50684717795233,0 33.09849375950411,34.48604280166101,0 33.90493204321842,34.73753410158289,0 34.25924480309209,34.95889575718786,0 34.62649679333629,35.4114629095852,0 34.72182823714807,35.80074945874743,0 32.99109621791929,35.58668302906084,0 32.02791860799897,35.17891332024415,0 32.07780557518355,34.72891507299879,0 32.49633696227876,34.50684717795233,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
</MultiGeometry>
|
||||
</Placemark>
|
||||
</Document>
|
||||
</kml>
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
'output_directory': '.\Syria', # Where to save the output files
|
||||
'boundary_file': '.\configs\Syria\LowResolution.kml', # Input kml file setting the boundary of the map to create
|
||||
'zoom_factor': 0.5 # [0: maximum zoom in (things look very big), 1: maximum zoom out (things look very small)]
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<Document>
|
||||
<name>MediumResolution.kml</name>
|
||||
<StyleMap id="msn_ylw-pushpin">
|
||||
<Pair>
|
||||
<key>normal</key>
|
||||
<styleUrl>#sn_ylw-pushpin</styleUrl>
|
||||
</Pair>
|
||||
<Pair>
|
||||
<key>highlight</key>
|
||||
<styleUrl>#sh_ylw-pushpin</styleUrl>
|
||||
</Pair>
|
||||
</StyleMap>
|
||||
<Style id="sh_ylw-pushpin">
|
||||
<IconStyle>
|
||||
<scale>1.3</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
<BalloonStyle>
|
||||
</BalloonStyle>
|
||||
<LineStyle>
|
||||
<color>ccffffff</color>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>73ffffff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="sn_ylw-pushpin">
|
||||
<IconStyle>
|
||||
<scale>1.1</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
<BalloonStyle>
|
||||
</BalloonStyle>
|
||||
<LineStyle>
|
||||
<color>ccffffff</color>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>73ffffff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Placemark>
|
||||
<name>Untitled Polygon</name>
|
||||
<snippet></snippet>
|
||||
<styleUrl>#msn_ylw-pushpin</styleUrl>
|
||||
<MultiGeometry>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
34.67142705790602,31.82805055444974,0 35.02181508963836,31.82750977829048,0 36.01467177481414,31.98675180910247,0 36.23127775126287,32.04983840957699,0 35.9582646803902,32.28158293849557,0 35.99098147339456,32.44310980472873,0 36.09260593928732,32.55565643757006,0 36.61524825014531,32.48930025627462,0 36.60745776125667,32.80133625144484,0 36.47504812245365,33.05297304144123,0 36.35141964104501,33.3083703333435,0 36.35264203669159,33.49386454528514,0 36.47877595475967,33.58571959973897,0 36.19517390228444,33.5997606321796,0 35.83522397638479,33.61896603596939,0 35.91132793661291,33.79098072794213,0 36.15374710260814,34.26719887569751,0 36.25809031624735,34.42504420256356,0 36.50878759959249,34.48069803556503,0 36.72702134605258,34.5389760993956,0 36.91155927128435,34.70573020374997,0 36.93709483596604,34.8575453420497,0 36.84204849159945,35.0188804802811,0 36.85909086701554,35.12582156419841,0 36.80631271949839,35.2023007921343,0 36.70610451487763,35.28868757265818,0 36.64736791080302,35.33884042510283,0 36.58285870081706,35.39379914572466,0 36.45913791605572,35.785089727734,0 36.53039600108779,35.94339777542626,0 36.67529798763221,36.16555606706433,0 37.19354340712839,36.10461671438422,0 37.30210041940058,36.1672896392403,0 37.26914131633509,36.28180024676594,0 37.10359257192819,36.30310271023975,0 37.00689884978731,36.29046216813635,0 36.76464397760902,36.31629718954267,0 36.58584728151514,36.41485334551175,0 36.43276721089462,36.51419040401807,0 36.55081614559194,36.74504433804638,0 36.64379067414161,36.89890120179727,0 36.65347158496201,37.09461289580837,0 36.5670026915683,37.32284183349276,0 36.18331192127231,37.44082203549982,0 35.69883621035919,37.46691398938869,0 35.10303034414353,37.32678813082578,0 34.73373550417249,37.10256441028478,0 34.54672782985384,36.94278408400594,0 33.82387226696957,36.35935429361331,0 34.00780785927724,36.27288227125526,0 34.71609500104023,36.80115830525168,0 35.31231838128146,36.54974589517469,0 35.56842677899099,36.54590520153501,0 36.03653930366797,36.90903074000526,0 36.19000487976967,36.62318809953995,0 35.80177667905849,36.33612053423278,0 35.99066329315939,35.96583287218078,0 35.69248548202563,35.56301025420937,0 35.92254840918157,35.19455893234127,0 35.98470152257408,34.47521931409463,0 35.58103018441831,34.26637735596449,0 35.05797659081225,32.82931778284781,0 34.96691044071693,32.82607518990291,0 34.67142705790602,31.82805055444974,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
32.87727021160179,34.63039920198953,0 32.89796765395525,34.54413238804481,0 33.0513805484542,34.53311613075366,0 33.06805771189331,34.58449144684735,0 33.30594035942946,34.68068961400989,0 33.60655009787457,34.7834317386,0 33.66048901593272,34.8393762347752,0 33.70608869593579,34.95372458806005,0 33.90513134812218,34.93229745061615,0 34.1071842570156,34.94799211011232,0 33.94596222366071,35.13090630203342,0 34.03291716899977,35.33217278671437,0 34.00480141824541,35.41895359888199,0 33.86414270927582,35.36764075672064,0 33.48955253703217,35.27107279823272,0 32.94309978357973,35.39409014047924,0 32.72304170959251,35.13465820902891,0 33.02509969669595,35.06722355440451,0 33.44152949697186,35.00493863785168,0 33.43618672640994,34.91604930651071,0 33.31998050412736,34.76455001947792,0 32.87980862276667,34.77470445862257,0 32.7489895060826,34.66006328417646,0 32.87727021160179,34.63039920198953,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
37.316751241333,36.13625362966467,0 37.4802212403484,35.98662494935605,0 37.69339926931355,35.87154344120644,0 38.14290686820461,35.77632913948397,0 38.5968154612054,35.78564003854654,0 38.89284932130154,35.8779076116201,0 39.07507331612245,35.86639415034433,0 39.20140789434584,35.82480100674179,0 39.2433581758882,35.91988707796679,0 39.14777729544377,36.06853895742726,0 39.05867321853522,36.17697296815244,0 38.94276312671954,36.17039388164508,0 38.82993809202534,36.02864047564345,0 38.7422129714303,35.90314522534125,0 38.64230099519071,35.87869415817486,0 38.35798797186277,35.94095820496009,0 38.13165022867805,35.95691377930053,0 37.93541220365955,36.10819502548598,0 37.67868372711114,36.15507075771183,0 37.36536807770124,36.17289309161047,0 37.316751241333,36.13625362966467,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
</MultiGeometry>
|
||||
</Placemark>
|
||||
</Document>
|
||||
</kml>
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
'output_directory': '.\Syria', # Where to save the output files
|
||||
'boundary_file': '.\configs\Syria\MediumResolution.kml', # Input kml file setting the boundary of the map to create
|
||||
'zoom_factor': 0.25 # [0: maximum zoom in (things look very big), 1: maximum zoom out (things look very small)]
|
||||
}
|
||||
1
scripts/python/map_generator/configs/Syria/airbases.json
Normal file
1
scripts/python/map_generator/configs/Syria/airbases.json
Normal file
File diff suppressed because one or more lines are too long
1
scripts/python/map_generator/configs/Syria/airbases.kml
Normal file
1
scripts/python/map_generator/configs/Syria/airbases.kml
Normal file
File diff suppressed because one or more lines are too long
48
scripts/python/map_generator/configs/Test/LowResolution.kml
Normal file
48
scripts/python/map_generator/configs/Test/LowResolution.kml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<Document>
|
||||
<name>LowResolution.kml</name>
|
||||
<StyleMap id="m_ylw-pushpin">
|
||||
<Pair>
|
||||
<key>normal</key>
|
||||
<styleUrl>#s_ylw-pushpin</styleUrl>
|
||||
</Pair>
|
||||
<Pair>
|
||||
<key>highlight</key>
|
||||
<styleUrl>#s_ylw-pushpin_hl</styleUrl>
|
||||
</Pair>
|
||||
</StyleMap>
|
||||
<Style id="s_ylw-pushpin">
|
||||
<IconStyle>
|
||||
<scale>1.1</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
<Style id="s_ylw-pushpin_hl">
|
||||
<IconStyle>
|
||||
<scale>1.3</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
<Placemark>
|
||||
<name>Untitled Polygon</name>
|
||||
<styleUrl>#m_ylw-pushpin</styleUrl>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
36.39481280710839,34.53819230857288,0 37.1796694816022,34.53262792655826,0 37.16621384783188,34.96261757019548,0 36.40060390213443,34.96928234867986,0 36.39481280710839,34.53819230857288,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
</Placemark>
|
||||
</Document>
|
||||
</kml>
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
'output_directory': '.\Test', # Where to save the output files
|
||||
'boundary_file': '.\configs\Test\LowResolution.kml', # Input kml file setting the boundary of the map to create
|
||||
'zoom_factor': 0.5 # [0: maximum zoom in (things look very big), 1: maximum zoom out (things look very small)]
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<Document>
|
||||
<name>MediumResolution.kml</name>
|
||||
<StyleMap id="m_ylw-pushpin">
|
||||
<Pair>
|
||||
<key>normal</key>
|
||||
<styleUrl>#s_ylw-pushpin</styleUrl>
|
||||
</Pair>
|
||||
<Pair>
|
||||
<key>highlight</key>
|
||||
<styleUrl>#s_ylw-pushpin_hl</styleUrl>
|
||||
</Pair>
|
||||
</StyleMap>
|
||||
<Style id="s_ylw-pushpin">
|
||||
<IconStyle>
|
||||
<scale>1.1</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
<Style id="s_ylw-pushpin_hl">
|
||||
<IconStyle>
|
||||
<scale>1.3</scale>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
|
||||
</Icon>
|
||||
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
<Placemark>
|
||||
<name>Untitled Polygon</name>
|
||||
<styleUrl>#m_ylw-pushpin</styleUrl>
|
||||
<Polygon>
|
||||
<tessellate>1</tessellate>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
36.66523183398584,34.6677562111174,0 36.7942537132104,34.66437454529529,0 36.83169732011983,34.73421112648619,0 36.82035549501334,34.78872158568599,0 36.81876694797644,34.78938919967693,0 36.71678396314233,34.81175454434261,0 36.71358833183864,34.81177596936792,0 36.64080355603824,34.80367957661652,0 36.61013139556666,34.76382161679572,0 36.60930683760219,34.76054596757088,0 36.60928608362357,34.75792169295608,0 36.60927570797851,34.75660959986943,0 36.61934895519745,34.71456838542862,0 36.64380557289082,34.68164055942542,0 36.66523183398584,34.6677562111174,0
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
</Polygon>
|
||||
</Placemark>
|
||||
</Document>
|
||||
</kml>
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
'output_directory': '.\Test', # Where to save the output files
|
||||
'boundary_file': '.\configs\Test\MediumResolution.kml', # Input kml file setting the boundary of the map to create
|
||||
'zoom_factor': 0.25 # [0: maximum zoom in (things look very big), 1: maximum zoom out (things look very small)]
|
||||
}
|
||||
@ -102,9 +102,10 @@ def merge_tiles(base_path, zoom, tile):
|
||||
# If the image already exists, open it so we can paste the higher quality data in it
|
||||
if os.path.exists(os.path.join(base_path, str(zoom - 1), str(X), f"{Y}.jpg")):
|
||||
dst = Image.open(os.path.join(base_path, str(zoom - 1), str(X), f"{Y}.jpg"))
|
||||
dst.putalpha(255)
|
||||
dst = make_background_transparent(dst)
|
||||
else:
|
||||
dst = Image.new('RGB', (256, 256), (221, 221, 221))
|
||||
dst = Image.new('RGBA', (256, 256), (221, 221, 221, 255))
|
||||
|
||||
# Loop on all the 4 subtiles in the tile
|
||||
positions = [(0, 0), (0, 1), (1, 0), (1, 1)]
|
||||
@ -112,8 +113,9 @@ def merge_tiles(base_path, zoom, tile):
|
||||
# Open the subtile, if it exists, and resize it down to 128x128
|
||||
if os.path.exists(os.path.join(base_path, str(zoom), str(2*X + positions[i][0]), f"{2*Y + positions[i][1]}.jpg")):
|
||||
im = Image.open(os.path.join(base_path, str(zoom), str(2*X + positions[i][0]), f"{2*Y + positions[i][1]}.jpg")).resize((128, 128))
|
||||
im.putalpha(255)
|
||||
im = make_background_transparent(im)
|
||||
dst.paste(im, (positions[i][0] * 128, positions[i][1] * 128))
|
||||
dst.paste(im, (positions[i][0] * 128, positions[i][1] * 128), im)
|
||||
|
||||
# Create the output folder if it exists
|
||||
if not os.path.exists(os.path.join(base_path, str(zoom - 1), str(X))):
|
||||
@ -126,19 +128,114 @@ def merge_tiles(base_path, zoom, tile):
|
||||
raise e
|
||||
|
||||
# Save the image
|
||||
dst.convert('RGB').save(os.path.join(base_path, str(zoom - 1), str(X), f"{Y}.jpg"), quality=95)
|
||||
remove_black_areas(dst.convert('RGB')).save(os.path.join(base_path, str(zoom - 1), str(X), f"{Y}.jpg"), quality=98)
|
||||
|
||||
def computeCorrectionFactor(XY, n_width, n_height, map_config, zoom, output_directory, port):
|
||||
# Take screenshots at the given position, then east and south of it
|
||||
takeScreenshot(XY, 0, 0, map_config, zoom, output_directory, "calib", "ref", port)
|
||||
takeScreenshot((XY[0] + n_width, XY[1]), 0, 0, map_config, zoom, output_directory, "calib", "lng", port)
|
||||
takeScreenshot((XY[0], XY[1] + n_height), 0, 0, map_config, zoom, output_directory, "calib", "lat", port)
|
||||
|
||||
calib_ref = Image.open(os.path.join(output_directory, "screenshots", f"calib_ref_{zoom}.jpg"))
|
||||
calib_lat = Image.open(os.path.join(output_directory, "screenshots", f"calib_lat_{zoom}.jpg"))
|
||||
calib_lng = Image.open(os.path.join(output_directory, "screenshots", f"calib_lng_{zoom}.jpg"))
|
||||
|
||||
# These calibration boxes are located at the edge of the interest region
|
||||
box1 = (calib_ref.width / 2 + n_width / 2 * 256 - 50, calib_ref.height / 2 - n_height / 2 * 256 + 10,
|
||||
calib_ref.width / 2 + n_width / 2 * 256 + 50, calib_ref.height / 2 + n_height / 2 * 256 - 10)
|
||||
box2 = (calib_ref.width / 2 - n_width / 2 * 256 - 50, calib_ref.height / 2 - n_height / 2 * 256 + 10,
|
||||
calib_ref.width / 2 - n_width / 2 * 256 + 50, calib_ref.height / 2 + n_height / 2 * 256 - 10)
|
||||
|
||||
box3 = (calib_ref.width / 2 - n_width / 2 * 256 + 10, calib_ref.height / 2 + n_height / 2 * 256 - 50,
|
||||
calib_ref.width / 2 + n_width / 2 * 256 - 10, calib_ref.height / 2 + n_height / 2 * 256 + 50)
|
||||
box4 = (calib_ref.width / 2 - n_width / 2 * 256 + 10, calib_ref.height / 2 - n_height / 2 * 256 - 50,
|
||||
calib_ref.width / 2 + n_width / 2 * 256 - 10, calib_ref.height / 2 - n_height / 2 * 256 + 50)
|
||||
|
||||
# Find the best correction factor to bring the two images to be equal on the longitude direction
|
||||
best_err = None
|
||||
best_delta_width = 0
|
||||
for delta_width in range(-5, 6):
|
||||
calib_box1 = calib_ref.resize((calib_ref.width + delta_width, calib_ref.height)).crop(box1).convert('L')
|
||||
calib_box2 = calib_lng.resize((calib_ref.width + delta_width, calib_ref.height)).crop(box2).convert('L')
|
||||
err = computeDifference(calib_box1, calib_box2)
|
||||
if best_err is None or err < best_err:
|
||||
best_delta_width = delta_width
|
||||
best_err = err
|
||||
|
||||
# Find the best correction factor to bring the two images to be equal on the latitude direction
|
||||
best_err = None
|
||||
best_delta_height = 0
|
||||
for delta_height in range(-5, 6):
|
||||
calib_box3 = calib_ref.resize((calib_ref.width, calib_ref.height + delta_height)).crop(box3).convert('L')
|
||||
calib_box4 = calib_lat.resize((calib_ref.width, calib_ref.height + delta_height)).crop(box4).convert('L')
|
||||
err = computeDifference(calib_box3, calib_box4)
|
||||
if best_err is None or err < best_err:
|
||||
best_delta_height = delta_height
|
||||
best_err = err
|
||||
|
||||
return (best_delta_width, best_delta_height)
|
||||
|
||||
def computeDifference(imageA, imageB):
|
||||
err = numpy.sum((numpy.array(imageA).astype('float') - numpy.array(imageB).astype('float')) ** 2)
|
||||
err /= float(imageA.width * imageA.height)
|
||||
return err
|
||||
|
||||
def takeScreenshot(XY, n_width, n_height, map_config, zoom, output_directory, f, n, port, correction = (0, 0)):
|
||||
# Making PUT request
|
||||
# If the number of rows or columns is odd, we need to take the picture at the CENTER of the tile!
|
||||
lat, lng = num_to_deg(XY[0] + (n_width % 2) / 2, XY[1] + (n_height % 2) / 2, zoom)
|
||||
data = json.dumps({'lat': lat, 'lng': lng, 'alt': 1350 + map_config['zoom_factor'] * (25000 - 1350), 'mode': 'map'})
|
||||
r = requests.put(f'http://127.0.0.1:{port}', data = data)
|
||||
|
||||
geo_data = json.loads(r.text)
|
||||
|
||||
time.sleep(0.2)
|
||||
|
||||
# Take and save screenshot. The response to the put request contains data, among which there is the north rotation at that point.
|
||||
screenshot = pyautogui.screenshot()
|
||||
|
||||
# Scale the screenshot to account for Mercator Map Deformation
|
||||
lat1, lng1 = num_to_deg(XY[0], XY[1], zoom)
|
||||
lat2, lng2 = num_to_deg(XY[0] + 1, XY[1] + 1, zoom)
|
||||
|
||||
deltaLat = abs(lat2 - lat1)
|
||||
deltaLng = abs(lng2 - lng1)
|
||||
|
||||
# Compute the height and width each tile should have
|
||||
m_height = math.radians(deltaLat) * R
|
||||
m_width = math.radians(deltaLng) * R * math.cos(math.radians(lat1))
|
||||
|
||||
# Compute the height and width the tile has
|
||||
s_height = map_config['mpps'] * 256
|
||||
s_width = map_config['mpps'] * 256
|
||||
|
||||
# Compute the scaling required to achieve that
|
||||
sx = s_width / m_width
|
||||
sy = s_height / m_height
|
||||
|
||||
# Rotate, resize and save the screenshot
|
||||
screenshot.rotate(math.degrees(geo_data['northRotation'])).resize((int(sx * screenshot.width) + correction[0], int(sy * screenshot.height)+ correction[1] )).save(os.path.join(output_directory, "screenshots", f"{f}_{n}_{zoom}.jpg"), quality=98)
|
||||
|
||||
def make_background_transparent(im):
|
||||
im.putalpha(255)
|
||||
data = numpy.array(im)
|
||||
red, green, blue, alpha = data.T
|
||||
|
||||
# If present, remove any "background" areas
|
||||
background_areas = (red == 221) & (blue == 221) & (green == 221)
|
||||
background_areas = (red > 211) & (red < 231) & (green > 211) & (green < 231) & (blue > 211) & (blue < 231)
|
||||
data[..., :][background_areas.T] = (0, 0, 0, 0) # make transparent
|
||||
|
||||
return Image.fromarray(data)
|
||||
|
||||
def remove_black_areas(im):
|
||||
data = numpy.array(im)
|
||||
red, green, blue = data.T
|
||||
|
||||
# If present, remove any "black" areas
|
||||
background_areas = (red < 10) & (blue < 10) & (green < 10)
|
||||
data[..., :][background_areas.T] = (221, 221, 221)
|
||||
|
||||
return Image.fromarray(data)
|
||||
|
||||
def run(map_config, port):
|
||||
global tot_futs, fut_counter
|
||||
|
||||
@ -151,10 +248,12 @@ def run(map_config, port):
|
||||
os.mkdir(output_directory)
|
||||
|
||||
skip_screenshots = False
|
||||
replace_screenshots = True
|
||||
if not os.path.exists(os.path.join(output_directory, "screenshots")):
|
||||
os.mkdir(os.path.join(output_directory, "screenshots"))
|
||||
else:
|
||||
skip_screenshots = (input("Raw screenshots already found for this config, do you want to skip directly to tiles extraction? Enter y to skip: ") == "y")
|
||||
replace_screenshots = (input("Do you want to replace the existing screenshots? Enter y to replace: ") == "y")
|
||||
|
||||
if not os.path.exists(os.path.join(output_directory, "tiles")):
|
||||
os.mkdir(os.path.join(output_directory, "tiles"))
|
||||
@ -218,45 +317,16 @@ def run(map_config, port):
|
||||
print(f"Feature {f} of {len(features)}, {len(screenshots_XY)} screenshots will be taken")
|
||||
|
||||
# Start looping
|
||||
correction = None
|
||||
if not skip_screenshots:
|
||||
print(f"Feature {f} of {len(features)}, taking screenshots...")
|
||||
n = 0
|
||||
for XY in screenshots_XY:
|
||||
# Making PUT request
|
||||
# If the number of rows or columns is odd, we need to take the picture at the CENTER of the tile!
|
||||
lat, lng = num_to_deg(XY[0] + (n_width % 2) / 2, XY[1] + (n_height % 2) / 2, zoom)
|
||||
data = json.dumps({'lat': lat, 'lng': lng, 'alt': 1350 + map_config['zoom_factor'] * (25000 - 1350), 'mode': 'map'})
|
||||
r = requests.put(f'http://127.0.0.1:{port}', data = data)
|
||||
|
||||
geo_data = json.loads(r.text)
|
||||
|
||||
time.sleep(0.1)
|
||||
|
||||
# Take and save screenshot. The response to the put request contains data, among which there is the north rotation at that point.
|
||||
screenshot = pyautogui.screenshot()
|
||||
|
||||
# Scale the screenshot to account for Mercator Map Deformation
|
||||
lat1, lng1 = num_to_deg(XY[0], XY[1], zoom)
|
||||
lat2, lng2 = num_to_deg(XY[0] + 1, XY[1] + 1, zoom)
|
||||
|
||||
deltaLat = abs(lat2 - lat1)
|
||||
deltaLng = abs(lng2 - lng1)
|
||||
|
||||
# Compute the height and width the screenshot should have
|
||||
m_height = math.radians(deltaLat) * R * n_height
|
||||
m_width = math.radians(deltaLng) * R * math.cos(math.radians(lat1)) * n_width
|
||||
|
||||
# Compute the height and width the screenshot has
|
||||
s_height = map_config['mpps'] * 256 * n_height
|
||||
s_width = map_config['mpps'] * 256 * n_width
|
||||
if not os.path.exists(os.path.join(output_directory, "screenshots", f"{f}_{n}_{zoom}.jpg")) or replace_screenshots:
|
||||
if n % 10 == 0 or correction is None:
|
||||
correction = computeCorrectionFactor(XY, n_width, n_height, map_config, zoom, output_directory, port)
|
||||
takeScreenshot(XY, n_width, n_height, map_config, zoom, output_directory, f, n, port, correction)
|
||||
|
||||
# Compute the scaling required to achieve that
|
||||
sx = s_width / m_width
|
||||
sy = s_height / m_height
|
||||
|
||||
# Resize, rotate and save the screenshot
|
||||
screenshot.resize((int(sx * screenshot.width), int(sy * screenshot.height))).rotate(math.degrees(geo_data['northRotation'])).save(os.path.join(output_directory, "screenshots", f"{f}_{n}_{zoom}.jpg"), quality=95)
|
||||
|
||||
printProgressBar(n + 1, len(screenshots_XY))
|
||||
n += 1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user