TransWikia.com

Search for all data in GeoNetwork

Geographic Information Systems Asked by kazik on November 8, 2020

I’d like to get a list of all metadata from GeoNetwork. According to this manual https://geonetwork-opensource.org/manuals/2.10.4/eng/developer/xml_services/metadata_xml_search_retrieve.html#search-metadata-xml-search I’m using this curl command

curl -X POST -u user:pass http://geonetwork_server/geonetwork/srv/eng/xml.search

I want to do it using Python, so I’m using requests to send POST request to the same url as above. I am also sending this string as ‘data’ parameter of Python’s POST request:

<?xml version="1.0" encoding="UTF-8"?><request/>

The response comes with this element, among others:

<response from="1" to="100" selected="0" maxPageSize="100">

I’d like to get list of all metadata. The above request returns only 100 GeoNetwork records. How to get whole list, or another page of this list?

Is this link from above the official documentation for latest GeoNetwork version? I am using GN 3.10.

One Answer

You can get a list of all metadata in a GeoNetwork instance by looking at the sitemap.

The location of the sitemap in GeoNetwork has has changed over time but you can find it by looking at the robots.txt file.

GeoNetwork generates one at:

http://geonetwork_server/geonetwork/robots.txt

GN 3.10.n has a site map at:

http://geonetwork_server/geonetwork/srv/api/sitemap

GN 2.10.n had a sitemap at:

http://geonetwork_server/geonetwork/srv/eng/portal.sitemap

If you want to go the route of CSW then you can use a GetRecords POST request like:

<?xml version="1.0"?>
<csw:GetRecords 
   xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
   xmlns:gmd="http://www.isotc211.org/2005/gmd"
   service="CSW" 
   version="2.0.2"
   resultType="results"
   maxRecords="25"
   startPosition="26">
  <csw:Query typeNames="gmd:MD_Metadata">
    <csw:Constraint version="1.1.0">
      <Filter xmlns="http://www.opengis.net/ogc"/>
    </csw:Constraint>
  </csw:Query>
</csw:GetRecords>

with Content-Type: application/xml header

to http://geonetwork_server/geonetwork/srv/eng/csw

To get records 26 to 51 and repeat...

If this file was called getrecords-25to51.xml then you could use a POST through cURL like:

curl -X POST -H "Content-Type: application/xml" --data-binary "@getrecords-25to51.xml" http://geonetwork_server/geonetwork/srv/eng/csw

or even just

curl -H "Content-Type: application/xml" --data-binary "@getrecords-25to51.xml" http://geonetwork_server/geonetwork/srv/eng/csw

Correct answer by nmtoken on November 8, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP