1

I'm trying to generate a shapefile of random points using FID from the attribute table. My attribute table has 800,000 features and I only need a sample of 240.

Is there a way to do it in arcpy or in the field calculator?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked May 21, 2015 at 8:27
1

2 Answers 2

4

The easiest way to do this is to use Python (can be run in Python window in ArcMap if you are not familiar with any IDE or Python prompt):

import random
print random.sample(range(800000), 240)

This will give you a list of unique value (with no repeating), such as [1,2,5,12]. Now you can use the Select By Attributes in ArcMap and select the features which have their FIDs in the list (just copy/paste the contents of the list):

FID in (1,2,5,12)

Right-click the layer in the TOC and choose Export data. Only selected features will be exported into a new shapefile.

answered May 21, 2015 at 8:42
1
  • In "print random.sample(range(800000), 240)" 80000 should be replaced by the feature number you have in that feature class and 240 will be replaced by the number of sample you want to draw from that space. I think other wise it would be biased sampling though all drawn samples are in the range of your records(features). Commented May 25, 2015 at 5:13
1

You can use Hawth Analysis Tool . It is very easy to use . You need to specify the number of sample to be drawn. Installation process in arcgis is here. Just select and export the layer. demo

You can also use arcscirpt at here

answered May 21, 2015 at 8:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.