City Class

City Class

An object that contains geographical location information for a known city.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBAPIObject
    Autodesk.Revit.DBCity

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class City : APIObject
Public Class City
	Inherits APIObject
public ref class City : public APIObject
type City = 
    class
        inherit APIObject
    end

The City type exposes the following members.

Properties
 NameDescription
Public propertyCode exampleIsReadOnlyIdentifies if the object is read-only or modifiable.
(Inherited from APIObject)
Public propertyLatitudeLatitude of the city
Public propertyLongitudeLongitude of the city
Public propertyNameThe name of the city
Public propertyTimeZoneTime-zone in which the city resides
Public propertyWeatherStationAn identifier for the nearest weather station
Top
Methods
 NameDescription
Public methodDisposeCauses the object to release immediately any resources it may be utilizing.
(Inherited from APIObject)
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
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 information
double latiude = city.Latitude / angleRatio;
String latiudeInfo = "Latitude:      " + latiude.ToString();

// Get the Longitude information
double longitude = city.Longitude / angleRatio;
String longitudeInfo = "Longitude:   " + longitude.ToString();

// Get the TimeZone information
String timeZoneInfo = "TimeZone:   " + city.TimeZone.ToString();

// Set the information text box.
string cityInfo = latiudeInfo + "\n" + longitudeInfo
                            + "\n" + timeZoneInfo;
Dim angleRatio As Double = Math.PI / 180
' ratio of Angle
' Get the Latitude information
Dim latiude As Double = city.Latitude / angleRatio
Dim latiudeInfo As [String] = "Latitude:      " & latiude.ToString()

' Get the Longitude information
Dim longitude As Double = city.Longitude / angleRatio
Dim longitudeInfo As [String] = "Longitude:   " & longitude.ToString()

' Get the TimeZone information
Dim timeZoneInfo As [String] = "TimeZone:   " & city.TimeZone.ToString()

' Set the information text box.
Dim cityInfo As String = latiudeInfo & vbLf & longitudeInfo & vbLf & timeZoneInfo

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also