Open Connection 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

Creates a connection to an external geocode or Isogram service provided by a MapMarker, Envinsa, or Precisely Global Geocoder server. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Open Connection 
	Service { Geocode [ MapMarker | Envinsa ] | Isogram }
	ServiceName servicename_string
	URL URLstring 
	[ User name_string [ Password pwd_string ] ] 
	[ Interactive [ On | Off ] ]
	into variable var_name 

servicename_string is a string representing a valid geocoding service. For now, we support "Global Geocoder" and "Precisely Global Geocoder".

URLString is a string representing a valid URL. URLString must be a valid URL to a routing service if you are specifying Isogram, or to a geocoding service if you are specifying Geocode.

name_string is a string representing the user name for an Envinsa or MapMarker installation.

pwd_string is a string representing the password corresponding to user_name.

var_name is a integer representing the variable which will hold the returned connection number.

Description

The Open Connection statement creates a connection to a Geocode or Isogram service. Each statement must specify a service and provider to which the connection is being established. Since the Isogram service is only provided by Envinsa, no provider can be specified. If the service is Geocode and no service provider is specified, Envinsa is assumed.

The User and Password keywords are required only for using the Envinsa and Global Geocoder services.

The Into variable keywords are required as var_name is the variable that holds the returned connection number that is then passed to other statements, such as the Set Connection Geocode statement, the Geocode statement, the Set CoordSys statement, and the Create Object Isogram statement.

Interactive determines whether a username/password dialog box is shown if and only if the credentials passed in for authentication are not adequate. With Interactive specified to Off, no dialog box is displayed and the command fails if the authentication fails. With Interactive specified as On, the dialog box appears if the authentication fails.

The default for the command is Interactive Off. That is, if the Interactive keyword is not used at all, it is the same as Interactive Off. However, if Interactive is specified, it is equivalent to Interactive On.

Examples

Note: All examples without the keyword MapMarker assume Envinsa.

The following example opens a geocoding connection without Interactive specified. Interactive is set to Off by default.

Open Connection Into Variable CnctNum Service Geocode URL 
"http://EnvinsaServices/LocationUtility/services/LocationUtility"

This example opens a geocode connection and specifies Interactive as On.

Open Connection Into Variable CnctNum Service Geocode URL 
"http://EnvinsaServices/LocationUtility/services/LocationUtility" 
Interactive On 

This example opens a geocode connection with a server that requires authentication.

dim baseURLVariable as String
baseURLVariable = "http://EnvinsaServices/"
Open Connection Service Geocode URL baseURLVariable + 
"LocationUtility/services/LocationUtility" User "geocodeuser" Password 
"GeoMe" Into Variable CnctNum 

This example opens an Isogram connection with a server that requires authentication.

dim baseURLVariable as String
baseURLVariable = "http://EnvinsaServices/"
Open Connection Service IsoGram URL baseURLVariable + 
"Route/services/Route" User "isogramuser" Password "ISOMe" Into Variable 
CnctNum 

See Also:

Close Connection statement, Set Connection Geocode statement, Set Connection Isogram statement