Class: Google::Apis::CivicinfoV2::FeatureIdProto

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
lib/google/apis/civicinfo_v2/classes.rb,
lib/google/apis/civicinfo_v2/representations.rb,
lib/google/apis/civicinfo_v2/representations.rb

Overview

A globally unique identifier associated with each feature. We use 128-bit identifiers so that we have lots of bits available to distinguish between features. The feature id currently consists of a 64-bit "cell id" that ** sometimes** corresponds to the approximate centroid of the feature, plus a 64- bit fingerprint of other identifying information. See more on each respective field in its comments. Feature ids are first assigned when the data is created in MapFacts. After initial creation of the feature, they are immutable. This means that the only properties that you should rely on are that they are unique, and that cell_ids often - but not always - preserve spatial locality. The degree of locality varies as the feature undergoes geometry changes, and should not in general be considered a firm guarantee of the location of any particular feature. In fact, some locationless features have randomized cell IDs! Consumers of FeatureProtos from Mapfacts are guaranteed that fprints in the id field of features will be globally unique. Using the fprint allows consumers who don't need the spatial benefit of cell ids to uniquely identify features in a 64-bit address space. This property is not guaranteed for other sources of FeatureProtos.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ FeatureIdProto

Returns a new instance of FeatureIdProto.



705
706
707
# File 'lib/google/apis/civicinfo_v2/classes.rb', line 705

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#cell_idFixnum

The S2CellId corresponding to the approximate location of this feature as of when it was first created. This can be of variable accuracy, ranging from the exact centroid of the feature at creation, a very large S2 Cell, or even being completely randomized for locationless features. Cell ids have the nice property that they follow a space-filling curve over the surface of the earth. (See s2cellid.h for details.) WARNING: Clients should only use cell IDs to perform spatial locality optimizations. There is no strict guarantee that the cell ID of a feature is related to the current geometry of the feature in any way. Corresponds to the JSON property cellId

Returns:

  • (Fixnum)


688
689
690
# File 'lib/google/apis/civicinfo_v2/classes.rb', line 688

def cell_id
  @cell_id
end

#fprintFixnum

A 64-bit fingerprint used to identify features. Most clients should rely on MapFacts or OneRing to choose fingerprints. If creating new fprints, the strategy should be chosen so that the chance of collision is remote or non- existent, and the distribution should be reasonably uniform. For example, if the source data assigns unique ids to features, then a fingerprint of the provider name, version, and source id is sufficient. Corresponds to the JSON property fprint

Returns:

  • (Fixnum)


698
699
700
# File 'lib/google/apis/civicinfo_v2/classes.rb', line 698

def fprint
  @fprint
end

#temporary_dataGoogle::Apis::CivicinfoV2::MessageSet

This is proto2's version of MessageSet. Corresponds to the JSON property temporaryData



703
704
705
# File 'lib/google/apis/civicinfo_v2/classes.rb', line 703

def temporary_data
  @temporary_data
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



710
711
712
713
714
# File 'lib/google/apis/civicinfo_v2/classes.rb', line 710

def update!(**args)
  @cell_id = args[:cell_id] if args.key?(:cell_id)
  @fprint = args[:fprint] if args.key?(:fprint)
  @temporary_data = args[:temporary_data] if args.key?(:temporary_data)
end