Author Topic: Geodata Format ?  (Read 230 times)

Martin Maurer

  • Guest
Geodata Format ?
« on: February 25, 2020, 02:50:09 AM »
Hi Kronnect,

I'd like to write an .svg country importer for the world map products. Would you please provide some documentation on the data format for the geodata files (2D and Globe, they seem to be different)

It's something like this:
Country$Continent$(int)x,(int)y;.........$0$CY$CY$CYP$196|

- Which Coordinate system/units do they use? 2D and Globe are different.... but it's neither normalized nor lat/lon
- What varaiables are at the end of the country string? The last one seems to be the country ID, but the others...

Thanks in advance,
-martin

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5706
    • View Profile
Re: Geodata Format ?
« Reply #1 on: February 25, 2020, 02:59:19 AM »
Hi Martin,

Please check Globe's documentation, page 49, for a description of the geodata file syntax.

All map assets use a similar approach with regards to the countries/provinces/cities data.

Regards

Martin Maurer

  • Guest
Re: Geodata Format ?
« Reply #2 on: February 25, 2020, 05:18:24 AM »
Do I have the wrong documentation?
Page 49 is describing country decorator api in my PDF.

What I want to do is to import the countries borders from an SVG, so I will have to write my spline points into the countries10.txt file, right?

In the WorldMapEditorCountry.cs Script I found what I needed concerning the structure (the last variables are the different international contry codes, are they optional? I don't really need those)

The only Problem left is the format of the coordinates, and those are not the same at all in Globe and 2D.

countries10.txt(WMSK):
Aruba$North America$-972179,349377;-971338,348103;-970558,....

countries10.txt(Globe):
Aruba$North America$62887911,-349984703;62658619,-349681968;62267794,-349400978;62088351,-349440460;62129855,...


What coordinate system do they refer to (the values obviously are very different)? I can produce normalized values from my SVG, how do I convert these to coordinates that match the corresponding points on my texture. (0.5,0.5 should hit the very center of the map).

Regards


Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5706
    • View Profile
Re: Geodata Format ?
« Reply #3 on: February 25, 2020, 05:29:37 AM »
Hello,

Make sure you're using latest Globe version. Here's the PDF:
https://kronnect.me/taptapgo/index.php/topic,1453.0.html
The latitude/longitude of each point is encoded.
Check SetCountryGeoData method in WPMCountries.cs for details - it's the responsible method for loading/decoding the countries, regions and their frontier points.

However, in World Map 2D Edition and World Map Strategy Kit assets, the coordinates are in local space (-0.5 = -180 longitude or -90 latitude and 0.5 = 180 longitude or 90 latitude). The code responsible for loading / decoding points is in WorldMap2DPrivCountry.cs (method ReadCountriesPackedString) and WMSKCountries.cs (method SetCountryGeoData) respectively.

You can use the Conversion static class to translate lat/lon to sphere or 2D coordinates and vice versa.

Regards


Martin Maurer

  • Guest
Re: Geodata Format ?
« Reply #4 on: February 25, 2020, 05:47:58 AM »
Indeed, my Documentation was outdated.
Thank you very much, I should be able to get going with your info.

Best regards,
-martin