Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNG and PGW #8

Open
davidsrsb opened this issue Feb 24, 2020 · 7 comments
Open

PNG and PGW #8

davidsrsb opened this issue Feb 24, 2020 · 7 comments

Comments

@davidsrsb
Copy link

It would be very convenient to generate a .pgw world file when a .png plot file is made.
I have to do this manually to import as a raster file into QGIS and the details of the .pgw keep changing as plot radius is changed.

@der-stefan
Copy link
Collaborator

der-stefan commented Feb 24, 2020

Are .pgw files a standard file for georeferencing raster graphics? I can't find any information on this file format.
In my own application I write a custom JSON file. Would that also be fine for you?

Edit: For documentation, here is an elegant way to load PGW files in Leaflet: https://github.com/RedfishGroup/LeafletElementOverlay

@dBitech
Copy link
Collaborator

dBitech commented Feb 24, 2020

.pgw files are also known as "World files" and are a 6 line textual sidecar file describing the extents, and the pixel size of the raster. see https://en.wikipedia.org/wiki/World_file for details

@der-stefan
Copy link
Collaborator

Ok, the only problem is that the map projection is not given in the world file. But it is no problem to add a world file output along the PNG.

@davidsrsb
Copy link
Author

World files exist for most raster formats that don't have built in geo-referencing (ie geotiff)
pgw is the partner of png and is the favourite, as it is the smallest file that doesn't mangle text.
QGIS expect a pgw file, no concept of JSON.

This is a typical pgw file in Malaysia
0.0008333333
0.0000000000
0.0000000000
-0.0008333333
101.0000001211
3.9999999758

It gets more complicated away from the equator as pixel x and y size are no longer equal

@davidsrsb
Copy link
Author

My example is using decimal degrees. This is convenient with SRTM3 terrain data
The Wikipedia example is using UTM

@der-stefan
Copy link
Collaborator

Georeferenced TIF files ("GeoTIFF") can be directly loaded into QGIS. This functionality is now implemented in the "json" branch and probably merged into the refactor/main/2.0 branch. Are .pgw files still important, as we now have .geo, .json, .tif and .kml for georeferencing? Can the issue be closed?

@der-stefan
Copy link
Collaborator

By the way: We can also write meta data to PNGs! That's not too complicated with libpng... Up to now, there is no standard to georeference PNGs with the help of meta data. Would be interesting to define a new standard!

Even a complete JSON string could be put into the PNG, as there is nearly no length limitation of "tEXt" meta contents. That opens up a new playground...

der-stefan added a commit that referenced this issue Aug 13, 2020
- we could save georeferencing information
- or even a complete JSON output of all used parameters!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants