Skip to main content

I'm looking for a bit of advice on how to correctly use the latitude and longitude information in a jpeg (from the exif information).

 

 

I've exposed the jpeg_exif_gpslatitude and jpeg_exif_gpslongitude information in fme but, when i inspect the output, the lat and long are displayed with brackets like this;

 

 

(52) (15) (7)

 

(1) (9) (6)

 

 

Which i think equates to Degrees, Minutes and Seconds?

 

 

How exactly does this field need to be displayed so i can create a point using the vertex creator then output to shape?

 

 

I've tried the StringSearcher with the following:

 

 

Search in: jpeg_exif_gpslatitude

 

Contains Regular Expression: r0-9]r0-9]

 

 

Which outputs 52 into a new column, but i'm struggling to add the other parts of this field to get a meaninful coordinate entry

 

 

Any advice anyone can provide me with would be very helpful

regards

You can use a StringSearcher and look for the regex

(\d+)

Remember to specify the "Subexpression matches list name", e.g. as "_values". You'll then get the individul values in the list attribute _values{}.part, which you can pass on to the DecimalDegreesCalculator:

0684Q00000ArKImQAN.png

You can then pass _decimal_degrees to the VertexCreator. Remember to do this for both latitude and longitude.


@david_r

Thanks for your quick response

I can extract the Degrees information using the (\\d+) into _degrees, but am struggling to work out how to extract the Minutes information using the same expression

Regular Expressions, like quite a few things in FME, are still a struggle for me to understand


@david_r

Thanks for your quick response

I can extract the Degrees information using the (\\d+) into _degrees, but am struggling to work out how to extract the Minutes information using the same expression

Regular Expressions, like quite a few things in FME, are still a struggle for me to understand

The expression will already extract every instance of numbers between brackets and store them in the list you've named in the Subexpression matches list name in the string searcher. degrees in the 1st list element, minutes in the 2ndlist element and seconds in the 3rd list element

 

 


You probably need two StringSearchers and two DecimalDegreesCalculators, one pair for jpeg_exif_gpslatitude and one pair for jpeg_exif_gpslongitude. You can simply chain them together. Just make sure that you use different result names for the lat and long parts.

For example:


Thanks for your response

I have my StringSearcher set up the same as you have displayed, but the (\\d+) Regular Expression only gives an output of 52, from the initial value of (52) in the exif information.

I'm struggling with the syntax to output the (\\d+) to display the minutes, in this case 15 (where the exif information displays the field as (52) (15) (7)


Thanks for your response

I have my StringSearcher set up the same as you have displayed, but the (\\d+) Regular Expression only gives an output of 52, from the initial value of (52) in the exif information.

I'm struggling with the syntax to output the (\\d+) to display the minutes, in this case 15 (where the exif information displays the field as (52) (15) (7)

Can you please send a couple of features (Sampler) to an ffs writer and post the resulting file here? That would be helpful to understand what's going on.

Thanks for your response

I have my StringSearcher set up the same as you have displayed, but the (\\d+) Regular Expression only gives an output of 52, from the initial value of (52) in the exif information.

I'm struggling with the syntax to output the (\\d+) to display the minutes, in this case 15 (where the exif information displays the field as (52) (15) (7)

The minutes are already extracted, you won't be able to see them in the Table View only in the Feature Information on the right as they are a list. If you want to display them in a field called minutes you will need an attribute creator

 

 


Hi there

I've attached the output in the Inspector, as well as a screenshot of the workspacetransformer.png


Hi there

I've attached the output in the Inspector, as well as a screenshot of the workspacetransformer.png

Have a look at the comment made by @egomm below, I think it applies to your case.

Just a quick thank-you to those that provided advice on how to do this.

It has worked up to a point, but when I run the Vertex Creator transformer, in spite of setting the output as shape point, the result is four points on a map.

Also the data is required in British National Grid format, so I am using the CsmapAttributeReprojector transformer, but the resulting output ends up somewhere in Scotland, when it should be Northamptonshire

I do have another workspace which uses the PhotoCoordinateExtractor transformer and that appears to have worked, with the point in the correct location when viewed in QGIS, so i'm going to go with that for the time being.

Once again, thanks for the advice

Simon Hume


Just a quick thank-you to those that provided advice on how to do this.

It has worked up to a point, but when I run the Vertex Creator transformer, in spite of setting the output as shape point, the result is four points on a map.

Also the data is required in British National Grid format, so I am using the CsmapAttributeReprojector transformer, but the resulting output ends up somewhere in Scotland, when it should be Northamptonshire

I do have another workspace which uses the PhotoCoordinateExtractor transformer and that appears to have worked, with the point in the correct location when viewed in QGIS, so i'm going to go with that for the time being.

Once again, thanks for the advice

Simon Hume

Scotland instead of Northampton sounds like you could have transposed your lat and long?

 

 

I suspect also you need to expose more of the exif data to properly convert the latitude and longitude to decimals. e.g. jpeg_exif_gpslongituderef. If you're west of Greenwich it's likely that this value is W which means the decimal needs to be a negative number

 

 


You probably need two StringSearchers and two DecimalDegreesCalculators, one pair for jpeg_exif_gpslatitude and one pair for jpeg_exif_gpslongitude. You can simply chain them together. Just make sure that you use different result names for the lat and long parts.

For example:

I'm trying to do this same thing however I can't get the vertex creator to work. It keeps failing at the vertex creator and is rejected. Is that what the red circle beside your creator? Was it also rejected?


I'm trying to do this same thing however I can't get the vertex creator to work. It keeps failing at the vertex creator and is rejected. Is that what the red circle beside your creator? Was it also rejected?

Rejected ports were always displayed with the red circle in a previous version of FME, it's not indicating anything exiting the rejected port in this instance.

 

If everything is failing in the VertexCreator then it's likely that the attributes you are attempting to use here are either not populated, or contain non numerical values. Have you inspected the data to check that you are generating the x and y values correctly?


Reply