wrld.js

L.Wrld.map.buildings

Methods

Method Returns Description
findBuildingAtScreenPoint(<L.Point> screenPoint) FindBuildingResult Attempts to find a building at the given screen point. A ray is constructed from the camera location and passing through the screen point. The first intersection of the ray with any of the currently streamed map features is found, if any.
findBuildingAtLatLng(<L.LatLng> latLng) FindBuildingResult Attempts to find a building at the given LatLng location.

FindBuildingResult

property type description
found Boolean Whether the first intersection of query ray with a map features is a building. If false, indicates either no map feature was intersected, or the map feature was not a building (for example, a tree).
point L.LatLng The point on the building at intersection with the ray.

Events

Building interaction events may be subscribed to by using events methods on this object.

For example:

function onBuildingInformationReceived(event) {
    console.log("Received building information for BuildingHighlight id: " + event.buildingHighlight.getId());
}

map.buildings.on("buildinginformationreceived", onBuildingInformationReceived);

The following events are supported.

Event Data Description
buildinginformationreceived BuildingInformationReceivedEvent Fired when information for a building selection query has been received after adding a BuildingHighlight object to the map.

Event objects

BuildingInformationReceivedEvent

property type description
buildingHighlight BuildingHighlight The BuildingHighlight object that instigated the BuildingInformation request. Call the buildingHighlight.getBuildingInformation() method to obtain the information.
v0.1.1396