Street intersection geocoding – Pitney Bowes MapXtreme User Manual
Page 335

Chapter 18: Geocoding
Geocoding a Location
MapXtreme v7.1
342
Developer Guide
directionalSuffix);
//Create a StreetAddress object
MapInfo.Geocoding.StreetAddress streetAddress =
new MapInfo.Geocoding.StreetAddress(street);
//Create an Address object
MapInfo.Geocoding.Address address =
new MapInfo.Geocoding.Address(streetAddress, countryCode);
address.PrimaryPostalCode = zipCode;
address.PlaceList =
new MapInfo.Geocoding.Place[]
{new MapInfo.Geocoding.Place(
cityName,
MapInfo.Geocoding.NamedPlaceClassification.Municipality),
new MapInfo.Geocoding.Place(
stateName,
MapInfo.Geocoding.NamedPlaceClassification.CountrySubdivision)};
Create the Geocode Request
Once the address object is created, add the address to a list and use the list to create the geocode
request. Using the GeocodeClientFactory, define whether the request is being sent to the geocode
server or service. Use the GetMmjHttpClient method for a request sent to the geocode server or
GetEnvinsaLocationUtilityService method for a request sent to the geocode service.
//Add the address to a list of addresses
MapInfo.Geocoding.Address[] addressList = {address};
//Create the geocode request
MapInfo.Geocoding.GeocodeRequest geoRequest =
new MapInfo.Geocoding.GeocodeRequest(addressList);
//Create the geocoding client
MapInfo.Geocoding.IGeocodeClient geoClient =
MapInfo.Geocoding.GeocodeClientFactory.GetMmjHttpClient(MMJUrl);
//Send the request and get the response
MapInfo.Geocoding.GeocodeResponse geoResponse =
geoClient.Geocode(geoRequest);
Street Intersection Geocoding
Street intersections can be made up of different address types or address elements, and the request
may have different levels of accuracy or preferences. For example, a mobile subscriber could use
street intersection geocoding to enter the nearest street intersection to view a map of their location
on the mobile device. For street intersection geocoding, use the StreetIntersection class and specify
a Street and an IntersectingStreet property.