Adding country borders & PNG/PGW upload error: "Missing or invalid spatial reference system"

I’m trying to add country borders to our app which is using Google Photorealistic 3D Tiles.

From my research, it seems that the best way would be to use a vector format for that, but it seems that’s not available for Cesium Unity yet.

I assume my next best option is as described here:

After a long journey (pretty much all map related stuff is new to me) I managed to find a way to get country borders as a GeoJSON, EWKT, EWKB or OSM-Poly file via https://osm-boundaries.com. So I select my country, output it as GeoJSON, open that in QGIS and export a PNG file (because I need transparency) and a PGW world file.

I then upload those to Cesium ION:

Unfortunately I get the following error:

Now, like I mentioned, I’m new to all of this. I assume “spatial reference system” refers to the “Target CRS” I can set in QGIS Georeferencer?

qgis-bin_2024-02-09 20.25.18.776

But where does Cesium ION expect to find this information? The DE2.pgw world file only contains these 6 lines, which seems expected according to Wikipedia:

So, that’s where I’m stuck now. If I export it to (Geo?)TIFF it works, but I need transparency, and the TIFF file is unnecessarily large anyway, and I’m stuck with low upload speeds. But he PNG/PGW file combination doesn’t seem enough. I didn’t find a way to additionally export the Target CRS information, and since I don’t know how Cesium ION expects it in the first place, I can’t construct a file manually either.


Apart from that: Does this seem like the best way to add country borders in Cesium Unity? Is there any better or easier way? Is there a better way to tackle any parts of this process? I discovered all tools and information used for this over the last hours (well, apart from Unity and Cesium :wink:) so I have no idea if I’m doing things right and I’m thankful for any information!

You should use GeoTIFF. PNG is not a very useful format for georeferenced data. If you need transparency, check that “Use 0 for transparency when needed” box in the UI. If the file is big, choose a Compression method in the UI.

1 Like

Thanks - both work well! Especially the compression reduces it from 300 MB to 6 MB.

It’s still a shame that it seems to be supposed to work (it is in your supported file format list after all), but I can’t figure it out.

Keeping image and georeference data separate would make it easier for to update just the image contents instead of having to go through the whole QGIS process again. And even with compression the TIF is still 3x the size of the PNG.