Archive

Archive for October, 2010

CNominatim v1.0

October 24, 2010 Comments off

This is my first post to WordPress following the migration of my blog from Windows Live Spaces. I’ve had problems with Windows Live Spaces before which I blogged about before related to SPAM and the lack of fine grained controls to control it. From my initial review of WordPress, hopefully these issues are a thing of the past as WordPress looks to be a much more mature Blogging platform.

Anyway onto the point of this post which is a new code release from my web site at naughter.com.

Just to let everyone know that v1.0 of CNominatim has been released. This is a new set of MFC classes to handle Nominatim queries. 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 uses the Wininet API to hides 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 eagle eyed among you will probably be able to work out that I plan to integrate these new classes into my COSMCtrl demo application in the not too distant future. This will provide Address lookup functionality which I will be able to integrate into the existing Marker functionality as well as geocoding support.

I have quite a few other updates to my classes in the pipeline but work pressures have meant that I could not dedicate as much time to the web site updates as I would have liked. Hopefully I will get some down time in the run-up to Christmas.

Happy Coding,
PJ

Categories: Web Site Updates