GPano:ProjectionType attributes or content

159 views
Skip to first unread message

Mike Cowlishaw

unread,
Feb 12, 2022, 11:16:03 AM2/12/22
to PTGui Support
I've been puzzling over a test image that Erik Krause sent me a few months ago because my code reported no known GPano values in its XMP metadata.  On extraction and inspection of the XMP data it turns out there are values there .. but PTGUI has placed them as attributes of the rdf:Description tag, for example ('...' showing omitted data):

  <rdf:Description rdf:about=""
   xmlns:GPano="http://ns.google.com/photos/1.0/panorama/"
     ...
   GPano:ProjectionType="equirectangular"
   GPano:UsePanoramaViewer="True"
   GPano:CroppedAreaImageWidthPixels="14000"
     ...
   xmp:CreatorTool="PTGui Pro 12 beta 3 (www.ptgui.com)"
     ... >
    ...
    </rdf:Description>

whereas my code was expecting the GPano values to be expressed as content, as described in https://developers.google.com/streetview/spherical-metadata.  For example, (again abbreviated):

  <rdf:Description rdf:about=""
    xmlns:GPano="http://ns.google.com/photos/1.0/panorama/">
    <GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>
    <GPano:ProjectionType>equirectangular</GPano:ProjectionType>
    ...
   </rdf:Description>


It wasn't hard (three lines of code) to accept either, but this raises a couple of questions:
  1. Is the use of GPano: values in attributes documented anywhere?  I spent a while googling this yesterday without success.

  2. What to do if the same item is both in attributes and content but with different values?  My preference would be to prefer content over attributes.
Any thoughts?

Many thanks.

Mike

PTGui Support

unread,
Feb 12, 2022, 11:36:38 AM2/12/22
to pt...@googlegroups.com
Hi Mike,

I think both are valid. I'm not familiar with the specs but you should
be able to find the details here:

https://wwwimages2.adobe.com/content/dam/acom/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2016-08/XMPSpecificationPart1.pdf

(google for XMP or RDF).

That image is from an old version of PTGui; since a few versions PTGui
is using Adobe's XMP toolkit for writing out the XMP data, so the format
may have changed. The XMP toolkit is probably the best way to parse XMP
data in all possible formats.

Kind regards,

Joost Nieuwenhuijse
www.ptgui.com

On 12/02/2022 17:16, Mike Cowlishaw wrote:
> I've been puzzling over a test image that Erik Krause sent me a few
> months ago because my code reported no known GPano values in its XMP
> metadata.  On extraction and inspection of the XMP data it turns out
> there are values there .. but PTGUI has placed them as attributes of the
> rdf:Description tag, for example ('...' showing omitted data):
>
> <rdf:Description rdf:about=""
>    xmlns:GPano="http://ns.google.com/photos/1.0/panorama/"
>      ...
>    GPano:ProjectionType="equirectangular"
>    GPano:UsePanoramaViewer="True"
>    GPano:CroppedAreaImageWidthPixels="14000"
>      ...
>    xmp:CreatorTool="PTGui Pro 12 beta 3 (www.ptgui.com)"
>      ... >
>     ...
> </rdf:Description>
>
> whereas my code was expecting the GPano values to be expressed as
> content, as described in
> https://developers.google.com/streetview/spherical-metadata
> <https://developers.google.com/streetview/spherical-metadata>.  For
> example, (again abbreviated):
>
>   <rdf:Description rdf:about=""
>     xmlns:GPano="http://ns.google.com/photos/1.0/panorama/">
>     <GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>
>     <GPano:ProjectionType>equirectangular</GPano:ProjectionType>
>     ...
>    </rdf:Description>
>
> It wasn't hard (three lines of code) to accept either, but this raises a
> couple of questions:
>
> 1. Is the use of GPano: values in attributes documented anywhere?  I
> spent a while googling this yesterday without success.
>
> 2. What to do if the same item is both in attributes and content but
> with different values?  My preference would be to prefer content
> over attributes.
>
> Any thoughts?
>
> Many thanks.
>
> Mike
>
> --
> You received this message because you are subscribed to the Google
> Groups "PTGui Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ptgui+un...@googlegroups.com
> <mailto:ptgui+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ptgui/69f2bc99-d27c-469d-8323-e73f6261334cn%40googlegroups.com
> <https://groups.google.com/d/msgid/ptgui/69f2bc99-d27c-469d-8323-e73f6261334cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mike Cowlishaw

unread,
Feb 18, 2022, 9:41:43 AM2/18/22
to PTGui Support
Hi  Joost, thanks for the reply (oddly it didn't arrive as gmail, just happened to see it here today).

There's no mention of GPano data in the Adobe XMP document you cite, so I think that at present   https://developers.google.com/streetview/spherical-metadata is the only useful/credible document.

It is definitely not generally true in XML that a name can be used either as an attribute or as the name of a content tag: for example, the 'toy' case:

  <employee id=7543 font=arial>
    <name> Fred bloggs <name>
    <id>0573065</id>
    <department> Sales </department>
   </employee>

Here the attribute id is probably record number in database and the content id is probably the employee's serial number, etc.  In general in SGML and XML, attributes should not affect the data content of a tag, though designers often get that wrong -- GPX being a classic example.

I'm also sure (unless it has changed in past couple of months) that Google Street View, Facebook, etc., expect the GPano: data to be in content (not attributes), as described in the document above.

You mentioned: "That image is from an old version of PTGui; since a few versions PTGui
is using Adobe's XMP toolkit for writing out the XMP data, so the format
may have changed. The XMP toolkit is probably the best way to parse XMP
data in all possible formats."

Good news:  I just checked a spherical I made using PTGui a few months ago, and indeed the GPano data are content not attributes.  So I don't think you need to do anything :-).  I will drop the support for GPano in attributes maybe in next PanGazer release.

I doubt that I'd use the XMP toolkit  because my own XML parser is extremely fast and the XMP processing that I need is almost trivial given the XML parse tree (about 120 lines of code, + defined constants).

Mike

PTGui Support

unread,
Feb 18, 2022, 10:47:18 AM2/18/22
to pt...@googlegroups.com
Hi Mike,

Check out section 7.9.9.2 in the XMP spec:

https://wwwimages2.adobe.com/content/dam/acom/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2016-08/XMPSpecificationPart1.pdf

This says that under certain conditions elements may be replaced by
attributes. Also see 7.3, the XMP can be wrapped in different ways!

Kind regards,

Joost Nieuwenhuijse
www.ptgui.com

> *Good news: * I just checked a spherical I made using PTGui a few months
> ago, and indeed the GPano data are content not attributes.  So I don't
> think you need to do anything :-).  I will drop the support for GPano in
> attributes maybe in next PanGazer release.
>
> I doubt that I'd use the XMP toolkit  because my own XML parser is
> extremely fast and the XMP processing that I need is almost trivial
> given the XML parse tree (about 120 lines of code, + defined constants).
>
> Mike
>
>
>
>
>
>
>
>
>
>
>
> On Saturday, 12 February 2022 at 16:36:38 UTC PTGui Support wrote:
>
> Hi Mike,
>
> I think both are valid. I'm not familiar with the specs but you should
> be able to find the details here:
>
> https://wwwimages2.adobe.com/content/dam/acom/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2016-08/XMPSpecificationPart1.pdf
> <https://wwwimages2.adobe.com/content/dam/acom/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2016-08/XMPSpecificationPart1.pdf>
>
>
> (google for XMP or RDF).
>
> That image is from an old version of PTGui; since a few versions PTGui
> is using Adobe's XMP toolkit for writing out the XMP data, so the
> format
> may have changed. The XMP toolkit is probably the best way to parse XMP
> data in all possible formats.
>
> Kind regards,
>
> Joost Nieuwenhuijse
> www.ptgui.com <http://www.ptgui.com>
>
> On 12/02/2022 17:16, Mike Cowlishaw wrote:
> > I've been puzzling over a test image that Erik Krause sent me a few
> > months ago because my code reported no known GPano values in its XMP
> > metadata.  On extraction and inspection of the XMP data it turns out
> > there are values there .. but PTGUI has placed them as attributes
> of the
> > rdf:Description tag, for example ('...' showing omitted data):
> >
> > <rdf:Description rdf:about=""
> >    xmlns:GPano="http://ns.google.com/photos/1.0/panorama/
> <http://ns.google.com/photos/1.0/panorama/>"
> >      ...
> >    GPano:ProjectionType="equirectangular"
> >    GPano:UsePanoramaViewer="True"
> >    GPano:CroppedAreaImageWidthPixels="14000"
> >      ...
> >    xmp:CreatorTool="PTGui Pro 12 beta 3 (www.ptgui.com
> <http://www.ptgui.com>)"
> <https://groups.google.com/d/msgid/ptgui/69f2bc99-d27c-469d-8323-e73f6261334cn%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ptgui/69f2bc99-d27c-469d-8323-e73f6261334cn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "PTGui Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ptgui+un...@googlegroups.com
> <mailto:ptgui+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ptgui/54634bc4-42f6-4c0c-a047-d7c65bde232dn%40googlegroups.com
> <https://groups.google.com/d/msgid/ptgui/54634bc4-42f6-4c0c-a047-d7c65bde232dn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mike Cowlishaw

unread,
Feb 18, 2022, 3:06:42 PM2/18/22
to PTGui Support
That doesn't make it good practice :-); it's quite against the whole philosophy of SGML and XML.   It looks as though Adobe 'lost the plot' a bit on this one -- whereas they are usually pretty good (I've worked with John Warnock and others in Adobe since the early 1980s; the PostScript Red Book is one of only three books I know in which no user has found an error).

But anyway, it's not very relevant since you now produce the clearer, cleaner, and more readable content tag version that we know Google StreetView, Flickr, Facebook, etc. accept :-).  

Mike



Reply all
Reply to author
Forward
0 new messages