X4 Produktdokumentation

Operation: CreateGoogleURL

This operation generates a URL for Google APIs, especially for the Maps Static API. The privateKey parameter can be used to add URL signing to the adapter output.

Input

For the CreateGoogleURL operation, the adapter expects an XML input structure according to the following pattern:

XML
<?xml version="1.0" encoding="UTF-8"?>
<RootElement>
    <Path>/maps/api/staticmap</Path>
    <Param name="center">59.900503,-135.478011</Param>
    <Param name="zoom">4</Param>
    <Param name="size">400x400</Param>
    <Param name="path">fillcolor:0x0000AA33|color:0xFFFFFF00|enc:_qo]~po]koBqtmV|@{lcNlmBq_mUvnuO?fsik@??~b`|@}g`h@?az~R?</Param>
</RootElement> 

The root element contains the following elements:

Element

Description

<Path>

URL part of the Google Static Maps API (see http://code.google.com/intl/de-DE/apis/maps/documentation/staticmaps/)

<Param>

Defines the map section to be created via parameters. Each parameter is specified as a separate <Param> element.

XML
<Param name="parameterName">parameterValue</Param>

Typical parameters:

  • center: Defines the center of the map.

<Param name="center">59.900503,-135.478011</Param>

Possible values:

  • Latitude, longitude

  • Entry of an address (e.g. "Berlin, DE")


  • zoom: Defines the zoom level.

<Param name="zoom">4</Param>

Possible values:

  • Range of values: usually 0–21


  • size: Defines the image size.

<Param name="size">400x400</Param>

Possible values:

  • Width x height in pixels


  • path: Defines lines or areas on the map.

<Param name="path">fillcolor:0x0000AA33|color:0xFFFFFF00|enc:...</Param>

Possible components:

  • color: Line color

  • fillcolor : Fill color

  • enc: encoded polyline

Note:

Multiple properties are separated by |.


  • markers: Defines a pin marker.

XML
<Param name="markers">color:red|label:A|59.900503,-135.478011</Param>

Possible components:

  • color: Color of the marker

  • label : Label of the marker

Note:

  • Multiple properties are separated by |.

  • The position (latitude and longitude) is always at the end.

Output

If the operation is successful, the adapter returns an XML document with a URL to the Google Maps map section defined by the input. The outputFormat does not affect the composition of the URL.

<HREF>https://maps.google.de?path=&size=&sensor=false&markers=48.952663786788165%2C+8.390965795490331&signature=9BCZz3mKiXcWJ1e6jl4puG1XUhI=</HREF>

Examples

Here are some examples of the CreateGoogleURL operation

.

Example 1: Single marker with coordinates

Input

XML
<RootElement>
    <Path>/maps/api/staticmap</Path>
    <Param name="center">52.5200,13.4050</Param>
    <Param name="zoom">10</Param>
    <Param name="size">400x400</Param>
    <Param name="markers">color:red|52.5200,13.4050</Param>
</RootElement>

Output

XML
<HREF>https://maps.googleapis.com/maps/api/staticmap?center=52.5200%2C13.4050&amp;zoom=10&amp;size=400x400&amp;markers=color%3Ared%7C52.5200%2C13.4050&amp;key={API_KEY}</HREF>
Example 2: Multiple markers with different properties

Input

XML
<RootElement>
    <Path>/maps/api/staticmap</Path>
    <Param name="size">600x400</Param>
    <Param name="markers">color:blue|label:B|52.5200,13.4050</Param>
    <Param name="markers">color:green|label:M|48.1351,11.5820</Param>
</RootElement>

Output

XML
<HREF>https://maps.googleapis.com/maps/api/staticmap?size=600x400&amp;markers=color%3Ablue%7Clabel%3AB%7C52.5200%2C13.4050&amp;markers=color%3Agreen%7Clabel%3AM%7C48.1351%2C11.5820&amp;key={API_KEY}</HREF>
Example 3: Multiple markers with common properties

Input

XML
<RootElement>
    <Path>/maps/api/staticmap</Path>
    <Param name="center">Germany</Param>
    <Param name="zoom">5</Param>
    <Param name="size">600x400</Param>
    <Param name="markers">color:red|label:A|52.5200,13.4050|48.1351,11.5820</Param>
</RootElement>

Output

XML
<HREF>https://maps.googleapis.com/maps/api/staticmap?center=Germany&amp;zoom=5&amp;size=600x400&amp;markers=color%3Ared%7Clabel%3AA%7C52.5200%2C13.4050%7C48.1351%2C11.5820&amp;key={API_KEY}</HREF>