Set up Geo Mapping Widget
Overview and Set Up
About Geo Mapping Widget
The Geo Mapping Widget is designed to enable Connectbase customers to integrate the Connectbase location and map search functionality for use within their proprietary applications.
Using the Connectbase Geo Mapping Widget, users can search by location or lat/long coordinates to view the location directly on The Connected World map. Once the location is found, the map zooms into the location and pinpoints the location for view. Additionally, a popup location information box displays that further enables you to view Network Intelligence data for that location.
The access code must be generated with the given access_key. The access_key is provided to you by Connectbase.
The following encryption setup is required to set up and run the Geo Mapping Widget:
access_key – generated by Connectbase and provided to the end user.
access_code – Generated by end user.
Public key – Generated by Connectbase and provided to the end user.
As the end user, you will need to construct a string with the access_key and your email, then encrypt the string using a Public key in the Base64 format. Connectbase provides you with the public key.
Obtain the access key from Connectbase.
Upon receipt of the access key from Connectbase, construct an access key string to include the access key and email address and encrypt the string using a Public key in Base64 format.
The constructed string should be formatted as follows:
access_key=<accesskey>&email=<email>
accesskey = The key for the users account provided by Connectbase
email = User’s email
Example
access_key=fcce2ee3-56b8-11ed-99fe-000d3a9b1b2c&email=xxx@companyname.com (
anumanthu.e@capestart.com
)Encrypt the above string using the given public key into your application to generate the access code. The resultant access code is a long string for use with the Address search / Coordinate search URLs
Below is the sample access code with encrypted access key and email
E1ZZDws4tLJdo99qFiWhwF+ZArQFGgWOZjsgv0ZEHhXL+YClXULb6W3bs15vAS0TTqU5h+otu0U7VIYLFsudj
M/8FekcuQaw90ODLhZTrbBsZq0X0RklnRK0EzynHDV7pASe08hlP7IL3+eXATo0jdn4srzTd9iK+d+B4k3SYtY=
The user can have similar function as shown below to form the access code
export const encryptWithPublicKey = ((accessKey, email, pathToPublicKey) => { const strToBeEncrypted = ‘access_key=’ + accessKey + ’&email=’ + email const absolutePath = path.resolve(pathToPublicKey) const publicKey = fs.readFileSync(absolutePath, encodeFormat.utf8) const buffer = Buffer.from(strToBeEncrypted) const encrypted = crypto.publicEncrypt(publicKey, buffer) return encrypted.toString(encodeFormat.base64) })
Public key for encryption
Here pathToPublicKey is the directory path where given public key is located.
Below is the public key used for encryption:
-----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCM82Vqt595/qnUWld0YhMwg6MX 9uxwgiRiVVew9eTWpm+3qMe7ICulgdYAPYOwJJtAIGwtMQqFj67Newe+HQOftPKm 0ZiDe6Mb4XUqZoB53MQNAbesoW+nm4hEXzlanzKqTFfaJ+m6Zeb4T8SMaUnf+QBu FcqHCYoIHq0GL7VpjwIDAQAB -----END PUBLIC KEY-----
Users must run the corresponding URL dependent on their search criteria; you can search by address or search by lat/lon coordinates.
Request parameters
address - Location Address in the standard format, for example, 840 E New Haven Ave, Melbourne, FL 32901, United States
latitude - latitude of the location
longitude - longitude of the location
reverse = 1 to reverse geocode the lat/lon and show the full address in the location information popup dialog box
reverse = 0 to show the lat/lon coordinates in the location information popup dialog box
Address Search URL
This link locates the address pins the address on the map and provides the address information within the popup dialog box:
https://cw.connectbase.com/#/accesskey-auth?access_code=<ACCESS_CODE>&address=<ADDRESS>
Example:
Click on the search icon within the location information popup dialog box to view Network Intelligence for this location.
Coordinates Search URL
When searching for a location by coordinates, you can either enter reverse=1 to reverse geocode the lat/lon to return the address within the location popup dialog box (rather than the coordinates) or you can enter reverse=0 to return the lat/lon in the location popup dialog box.
Reverse Geocode = 1
This link locates the lat/long with a pin on the map. Because the reverse field is set to 1, they system reverse geocodes the lat/lon to provide the address within the location information popup dialog box:
Example:
Reverse Geocode = 0
This link locates the lat/long with a pin on the map and lat/lon coordinates within the location information popup dialog box.
Example: