
CNominatim v1.01 A set of
MFC classes to handle Nominatim queries
Nominatim is the search tool used by OpenStreetMap. For further information on
Nominatim, please see
http://wiki.openstreetmap.org/wiki/Nominatim. Nominatim is a web service
provided by OpenStreetMap to convert addresses to locations on a map and the
reverse also known as Geocoding which converts a lat / long point or specific
OSM element to an address.
The classes provided are: CNominatimSearchQuery, CNominatimSearchPlace,
CNominatimReverseGeocodingQuery, CNominatimReverseGeocodingQueryResult and
CNominatim. The two main methods provided are:
HRESULT
Search(const CNominatimSearchQuery& query, CArray<CNominatimSearchPlace,
CNominatimSearchPlace& >& result, NominatimServer
server = nominatim_openstreetmap_org)
The search method performs the address lookup query using the parameters
specified in "query" and returns an array of results in "result" using the
specified Nominatim server "server". The method returns a standard
HRESULT code to indicate success or failure.
HRESULT AddressLookup(const CNominatimReverseGeocodingQuery&
query, CNominatimReverseGeocodingQueryResult& result, NominatimServer
server = nominatim_openstreetmap_org)
The AddressLookup method
performs the reverse geocoding query using the parameters specified in
"query" and returns the result in "result" using the specified Nominatim server
"server". The method returns a standard HRESULT code to indicate
success or failure.
Features
- Provides a simple MFC Header only module to easily call the Nominatim
web services.
- Supports all the parameters to both methods as documented at
http://wiki.openstreetmap.org/wiki/Nominatim.
- Internally the classes can use either the WinHttp or Wininet APIs to hide
the detail of calling the web services.
- The classes hides the details of downloading and parsing the XML response
via MSXML6 and all response values are served up as simple C++ class
variables.
- The HTTP user agent string can be customized via CNominatimSearchQuery::m_sUserAgent
and CNominatimReverseGeocodingQuery::m_sUserAgent
- Supports both the
http://nominatim.openstreetmap.org and
http://open.mapquestapi.com/nominatim/v1/ servers.
- All errors are reported as a simple HRESULT value from the two main
methods
- Supports using an existing HINTERNET session if your application already
uses a specific session handle.
The
enclosed
zip file contains the
CNominatim source code and a simple VC 2008 console application which
demonstrates the classes using the sample as mentioned on the
Nominatim wiki page.
Copyright
- You are allowed to include the source code in
any product (commercial, shareware, freeware or otherwise) when your product
is released in binary form.
- You are allowed to modify the source code in
any way you want except you cannot modify the copyright details at the top
of each module.
- If you want to distribute source code with
your application, then you are only allowed to distribute versions released
by the author. This is to maintain a single distribution point for the
source code.
Updates
V1.0 (24 October 2010)
V1.01 (7 August 2011)
- Updated the code to support WinHttp for downloads in addition to Wininet.
By default the class now uses WinHttp unless you define CNOMINATIM_NOWINHTTP
before you include "cnominatim.h"
- Updated copyright details
- Fixed a /analyze compiler warning in the Wininet version of
CreateRequest