Class GeoJsonCityLoader.CityFeature

java.lang.Object
edu.cnu.mdi.mapping.loader.GeoJsonCityLoader.CityFeature
Enclosing class:
GeoJsonCityLoader

public static final class GeoJsonCityLoader.CityFeature extends Object
Immutable representation of a single populated-place (city) feature.

Coordinate fields use radians throughout, matching the convention used by all IMapProjection implementations. Use Math.toDegrees(double) when displaying values to users.

  • Constructor Summary

    Constructors
    Constructor
    Description
    CityFeature(String name, String countryName, double longitude, double latitude, long population, int scalerank)
    Constructs a new city feature.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the name of the country in which this city is located, or null if absent in the source data.
    double
    Returns the city's latitude in radians (north positive), in the range [-π/2, π/2].
    double
    Returns the city's longitude in radians (east positive), normalized to (-π, π].
    Returns the city's display name, or null if absent in the source data.
    long
    Returns the city's population estimate, or -1 if the value was not present in the source data.
    int
    Returns the city's scalerank: a small integer where 0 indicates the most prominent cities (capitals, megacities) and larger values indicate progressively less prominent ones.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CityFeature

      public CityFeature(String name, String countryName, double longitude, double latitude, long population, int scalerank)
      Constructs a new city feature.
      Parameters:
      name - display name of the city (may be null if absent from the source data)
      countryName - name of the country (may be null)
      longitude - longitude in radians (east positive); should be in (-π, π]
      latitude - latitude in radians (north positive); should be in [-π/2, π/2]
      population - population estimate, or -1 if unknown
      scalerank - importance rank where 0 denotes the largest / most prominent cities and larger values denote progressively less prominent ones; -1 if unknown
  • Method Details

    • getName

      public String getName()
      Returns the city's display name, or null if absent in the source data.
      Returns:
      city name
    • getCountryName

      public String getCountryName()
      Returns the name of the country in which this city is located, or null if absent in the source data.
      Returns:
      country name
    • getLongitude

      public double getLongitude()
      Returns the city's longitude in radians (east positive), normalized to (-π, π].
      Returns:
      longitude in radians
    • getLatitude

      public double getLatitude()
      Returns the city's latitude in radians (north positive), in the range [-π/2, π/2].
      Returns:
      latitude in radians
    • getPopulation

      public long getPopulation()
      Returns the city's population estimate, or -1 if the value was not present in the source data.
      Returns:
      population estimate or -1
    • getScalerank

      public int getScalerank()
      Returns the city's scalerank: a small integer where 0 indicates the most prominent cities (capitals, megacities) and larger values indicate progressively less prominent ones. Returns -1 if the value was not present in the source data.

      Scalerank is used by CityPointRenderer to filter which cities and labels are rendered at a given zoom level.

      Returns:
      scalerank or -1
    • toString

      public String toString()
      Overrides:
      toString in class Object