T O P I C R E V I E W |
Patrick Quinn |
Posted - Sep 04 2017 : 18:38:24 Hi
I'm having some trouble setting TIOParams.EXIF_GPSLatitude and TIOParams.EXIF_GPSLongtitude values.
Are these read only? Do I have to calculate the degrees, minutes and seconds from Lat/Long decimal values and set these EXIF values separately?
Thanks
Patrick
|
9 L A T E S T R E P L I E S (Newest First) |
xequte |
Posted - Sep 08 2017 : 22:36:27 Hi Patrick
Yes, in 7.0.2 if you set EXIF_GPSLatitude or EXIF_GPSLongitude it sets EXIF_GPSVersionID. Plus I've added a note to all the EXIF_GPS* properties.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
Patrick Quinn |
Posted - Sep 08 2017 : 17:31:12 That fixed the problems.
It's a bit obscure though. Couldn't this be added automatically in the Params unit if a EXIF_GPSLatitude or GPSLongitude tag is added?? |
xequte |
Posted - Sep 07 2017 : 22:59:07 Hi Patrick
Sorry, this is poorly documented, but you must have a valid GPS Version ID in order to save the GPS fields, e.g.
ImageEnView1.IO.Params.EXIF_GPSLatitude := StrToFloat(EditEXIF_GPSLatitude);
ImageEnView1.IO.Params.EXIF_GPSLongitude := StrToFloat(EditEXIF_GPSLongitude);
ImageEnView1.IO.Params.EXIF_GPSVersionID := '2.2.0.0';
I will improve the documentation.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
Patrick Quinn |
Posted - Sep 07 2017 : 16:08:53 What problems do you encounter when setting TIOParams.EXIF_GPSLatitude and TIOParams.EXIF_GPSLongtitude?
The problem I encounter is that TIOParams.EXIF_GPSLatitude and TIOParams.EXIF_GPSLongtitude properties are not saved when their Proc is saved to stream.
I have since tested some more and found that edited ImageEnView.IO.Params.EXIF_GPSLatitude and ImageEnView.IO.Params.EXIF_GPSLongitude properties are not saved when an image is saved to file.
I wrote a simple program to show this. On the form are just 3 TEdit controls, 3 TButtons, a TImageEnView, a TOpenImageEnDialog and a TSaveImageEnDialog.procedure TfrmMain.btnLoadImageClick(Sender: TObject);
begin
if OpenImageEnDialog1.Execute then
with ImageEnView1 do
begin
IO.LoadFromFile(OpenImageEnDialog1.FileName);
EditEXIF_GPSLatitude.Text := FloatToStr(IO.Params.EXIF_GPSLatitude);
EditEXIF_GPSLongitude.Text := FloatToStr(IO.Params.EXIF_GPSLongitude);
EditEXIF_UserComment.Text := IO.Params.EXIF_UserComment;
end;
end;
procedure TfrmMain.btnWriteClick(Sender: TObject);
begin
with ImageEnView1 do
begin
if not IsEmpty2 then
with IO.Params do
begin
EXIF_GPSLatitude := StrToFloat(EditEXIF_GPSLatitude.Text);
EXIF_GPSLongitude := StrToFloat(EditEXIF_GPSLongitude.Text);
EXIF_UserComment := EditEXIF_UserComment.Text;
end;
end;
end;
procedure TfrmMain.btnSaveToFileClick(Sender: TObject);
begin
with SaveImageEnDialog1 do
if Execute then
ImageEnView1.IO.SaveToFile(FileName);
end;
// numeric, full stop and minus only
procedure TfrmMain.EditKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in [#8, '0'..'9', '-', '.']) then
Key := #0
else if ((Key = '.') or (Key = '-')) and (Pos(Key, (Sender as TEdit).Text) > 0) then
Key := #0 else if (Key = '-') and ((Sender as TEdit).SelStart <> 0) then
Key := #0;
end; If an image is loaded then EXIF_GPSLatitude, EXIF_GPSLongitude and EXIF_UserComment are shown in the corresponding TEdit box and can be edited.
If the 'Write EXIF' button is pressed these values are written to the ImageEnView.IO.Params.
If the saved image is now saved then loaded again, the edited EXIF_UserComment is there but both the EXIF_GPSLatitude and EXIF_GPSLongitude are missing. |
xequte |
Posted - Sep 06 2017 : 19:13:32 Hi Patrick
I'm sorry if I came off as condescending, and I confess that your knowledge of GPS properties appears superior to mine. When I have used GPS in my own applications, I've only ever used the individual properties, so made the mistake of assuming everyone's usage was similar to mine.
Please let me retreat a step.
What problems do you encounter when setting TIOParams.EXIF_GPSLatitude and TIOParams.EXIF_GPSLongtitude?
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
Patrick Quinn |
Posted - Sep 06 2017 : 16:24:53 Well they can be used if you are happy to encode all of the data into a Double value, but I expect 99% of people will prefer working with the individual properties.
What a ridiculous thing to say.
Google Maps use LatLong in their APIs.
public final double latitude Latitude, in degrees.
public final double longitude Longitude, in degrees. I use geonames.org services extensively and ALL their reverse geocoding APIs use Lat/Long decimal values.
See http://www.geonames.org/export/web-services.html
OpenStreetMap APIs use Lat/Long decimal values.
http://wikimapia.org/api/ use Lat/Long decimal values.
Let's look at ImageEn...
TIESlippyMap.Latitude: Declaration property Latitude: double;
TIESlippyMap.Longitude: Declaration property Longitude: double; If, as you say 99% of people will prefer working with the individual properties then why do you use a double instead of separate Degrees, Minutes, Seconds and Reference properties?
I have paid you for support and do not like being fobbed off with such a condescending reply. |
xequte |
Posted - Sep 05 2017 : 23:04:48 Hi
Well they can be used if you are happy to encode all of the data into a Double value, but I expect 99% of people will prefer working with the individual properties.
You might want to look at the following methods in hyieutils.pas:
function IEGPSConvertDMSToDegDec(degrees: Double; minutes: Double; seconds: Double; ref: AnsiString): Double; procedure IEGPSConvertDegDecToDMS(dir: AnsiString; value: Double; var degrees: Double; var minutes: Double; var seconds: Double; var ref: AnsiString);
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
Patrick Quinn |
Posted - Sep 05 2017 : 19:15:32 Dealing directly with TIOParams.EXIF_GPSLatitude and TIOParams.EXIF_GPSLongtitude is difficult.
You are better to set the individual properties
So why are these properties published if they cannot be used? |
xequte |
Posted - Sep 04 2017 : 21:46:18 Hi Patrick
Dealing directly with TIOParams.EXIF_GPSLatitude and TIOParams.EXIF_GPSLongtitude is difficult.
You are better to set the individual properties, e.g.
EXIF_GPSLatitudeDegrees, EXIF_GPSLatitudeMinutes EXIF_GPSLatitudeSeconds EXIF_GPSLatitudeRef
Nigel Xequte Software www.xequte.com nigel@xequte.com
|