Set Connection Geocode statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Configures a connection to a remote service with options for geocoding. The connection needs to have been already created using the Open Connection statement. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Set Connection connection_number Geocode 
	[ Batch Size batch_size ]
	[ ResultCode MarkMultiple [ On | Off ] ]
	[ MixedCase [ On | Off ] ] 
	[ Match 
		[ StreetName [ On | Off ] [ , ] ] 
		[ StreetNumber [ On | Off ] [ , ] ]
		[ Municipality [ On | Off ] [ , ] ]
		[ CountrySubdivision [ On | Off ] [ , ] ]
		[ CountrySecondarySubdivision [ On | Off ] [ , ] ]
		[ PostalCode [ On | Off ] [ , ] ]
		[ MunicipalitySubdivision [ On | Off ] [ , ] ]
		| All [ On | Off ] [ , ] ] ]
	[ Fallback 
		[ Geographic [ On | Off ] [ , ] ] 
		[ PostalCode [ On | Off ] [ , ] ] ]
	[ Dictionary 
		[ All | Address | User | Prefer ( Address | User ) ]
	[ Offset [ [ Center offset_num_expr Units distance_unit_name ]
		[ End offset_num_expr Units distance_unit_name ] 
	[ PassThrough name value, name value, ... ]

connection_number is a number that specifies the connection handle created using the Open Connection statement.

batch_size is an integer expression that specifies the maximum number of records that are sent to the service at one time.

offset_num_expr is a numeric expression which specifies the offset from either the corner (end) or the center of the street. These values are just to offset the point returned from the center of the street or the end of the street respectively.

distance_unit_name is a String that represents the units in which offset_num_expr are expressed.

name is a the name part of the parameter pair that is passed through to the geocoding service.

value is the value part of the parameter pair that is passed through to the geocoding service.

Description

The Set Connection statement is used to assign geocode preferences already defined so that each geocode request does not need to reiterate the preferences defined. A Set Connection statement is composed of six different sub-clauses. These clauses are Batch, Match, Fallback, Dictionary, Offset, and PassThrough.

Batch Clause

The Batch clause determines the maximum number of records that are sent to the service at one time. This allows you to optimize the processing of records to balance the amount of time needed by the local computer and the external service. If this number is high, you will have longer local downtime while the service processes the records. If this number is low, the user has a better opportunity to cancel the request. Once a batch is sent to the service it cannot be cancelled. If you cancel the command, any remaining batches are not processed.

Match Clause

If a specific Match is set, the geocoder only considers inputs that fully match the name in the geocode data as a close match. For example, if Match StreetName is On, the geocoder does not regard street name inputs that do not match the name in the geocode data, as close matches.

For the individual preferences under Match the default is On. So if a particular preference is stated, it is the same as setting it to On. For example, Set Connection connectionHandle Geocode Match Municipality is equivalent to Set Connection connectionHandle Geocode Match Municipality On.

Match StreetName indicates whether or not the street name should be relaxed when trying to match.

Match StreetNumber indicates whether or not the address number should be relaxed when trying to match.

Match Municipality indicates whether or not the municipality should be relaxed when trying to match.

Match CountrySubdivision indicates whether or not the country subdivision (usually a state or province) should be relaxed when trying to match.

Match CountrySecondarySubdivision indicates whether or not the country secondary subdivision should be relaxed when trying to match.

Match PostalCode indicates whether or not the postal code should be relaxed when trying to match.

Match MunicipalitySubdivision indicates whether or not the municipality subdivision should be relaxed when trying to match.

Match All sets all the match properties to On or Off . Note this can be used in combination with other match options. For example, Match All On, Match PostalCode Off turns all the match parameters on and just the postal code match is turned off.

FallBack Clause

Fallback Geographic indicates whether or not to geocode to the geographic centroid for the input address if a street level geocode cannot be performed. This value is only appropriate when your address to be geocoded includes a street address. If the record does not contain a street address, this value has no impact.

Fallback Postal indicates whether or not to geocode to the postal centroid if a street level geocode cannot be performed.

Dictionary Clause

Dictionary indicates the combination of MapMarker address dictionary and configured user dictionaries to use during the geocode process. The five possible choices for the Dictionary clause are:

  • Dictionary All means use both the user and address dictionaries.
  • Dictionary Address means use only the address dictionary.
  • Dictionary User means use only the User dictionary.
  • Dictionary Prefer Address means use both dictionaries and prefer the address dictionary.
  • Dictionary Prefer User means use both dictionaries and prefer the User dictionary.

Offset Clause

Offset End indicates the distance that a point location is adjusted from a street corner.

Offset Center indicates the distance that a point location is adjusted from a street center line.

Units is a String that describes the units in which Offset Center and Offset End are measured. See Set Distance Units statement for the list of available unit names.

PassThrough Clause

PassThrough is a set of name/value pairs that are sent to the geocoder. These are pairs are geocode service specific and are documented by the particular geocode service.

Example

The following example sets a connection to a geocoder with some match options turned on.

set connection MapMarkerHandle1 geocode match streetname, streetnumber, 
municipality, municipalitysubdivision, postalcode, countrysubdivision

The following example adds a PassThrough clause to a Set Connection statement. This particular example turns on CASS certified results in the US.

PassThrough "KEY_CASS_RULES" "true"

See Also:

Geocode statement, Open Connection statement