I have two features: points and grid cells (vector). I want to select a point within a grid cell (some cell do not have point) using python script and create a new feature layer with below conditions:

  1. If no point in cell then leave as it is.
  2. If only one point then pick that point.
  3. If more than one point then calculate average point.

How can I achieve this task ? I will appreciate your help.


  • 1
    What software do you have available to use? ESRI? QGIS? PostgreSQL? – dklassen Feb 5 '14 at 22:05

If you have ArcGIS - you can do the following - use the arcpy.InterpolateShape_3d() tool to get the value of the raster for each point - then use the arcpy.Statistics_analysis() tools to get the mean value for each raster value.

  • Thanks for your advice ! points and grid cells both are vector actually.Sorry for confusion. – GeoSpal Feb 5 '14 at 22:16
  • Then you just need to do an Intersect of the points with the polygons - then the statistics again to get what you want. Same process, just different tools/approach. – dklassen Feb 5 '14 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.