TransWikia.com

ee.FeatureCollection.distinct() not working on certain properties

Geographic Information Systems Asked by Joshua Mincer on February 11, 2021

I did a batch download of the National Hydrography Dataset, and I have reason to believe that many lakes are found in many state datasets due to extending past state boundaries. I want to filter these out to avoid duplicates, but it seems to not work.

Below is a comparison of the sizes:

var nhd = ee.FeatureCollection("users/mincej20/NHD_Filtered_50");
nhd = nhd.sort("AreSqKm", False);

print(nhd.size()) //Returns 104762
print(nhd.size().distinct('NHDPlID')) //Returns 104762

These return the same sizes of featurecollections. However, if I print out the first 20 NHDPlIDs:

nhd = ee.FeatureCollection(nhd.toList(20, 1000));
print(nhd.aggregate_array("NHDPlID");

The following list is returned:

0: 22000600050688

1: 65000300111257

2: 65000300111257

3: 65000300111257

4: 65000200109644

5: 21000300292859

6: 21000100338800

7: 21000100338800

8: 21000500141259

9: 65000300137354

10: 65000300137354

11: 65000300137354

12: 65000200154805

13: 23000300045900

14: 23000300045900

15: 10000200330648

16: 15000300130262

17: 15000300130262

18: 15001700186644

19: 15001700186644

I’m not sure why this doesn’t find distinct NHDPlIDs. I figured that I could find distinct '.geo' properties, and this seems to work, but I’d still like to figure out why finding distinct NHDPlIDs does not work. Here’s some information about the features:

print(nhd.getInfo().columns);

  • AreSqKm: Float
  • Centroid: Geometry
  • Elevatn: Object
  • FCode: Integer
  • FDate: String
  • FType: Integer
  • GNIS_ID: String
  • GNIS_Nm: String
  • Max_Pixels: Long
  • Median_Occurrence: Float
  • NHDPlID: Float
  • Prmnn_I: String
  • ReachCd: String
  • Resoltn: Integer
  • Shap_Ar: Float
  • Shp_Lng: Float
  • VPUID: String
  • VsbltyF: Integer
  • system:index: String

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP