Skip to main navigation Skip to main content Skip to page footer

OpenStreetMap einbinden

Wenn Du OpenStreetMap statt Google Maps verwenden möchtest, dann gehst Du wie folgt vor:

TypoScript

Füge folgendes Setup-TypoScript ein:

# Include OpenStreetMap and remove Google Maps libraries
page {
    includeJSFooterlibs {
        openLayers = https://openlayers.org/api/OpenLayers.js
        openStreetMap = https://openstreetmap.org/openlayers/OpenStreetMap.js
        openStreetMapLocal = typo3conf/ext/address_manager/Resources/Public/JavaScript/Openstreetmap.js
        googleMaps =
        googleMapsHtmlMarker =
        googleMapsClustering =
    }
}

Listendarstellung

  • Füge den OpenStreetMap Copyright-Hinweis ein.

Template-Datei: Resources/Private/Templates/Address/List.html

<f:if condition="{settings.useMapOverview}">
    <f:render partial="Address/GoogleMapsConsent" arguments="{_all}" />
    <div id="map-wrapper">
        <div id="address-list-map"
             class="card"
             data-country-restriction="{settings.list.map.countryRestriction}"
             data-max-zoom="{settings.list.map.maxZoom}"
             data-clustering-active="{settings.list.map.clustering.active}"
             data-clustering-image-path="{f:uri.resource(path: '{settings.list.map.clustering.imagePath}')}"
             data-default-latitude="{settings.list.map.default.latitude}"
             data-default-longitude="{settings.list.map.default.longitude}">
            <div id="address-list-map-canvas"></div>
        </div>
        <div id="osm">© <a href="http://www.openstreetmap.org">OpenStreetMap</a>
            und <a href="http://www.openstreetmap.org/copyright">Mitwirkende</a>,
            <a href="http://creativecommons.org/licenses/by-sa/2.0/deed.de">CC-BY-SA</a>
        </div>
    </div>
</f:if>

Detaildarstellung

  • Füge den OpenStreetMap Copyright-Hinweis ein.
  • Passe ggf. die Höhe des Kartenausschnitts an, ersetze dazu die beiden Stellen an denen "250px" steht z. B. durch "500px"

Template-Datei: Resources/Private/Templates/Address/Show.html

<div class="address-detail-map-wrapper" style="width: 100%;height: 250px">
    <f:render partial="Address/GoogleMapsConsent" arguments="{_all}" />
    <div id="map-wrapper">
        <div id="address-detail-map"
             data-tooltip="{address.name}"
             data-zoom="{address.mapZoom}"
             data-latitude="{address.latitude}"
             data-longitude="{address.longitude}"
             data-map-marker="{f:variable(name: 'settings.list.map.marker.style.{address.mapMarker}')}"
             style="width: 100%; height: 250px;"></div>
    </div>
    <div id="osm">© <a href="http://www.openstreetmap.org">OpenStreetMap</a>
        und <a href="http://www.openstreetmap.org/copyright">Mitwirkende</a>,
        <a href="http://creativecommons.org/licenses/by-sa/2.0/deed.de">CC-BY-SA</a>
    </div>

Anpassungen

Um individuelle Anpassungen an der Darstellung zu machen, schaue Dir das Script Resources/Public/JavaScript/Openstreetmap.js an. Du kannst dieses kopieren, modifizieren und statt der mitgelieferten Version einbinden.