As a small demonstration of Topobase integration with external programs, we'll show a workflow plugin that uses Google Street View. This is the feature of Google Maps that lets you view the streetscape of roads that have been captured by cameras mounted on Google Street View cars.
The plugin allows the user to select a feature and see the street-level panoramic photo from the closest point that was 'driven' by the Google cars, if any. Not all cities are covered and not all roads will have Street View photos, but if the area you are interested in is covered, this ability could be a compelling sales tool or interesting demonstration.
The sequence of steps followed by the plugin is first to get a feature from the user, either from the PickFirst set or by asking the user directly. The coordinates of the feature (or first vertex of the feature) are then transformed to the WGS 84 lat/long system that Google Maps uses. The latitude and longitude are formed into a URL query for Google Maps that requests information about the nearest panoramic point like so:
"http://maps.google.com/cbk?output=xml&ll=" + lat + "," + lon
The XML result is parsed to extract the pertinent information (there is other interesting information we ignore). If no panoramic point is nearby, the fallback operation is to just show a plain Google Map.
Once the panoramic point is found, a much longer URL is created to query Google Maps and get a Street View. The format of this URL is described in detail at the Mapki Wiki, and includes such information as the panoramic point id, the latitude and longitude of both the pano point and the observer location, plus camera pitch and yaw - which unfortunately no longer work since Google Maps now uses a Flash player which doesn't support these parameters.
This URL is then provided to a browser embedded in a dockable AutoCAD palette, and this is then made visible in AutoCAD. Of course you could fetch the URL in an external browser as well. The operation is demonstrated in this movie:
This demo is available as a ZIP file which you can download using the link below. You will need accurately georeferenced data which is covered by Google Street View. To build this project, define the environment variable TopobaseClientDirectory to point to the Topobase Client directory and execute the solution file:
C:>set TopobaseClientDirectory=C:\Program Files\Autodesk Topobase Client 2010
C:>StreetView.sln
Build the solution. Next create a workflow called StreetView in Topobase Administrator containing the script:
Sub Run
Me.RunMethod("StreetView.dll", "StreetView.StreetViewWorkflow", "Navigate")
End Sub
Run Topobase client and either execute StreetView from the Workflow explorer or execute it using TBEXECUTE. Select your feature and you should see the browser pane displayed.
AUTODESK DOES NOT GUARANTEE THAT YOU WILL BE ABLE TO SUCCESSFULLY DOWNLOAD OR IMPLEMENT ANY SAMPLE CODE. SAMPLE CODE IS SUBJECT TO CHANGE WITHOUT NOTICE TO YOU. AUTODESK PROVIDES SAMPLE CODE "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL AUTODESK OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF DATA, OR LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, THAT MAY OCCUR AS A RESULT OF IMPLEMENTING OR USING ANY SAMPLE CODE, EVEN IF AUTODESK OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.