<object>
By adding
<object data="https://osm.quelltextlich.at/viewer-js.html" width="400" height="200"></object>
to the <body>
of your HTML file, you get the following embedded map
It is recommended to set the <object>
's width
, and height
attributes. Either by specifying them directly within the element (as in the above example), or alternatively—if CSS may be used—via CSS.
<iframe>
When using a document type that allows <iframe>
s, you can also embed the static viewer using <iframe>
s. For example by adding
<iframe src="https://osm.quelltextlich.at/viewer-js.html" width="512" height="256"></iframe>
in the <body>
part of your HTML file.
Notice that—in contrast to the above <object>
example—the URL is now given in the src
attribute.
Refer to the „Embedding using <object>
” part for further explanations and hints.
To embed a map that shows a given place, you can use the lat
, and lon
URL Parameters. For example, by adding
<object data="https://osm.quelltextlich.at/viewer-js.html?lat=51.50939&lon=-0.11832&zoom=6" width="512" height="256"></object>
to the <body>
part of your HTML file, you get the following map
The parameter lat
specifies the latitude, while lon
gives the longitude. The additional parameter zoom
sets the zoom level.
To add a marker to a map, you can use the mlat
, and mlon
parameters. For example
<object data="https://osm.quelltextlich.at/viewer-js.html?mlat=-23.51866&mlon=-46.71661&zoom=6" width="512" height="256"></object>
yields the following map, where a marker in São Paulo has been added.
To add a layer showing a kml file to a map, the URL parameter kml_url
can be used. For example
<object data="https://osm.quelltextlich.at/viewer-js.html?kml_url=https%3A%2F%2Fosm.quelltextlich.at%2Fdemo%2Fdemo.kml" width="550" height="300"></object>
yields the following map
where the kml file at https://osm.quelltextlich.at/demo/demo.kml got added.
Be careful to correctly escape the URL. You can use the „Viewer with KML file” wizard for this task.
Further URL parameters that can be used when embedding the static viewer can be found on the overview page of the URL parameters.