This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


Overview

The following operations allow you to work with hierarchies. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with hierarchies, see Sample configuration

OperationDescription

1Working with Hierarchies in GeoNames

Retrieves the children (admin divisions and populated places) for a given geonameId.

1Working with Hierarchies in GeoNames

Retrieves all GeoNames higher up in the hierarchy of a place name (returns a list of GeoName records, ordered by hierarchy level. The top hierarchy (continent) is the first element in the list).

Operation details

This section provides further details on the operations related to hierarchies.

Retrieving the children 

The getChildren operation retrieves the children (admin divisions and populated places) for a given geonameId.

getChildren
<geonames.getChildren>
    <responseType>{$ctx:responseType}</responseType>
    <geonameId>{$ctx:geonameId}</geonameId>
    <maxRows>{$ctx:maxRows}</maxRows>
	<hierarchy>{$ctx:hierarchy}</hierarchy>
</geonames.getChildren>
Properties
  • responseType: The responseType to get the response of the getChildren method.
  • geonameId: The geonameId of the parent.
  • maxRows: The number of rows returned, default is 200.
  • hierarchy: This parameter allows the of use other hierarchies then the default administrative.
   Sample request

Following is a sample REST/JSON request that can be handled by the getChildren operation.

Sample Request for getChildren
{
	"apiUrl": "http://api.geonames.org",
	"username": "buddhima",
	"responseType": "json",
	"geonameId": "3175395",
	"maxRows": "1",
	"hierarchy": "tourism"
}
Related GeoNames documentation

http://www.geonames.org/export/place-hierarchy.html#children

Retrieving all GeoNames higher up in the hierarchy of a place name

The listHierarchyOfPlaceNames operation retrieves all GeoNames higher up in the hierarchy of a place name (returns a list of GeoName records, ordered by hierarchy level. The top hierarchy (continent) is the first element in the list).

listHierarchyOfPlaceNames
<geonames.listHierarchyOfPlaceNames>
    <responseType>{$ctx:responseType}</responseType>
	<geonameId>{$ctx:geonameId}</geonameId>
</geonames.listHierarchyOfPlaceNames>
Properties
  • responseType: The responseType of the listHierarchyOfPlaceNames method.
  • geonameId: The geonameId of the hierarchy.
   Sample request

Following is a sample REST/JSON request that can be handled by the listHierarchyOfPlaceNames operation.

Sample Request for listHierarchyOfPlaceNames
{
	"apiUrl": "http://api.geonames.org",
	"username": "buddhima",
	"responseType": "json",
	"geonameId": "3175395"
}
Related GeoNames documentation

http://www.geonames.org/export/place-hierarchy.html#hierarchy

Sample configuration

Following is a sample proxy service that illustrates how to connect to GeoNames with the init operation and use the getChildren operation. The sample request for this proxy can be found in the getChildren sample request.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="geonames_getChildren" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
    <target>
        <inSequence onError="faultHandlerSeq">
            <property name="apiUrl" expression="json-eval($.apiUrl)" />
            <property name="username" expression="json-eval($.username)" />
            <property name="responseType" expression="json-eval($.responseType)" />
            <property name="geonameId" expression="json-eval($.geonameId)" />
            <property name="maxRows" expression="json-eval($.maxRows)" />
            <property name="hierarchy" expression="json-eval($.hierarchy)" />
            <geonames.init>
                <apiUrl>{$ctx:apiUrl}</apiUrl>
                <username>{$ctx:username}</username>
            </geonames.init>
            <geonames.getChildren>
                <responseType>{$ctx:responseType}</responseType>
                <geonameId>{$ctx:geonameId}</geonameId>
                <maxRows>{$ctx:maxRows}</maxRows>
                <hierarchy>{$ctx:hierarchy}</hierarchy>
            </geonames.getChildren>
            <respond />
        </inSequence>
        <outSequence>
            <send />
        </outSequence>
    </target>
    <description />
</proxy>   
  • No labels