PostGIS
Description
This function returns a MARC21/XML record with
Coded Cartographic
Mathematical Data representing the bounding box of a given geometry.
The format
parameter allows to encode the coordinates in subfields
$d
,$e
,$f
and $g
in all formats supported by the
MARC21/XML standard. Valid formats are:
-
cardinal direction, degrees, minutes and seconds (default):
hdddmmss
-
decimal degrees with cardinal direction:
hddd.dddddd
-
decimal degrees without cardinal direction:
ddd.dddddd
-
decimal minutes with cardinal direction:
hdddmm.mmmm
-
decimal minutes without cardinal direction:
dddmm.mmmm
-
decimal seconds with cardinal direction:
hdddmmss.sss
The decimal sign may be also a comma, e.g. hdddmm,mmmm
.
The precision of decimal formats can be limited by the number of
characters after the decimal sign, e.g. hdddmm.mm
for decimal
minutes with a precision of two decimals.
This function ignores the Z and M dimensions.
LOC MARC21/XML versions supported:
Availability: 3.3.0
|
|
Examples
Converting a POINT
to MARC21/XML formated as hdddmmss (default)
SELECT ST_AsMARC21('SRID=4326;POINT(-4.504289 54.253312)'::geometry);
st_asmarc21
-------------------------------------------------
<record xmlns="http://www.loc.gov/MARC21/slim">
<datafield tag="034" ind1="1" ind2=" ">
<subfield code="a">a</subfield>
<subfield code="d">W0043015</subfield>
<subfield code="e">W0043015</subfield>
<subfield code="f">N0541512</subfield>
<subfield code="g">N0541512</subfield>
</datafield>
</record>
Converting a POLYGON
to MARC21/XML formated in decimal degrees
SELECT ST_AsMARC21('SRID=4326;POLYGON((-4.5792388916015625 54.18172660239091,-4.56756591796875 54.196993557130355,-4.546623229980469 54.18313300502024,-4.5792388916015625 54.18172660239091))'::geometry,'hddd.dddd');
<record xmlns="http://www.loc.gov/MARC21/slim">
<datafield tag="034" ind1="1" ind2=" ">
<subfield code="a">a</subfield>
<subfield code="d">W004.5792</subfield>
<subfield code="e">W004.5466</subfield>
<subfield code="f">N054.1970</subfield>
<subfield code="g">N054.1817</subfield>
</datafield>
</record>
Converting a GEOMETRYCOLLECTION
to MARC21/XML formated in decimal
minutes. The geometries order in the MARC21/XML output correspond to
their order in the collection.
SELECT ST_AsMARC21('SRID=4326;GEOMETRYCOLLECTION(POLYGON((13.1 52.65,13.516666666666667 52.65,13.516666666666667 52.38333333333333,13.1 52.38333333333333,13.1 52.65)),POINT(-4.5 54.25))'::geometry,'hdddmm.mmmm');
st_asmarc21
-------------------------------------------------
<record xmlns="http://www.loc.gov/MARC21/slim">
<datafield tag="034" ind1="1" ind2=" ">
<subfield code="a">a</subfield>
<subfield code="d">E01307.0000</subfield>
<subfield code="e">E01331.0000</subfield>
<subfield code="f">N05240.0000</subfield>
<subfield code="g">N05224.0000</subfield>
</datafield>
<datafield tag="034" ind1="1" ind2=" ">
<subfield code="a">a</subfield>
<subfield code="d">W00430.0000</subfield>
<subfield code="e">W00430.0000</subfield>
<subfield code="f">N05415.0000</subfield>
<subfield code="g">N05415.0000</subfield>
</datafield>
</record>