City
An object that contains geographical location information for a known city.
Inheritance Hierarchy
System.Object
Autodesk.Revit.DB.APIObject
Autodesk.Revit.DB.City
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class City : APIObject
The City type exposes the following members.
Properties
Name
Description
Public Property
Code Example
IsReadOnly
Identifies if the object is read-only or modifiable.
(Inherited from APIObject)
Public Property
Latitude
Latitude of the city
Public Property
Longitude
Longitude of the city
Public Property
Name
The name of the city
Public Property
TimeZone
Time-zone in which the city resides
Public Property
WeatherStation
An identifier for the nearest weather station
Methods
Name
Description
Public Method
Dispose
Causes the object to release immediately any resources it may be utilizing.
(Inherited from APIObject)
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object)
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object)
Remarks
This object contains longitude, latitude, time zone information for a city already known by Revit. Currently Revit does not the ability to add cities to the existing list. The list of known cities can be retrieved using the Cities property on the application object.
Example
double angleRatio = Math.PI / 180; // ratio of Angle
// Get the Latitude informationdouble latiude = city.Latitude / angleRatio;String latiudeInfo = "Latitude: " + latiude.ToString();
// Get the Longitude informationdouble longitude = city.Longitude / angleRatio;String longitudeInfo = "Longitude: " + longitude.ToString();
// Get the TimeZone informationString timeZoneInfo = "TimeZone: " + city.TimeZone.ToString();
// Set the information text box.string cityInfo = latiudeInfo + "\n" + longitudeInfo + "\n" + timeZoneInfo;