Home » Specifications » OpenSearch » Extensions » Geo » 1.0 » Draft 2


[edit] Notice

This is a draft document for public review.

[edit] Introduction

Geospatial data is becoming increasingly available as the tools for specifying and sharing location are more ubiquitous and easy to use. The purpose of the OpenSearch-Geo extensions is to provide a standard mechanism to query a resource based on geographic extents, or location name.

The geospatial results are based on the GeoRSS standard. Therefore, latitude/longitude order, bounding box parameters are using that standard.

[edit] Namespace

Updated July 27, 2007: the OpenSearch Geo extension namespace was shortened to just "geo" instead of "opensearchgeo". This was to make the namespace more succinct.

[edit] Example

Example of a detailed OpenSearch description document that describes a search engine that accept geospatial search parameters.

 <?xml version="1.0" encoding="UTF-8"?>
 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
   <ShortName>Web Search</ShortName>
   <Description>Use Example.com to search the Web.</Description>
   <Tags>example web</Tags>
   <Url type="application/vnd.google-earth.kml+xml"
   <Url type="application/atom+xml"
   <Url type="application/rss+xml"
   <Url type="text/html"
   <LongName>Example.com Web Search</LongName>
   <Image height="64" width="64" type="image/png">http://example.com/websearch.png</Image>
   <Image height="16" width="16" type="image/vnd.microsoft.icon">http://example.com/websearch.ico</Image>
   <Query role="example" searchTerms="cat" />
   <Developer>Example.com Development Team</Developer>
       Search data Copyright 2005, Example.com, Inc., All Rights Reserved

[edit] Namespace

The XML namespace of the OpenSearch Geo Extension is:


This namespace and a corresponding namespace prefix must be included when the extension is used in an OpenSearch Description document.

[edit] Parameters

[edit] The "name" parameter

Replaced with a string describing the location (place name) to perform the search. This location string will be parsed and geocoded by the search service.

Example URL template:


Example request:


[edit] The "locationString" parameter (deprecated)

Use the "name" parameter instead.

[edit] The "lat" and "lon" parameters

Replaced with the "latitude, longitude", respectively, in decimal degrees in EPSG:4326 (typical WGS84 coordinates as returned by a GPS receiver). This parameter should also include a "radius" parameter that specifies the search radius, in meters. If no radius is supplied, then the search service is free to use a default radius but should specify this radius in the returned result.

Example URL template:


Example request:


[edit] The "radius" parameters

The radius parameter, used with the lat and lon parameters, specifies the search distance from this point. The distance is in meters along the Earth's surface.



[edit] The "box" parameter

Replaced with the bounding box to search for geospatial results within. The box is defined by "west, south, east, north" coordinates of longitude, latitude, in a EPSG:4326 decimal degrees. This is also commonly referred to by minX, minY, maxX, maxY (where longitude is the X-axis, and latitude is the Y-axis), or also SouthWest corner and NorthEast corner.

 geo:box ~ west, south, east, north

Example URL template:


Example request:


[edit] The "geometry" parameter

Replaced with a geometry defined using the Well Known Text (WKT) standard. The following 2D geometric objects can be described:


Note that the WKT coordinate pairs are in lon, lat order; opposit to GeoRSS.

Polygons are a collection of linearrings. The outer ring is expressed in counter-clockwise order. Internal rings have the opposite orientation, appearing as clockwise (see in OGC Simple Features Specification v. 1.2.0).

Spaces must be URL encoded ('%20' or '+') in the request.

Example geometries:

 POINT(6 10)
 LINESTRING(3 4,10 50,20 25)
 POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))
 MULTIPOINT(3.5 5.6, 4.8 10.5)
 MULTILINESTRING((3 4,10 50,20 25),(-5 -8,-10 -8,-15 -4))
 MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2)),((6 3,9 2,9 4,6 3)))

Example URL template:


Example request:



[edit] The "polygon" parameter (deprecated)

Use the "geometry" parameter instead.

[edit] The "relation" parameter

Replace by the spatial relation of the search. By default the geo searches return the records that intersect the query. The possible values are:

  • intersects (default)
  • contains
  • disjoint

[edit] The "uid" parameter

Replace by the identifier of the resource within the search engine context (local reference). This parameter is used to query resources by their fragment identifier, unique within the search scope only. It can be used to query local identifiers that are not URI including the support of GML identifiers

[edit] Optional Parameters

The search server should use the "?" flag in the URL template when requesting the source parameter to indicate that this parameter is optional and that a search can still be performed even if the client does not recognize the extension.

Therefore, if a service provides multiple optional geographic search parameters, these can be combined into a single definition of optional parameters:



[edit] Geo response elements

The OpenSearch-Geo response elements can be used by search engines to augment existing XML formats with search-related metadata. See the OpenSearch response definition for a general overview of the response options.

The following examples illustrate Geo-specific responses. For RSS and Atom responses, it is suggested to use the GeoRSS channel elements in addition to the OpenSearch-Geo elements.

[edit] Atom Response

Example request:


Example response:

   <?xml version="1.0" encoding="UTF-8"?>
    <feed xmlns="http://www.w3.org/2005/Atom" 
      <title>Example.com Search: New York history</title> 
      <link href="http://example.com/New+York+history"/>
        <name>Example.com, Inc.</name>
      <opensearch:Query role="request" searchTerms="New York History" startPage="3" geo:box="-74.0667,40.69418,-73.9116,40.7722"/>
      <link rel="alternate" href="http://example.com/New+York+History?pw=3&bbox=-74.0667,40.69418,-73.9116,40.7722" type="text/html"/>
       <link rel="search" type="application/opensearchdescription+xml" href="<nowiki>http://example.com/opensearchdescription.xml"/>
      <georss:box>40.69418 -74.0667 40.7722 -73.9116</georss:box>
        <title>New York History</title>
        <link href="http://www.columbia.edu/cu/lweb/eguids/amerihist/nyc.html"/>
        <georss:line>40.73763 -73.9972 40.73519 -73.99167 40.737015 -73.99035 40.73643 -73.98914 40.734640 -73.990431 40.731617 -73.991504</georss:line>
        <content type="text">
          ... Union Square.NYC - A virtual tour and information on 
          businesses ...  with historic photos of Columbia's own New York 
          neighborhood ... Internet Resources for the City's History. ...

[edit] KML Response

KML is an acceptable and recommended response option for geospatial searches. KML allows for styling and complex responses, similar to HTML response for non-spatial queries.

Example request:


Example response:

   <?xml version="1.0" encoding="UTF-8"?>
   <kml xmlns="http://earth.google.com/kml/2.2"
      <opensearch:Query role="request" searchTerms="New York History" startPage="3" geo:box="-74.0667,40.69418,-73.9116,40.7722"/>
      <atom:link rel="alternate" href="http://example.com/New+York+History?pw=3&bbox=-74.0667,40.69418,-73.9116,40.7722" type="text/html"/>
      <atom:link rel="alternate" href="http://example.com/New+York+History?pw=3&bbox=-74.0667,40.69418,-73.9116,40.7722&format=atom" type="application/atom+xml"/>       
       <name>New York History</name>
           -73.9972,40.73763,0 -73.99167,40.73519,0 -73.99035,40.737015,0 
           -73.98914,40.73643,0 -73.990431,40.734640,0 -73.991504,40.731617,0

[edit] Author

Andrew Turner <ajturner@highearthorbit.com>

[edit] Contributors

DeWitt Clinton <dewitt@opensearch.org>

Andrew Turner

Jo Walsh

Oscar Fonts

Pedro Goncalves

[edit] License

This document is made available subject to the terms of the Creative Commons Attribution-ShareAlike 2.5 License.