This AddIn for ArcMap allows the user to search several Catalog Services for the Web (CSW) from within ArcMap. Four catalogs can be searched:
- USGIN Catalog
- OneGeology Portal
- Data.gov Catalog
- NGDS Catalog
Metadata for found resources can be easily viewed from within the AddIn and resources published as Web Map Services (WMS) can be added directly to the working map.
- Find the file CSWClient.esriAddIn in the CSWClient/bin/Debug folder. (If using GitHub open the file and click the Raw button to download only this file.)
- Save CSWClient.esriAddIn to your computer in a location of your choosing.
- Double-click CSWClient.esriAddIn
- Click Install Add-In
- In ArcMap, click Customize
- Select Customize Mode…
- Select the Commands tab
- Under Add-In Controls select the CSW Client
- Drag the CSW Client button to a toolbar
- Click Close
- Click the CSW Client button on the toolbar
- In the drop-down menu select the catalog that you would like to search:
- USGIN Catalog (http://catalog.usgin.org/geoportal/csw/discovery?)
- OneGeology Portal (http://onegeology-catalog.brgm.fr/geonetwork/srv/csw?)
- Data.gov Catalog (http://catalog.data.gov/csw?)
- NGDS Catalog (http://geothermaldata.org/csw?)
- Enter a search term in the text box and select from the drop-down menu if you'd like to search for the term in AnyText, the Title or the Abstract of the CSW records.
- Select additional options:
- WMS: Search only for datasets that are web map services
- Live Data: Search only for datasets that are live (USGIN Catalog only)
- Use Current Extent: Search only for datasets whose bounding box overlaps the current extent of the map
- Click the Search button
- Results will appear in the box below. Only 15 results are displayed at a time. Use the arrows at the top of the box to see more results.
- Click on a search result and its Abstract will appear below.
- Click on the Metadata button and new window will pop-up with the metadata for the record.
- Click on the Add button (if available) to add the dataset to the map.
Prerequisties: ArcObjects SDK (from the ArcGIS installation disc) and Visual Studio
- Clone this repository
- Open the project by double-clicking CSWClient.sln
- Configure a Debug session to open ArcMap automatically
- In the Solution Explorer panel right click ncgmpToolbar
- Under Debug, select Start Action, Start external program
- Browse to the ArcMap executable
- Run Build, Clean Solution (This will clear the /bin/Debug folder)
- Click Debug, Start Debugging (This will build the CSWClient.esriAddIn in the /bin/Debug folder)
The dockable window components (e.g. combobox, listbox ...) are defined in this class
- Click 'Search' button:
- begin search
- trigger
btnSearch_Click
function
- trigger
- begin search
- Click 'Add' button:
- add the layer onto ArcMap
- trigger
btnAdd_Click
function
- Click 'Metadata' button:
- display metadata info for the selected record
- trigger
btnMetaDoc_Click
function
Send search request and get response
Uri cswUri = new Uri(strCatalogUrl);
HttpWebRequest cswRequest = (HttpWebRequest)WebRequest.Create(cswUri);
...
HttpWebResponse cswResponse = (HttpWebResponse)cswRequest.GetResponse();
Define what kinds of info should be provided for request
Generate a string for POST request
CreatePostData pPostData = new CreatePostData();
pPostData.CreatXmlDoc(pPostDaCri);
strPostDa = pPostData.PostData;
Parse the response and return a list of service names
ParseCswResponse cPCswRp = new ParseCswResponse();
cPCswRp.ResponseTxt = strResponseTxt;
cPCswRp.ParseResponse(indexSelectedCatalog);
Validate services using fgdc validator http://registry.fgdc.gov/statuschecker/post.php
private Boolean TestUrl(string url)
{
GetCapabilitiesTest cTest = new GetCapabilitiesTest();
return cTest.IsWms(url);
}
Add the wms/ArcGIS Rest layer into the map
private ServiceOpener cSvcOpener = new ServiceOpener();
...
cSvcOpener.OpenWMS(strServiceLink);
cSvcOpener.OpenAGS(strServiceLink);
Display the metadata info for the selected item
FormViewMetadata pFrmViewMetadata = new FormViewMetadata();
pFrmViewMetadata.Text = lboxResults.SelectedItem.ToString();
...
switch (cboCatalog.SelectedIndex)
{
case 0:
pFrmViewMetadata.OpenMetadataDoc(...);
pFrmViewMetadata.Show();
...
...
}