Cameras Nearby
![Screenshot of Cameras Nearby sample application](img/cameras-nearby-sample.jpg)
Vizzion's Cameras Nearby sample application illustrates a number of considerations when developing an application that displays cameras near to a specific location, including finding nearby cameras, choosing which cameras to show, and displaying camera images.
In addition to pseudocode illustrating the recommended techniques, the full sample application source code is available for download.
Finding Nearby Cameras
Vizzion’s Camera API allows cameras within a specified radius of a given latitude/longitude location to be found.
In this sample application, the MapQuest geocoding API is used to retrieve latitude/longitude coordinates for a given address, and then the GetCamerasInRadius method is used to return all cameras within 5km of the location, including any available hotspot cameras (see Hotspot Cameras).
![Image of cameras nearby a given address](img/cameras-nearby-example.jpg)
Choosing Cameras to Show
In many situations there will be too many nearby cameras to display, and the application will need to selectively discard some of the cameras.
In this sample application, out-of-service cameras are discarded first (see Out-of-Service Cameras). Next, the first camera is selected, and any cameras within 1 km of the first camera are discarded. This process is repeated until all remaining cameras are at least 1 km from all their neighbors. The following pseudocode illustrates this process:
Pseudocode |
---|
CamerasDataSet = GetCamerasInRadius(-83.0512, 42.3377, 5, "", 0, <password>) For Each (Camera1 in CamerasDataSet) For Each (Camera2 in remainder of CamerasDataSet) If (Distance from Camera1 to Camera2 < 1 km) Remove Camera2 |
Displaying Camera Images
In this sample application, a 3:2 aspect ratio is used to display images (see Display Aspect Ratio), and image sizes are requested to exactly match the display size (see Requested Aspect Ratio). In addition to the camera name, the camera copyright notice, capture time (see Capture Time Display), and viewpoint (see Viewpoint Display) are all displayed alongside the current image.
![Screenshot of Cameras Nearby sample application](img/cameras-nearby-displaying-images.jpg)
Downloads
Download | Details |
---|---|
Source code | Requires Visual Studio 2012 or later |