# Tagged Questions

A common GIS operation. Used to determine whether a point lies within a polygon's bounds.

8k views

### Looking for fastest solution for Point in Polygon analysis of 200 million points

Apologies for asking a question that has been asked before -- I've read through answers, and I'm left wondering how to implement the recommendations. I've never used SQL, Python, C, and have only ...
2k views

### Fastest way to spatially join a point CSV with a polygon Shapefile

I have a 1 billion point CSV file and a shapefile with around 5,000 polygons. What would be the fastest way to spatially join points and polygons? For each point, I need to get the containing polygon ...
6k views

### How can I find a point inside a polygon in PostGIS?

How can I find a point that is guaranteed to be within a given polygon in PostGIS? I am aware of the ST_Centroid function. However, the centroid is not always within a polygon, see below: ...
367 views

### How does spatial polygon %over% polygon work to when aggregating values in r?

I'm working on an environmental epidemiology project where I have point exposures (~ 2,000 industrial hog operations - IHOs). These IHOs spray on nearby fields, but the feces water droplets and smell ...
455 views

### Spatial operators in R?

How can I do spatial selections or filters in R? I can do this in PostGIS using (e.g.): SELECT * FROM mypoint, mypoly WHERE ST_Within(mypoint.geom, mypoly.geom); and it is similarly a piece of cake ...
4k views

### Overlay a spatial polygon with a grid and check in which grid element specific coordinates are located

How can one use R to split a shape file in 200 meter squares/sub-polygons, plot this grid (incl. ID numbers for each square) over the original map below, and evaluate in which square specific ...
3k views

### Creating evenly distributed points within an irregular boundary

I need to create an evenly distributed series of points within a series of oddly shapped polygons (formerly squares, but now squares with donut holes). The way I have solved this problem so far is to ...
503 views

### Update database row with points that fall within polygons

All, I have a PostGIS/Postgresql DB that has two tables in it. One with point geometries and the other that represents country boundaries as polygons. I would like to add the country name that each ...
3k views

### Point-in-polygon using Python and OGR

I want to use OGR in Python to write a simple point-in-polygon test: def point_in_polygon(point, polygon): """ point : [longitude, latitude] polygon : [(lon1, lat1), (lon2, lat2), ..., ...
565 views

### How to determine optimal windmill placement to maximize production?

How can I add automatically the maximum number of points (dots) with 6m diameter and 100m distance each point from other into an area. The dots will present the windmill base (6m) and I want the ...
2k views

### Point in polygon algorithm for multiple polygons

I've a Google map with bunch of polygons on it. Here is a problem I'm interested in: Given a lat,lng point, what's the best way to determine all the polygons that this point lies in? The obvious way ...
9k views

### Check if lat/long point is within a set of polygons using google maps

I know how to do the above using Esri (Query task on shapefile), but can this also be done using Google Maps? Do I have to query each polygon or is there one method to query a set of polygons?
2k views

### Performance Gain Through GIST Index for Point in Polygon Query

I have two tables: locations(id,region_id,the_geom) and regions(id,the_geom). For each location point I want to determine the region it is located in: UPDATE locations SET region_id = (SELECT id ...
7k views

### Create a polygon layer from point data

I'm currently using QGIS 1.8.0 I would like to create a polygon layer from a point dataset, where the size of the polygons relates to the resolution of the grid reference. The ultimate aim would be ...
242 views

### Boundary from Points

I have a point cloud and need to process a very detailed boundary around the outer points. Is there a tool in QGIS? Convex hull is not detailed enough. Thank you!
2k views

### How to identify feature vertices that are part of a donut hole in ArcGIS 10?

I´m exporting the coordinates of polygon vertices to a CSV-File using the "Feature Vertices to Points" and then the "Export feature attributes to ASCII" tools. Some of these polygons have holes ...
3k views

### STIntersects - Update field to give me count of points in polygon

I have a points layer (dbo.ptLayer) Around 1M points Spatial Geometry Type (dbo.ptLayer.geom) No spatial index just yet, but will create one once data gathering complete. I have a polygon layer ...
162 views

### Create large amount of random points in binary raster

I want to create a point vector dataset of 10000 points (or larger) within a binary raster, where the points should be constrained to areas where the raster value is 1. I tried the following steps. ...
2k views

### Total of attribute field of point layer per polygon layer

I have a polygon shapefile of many lakes, I also have a point shapefile of locations on those lakes where fish were caught. The point shapefile contains the attributes: Fisherman_iD, Fish_Caught, ...
723 views

### Does anyone know a function to determine if a Point lies on a polyline?

ArcEngine 10 .Net 4 c# Hi I'm currently allowing user to select a point on a polyline and creating a point on the line. I am using snapping tool. I just want to make sure that when the user clicks ...
1k views

### Creating polygons from a one to many relationship of points

I have a set of polygons that are in a one to many relationship with points. The polygons are administrative boundaries and the points have information on companies and percentage of ownership . I ...
202 views

### Which polygons surround this point? A practical case of political geography

I'm starting a project from scratch but am budget constrained. In plain language I've got no money. What I want is to provide an address and return what governments have jurisdiction there. The ...
139 views

### Is there any simple integration for counting points in polygon using python qgis?

Is there any simple integration for calculating count of points in polygon using QGIS-Python integration? In other words, are there any pre-defined functions for points in polygon of QGIS using ...
3k views

### Shapely unable to tell if polygon contains point

For an application I want to determine under which constituency a given coordinate falls. After looking at the various options, I decided upon shapely and fiona as the easiest way to implement this. ...
168 views

### How to query for a specific point, within a specific polygon?

I have a shapefile points layer, with each point representing either Marginal, suboptimal, or optimal conditions. I want to find only the marginal points within a specific polygon from my catchments ...
3k views

### Count Points in Polygon with Postgis

I've got a simple problem: I want to count the number of points within a set of polygons. I have a SQL already but it only gives back the gid of the polygone that actually contains points. My ...
9k views

### Solving the Point in Polygon Problem Using Google Maps and Fusion Tables

The Point-In-Polygon problem is fairly well documented on this forum. My question is if there is a way to use Google's free tools, i.e. Google Maps, Fusion Tables, and possibly Google Refine, to solve ...
3k views

### How do I add polygons to an existing attribute table where the data is stored as points? ArcGis 10

I have a shape file of golf courses saved as points, I would like to digitise the boundaries and add the polygons to the existing attribute table. I have opened editor and clicked on the point data ...
479 views

### Convert Landmask file into WKT Polygon

I have a land mask file in netCDF (also in ascii, if needed) which basically consists of a lat/long pair and a boolean (1 or 0) determining if that value is over land or not. The thing is, I'm not ...
839 views

### Calculation of average point distances from one another within a polygon grid

I am working with processed LiDAR data of forested areas in ArcMap 10, with various area based statistics extracted for each 30x30m polygon grid-cell in a shapefile. There are approximately 20,000 of ...
799 views

### MongoDB: Search for polygons which have a certain location

Good day :). I am trying to implement a search feature on MongoDB using Mongoose.js , the short version of which is this: I tag locations on a map as polygons. and give them names. Then when an user ...
776 views

### In ArcGIS how can I append the number of points that are located inside each individual block groups of the entire US?

I am using ArcGIS 10 and I have 2 shapefiles; (a) a polygon shapefile of block groups of the entire US, (b) a point shape file of customer locations throughout the US. What I want to know if how many ...
71 views

### Deleting line vertices inside polygon using ArcPy?

Is there a way to automatically delete vertices in line features using a polygon file in ArcGIS so that it wouldn't cut up the line but just straightens the line inside the polygon? The lines are ...
5k views

### Select points under polygons?

Dear all, I apologise if this is answered elsewhere, but I cant find it. I have a point layer and a polygon layer (created from the point layer using local convex hull isopleths). I would like to be ...
1k views

### Join spatial point data to polygons in R

I am trying to perform a spatial join between point data and polygon data. I have data that indicate the spatial coordinates of an event in my csv file A and have another file, shapefile B, that ...
915 views

### Correct way to perform point-in-polygon queries on streaming point data?

Short version: What is the "correct" Esri-based solution to the presumably-common scenario of receiving dynamic asset location data (eg. aircraft), checking to see whether those points are within any ...
216 views

### How to create randomly points within polygons for each row of a dataframe matching a Polygon ID with R

My question is similar to this post, but because there are no "perfect" answer and above all no reproducible example I open this question. I have a "SpatialPolygonsDataFrame" and a data frame. Both ...
3k views

### How to determine if a mouse click falls within a polygon

I have a polygon drawn on top of a layer using the graphicsContainer of the current activeView, then I want to be able to show a custom context menu if the user right clicks INSIDE the polygon. So I ...
321 views

### How to determine in which grid cell each coordinate of an x,y series is located?

I have a circular arena which I have divided into a number of equal-sized 'cells' using a grid-like arrangement of concentric circles and line segments (in grey below) and also a series of x,y ...
220 views

### Points in polygon by months

I have two tables: points(gid,id,datum,x,y,geom) and hexa_grid(gid,geom). I must create new table hexa_grid_pip (gid,2008_01,2008_02 ... 2011_12, geom) In column 2008_01 ... 2011_12 must be number ...
42 views

### How do I generate grid square polygons from a 5m DTM file?

For my dissertation I have collected point features as coordinates and want to relate their distribution around a lake to elevation to see if there is any pattern/relationship between them. I have ...
81 views

### Qgis creating point within complex shapes (with holes) [duplicate]

I'm looking for a tool to create a point in every polygon, that will be placed in the polygon. these are complex shapes with holes. the point must not put in those holes! the "plugin RealCentroid" ...
433 views

### Tearing in ggmap (R) after using spTransform and random point generation using splancs

I am using R and the package ggmap to try and generate some random points within the city limits of Chapel Hill, NC. I have downloaded the shapefile for the town of Chapel Hill from the Orange County ...
144 views

### Programmatically selecting features by polygon

Expanding upon this post how could you use QGis to programmatically draw a selection polygon and select features within the polygon? I have been using QgsMapToolEmitPoint(self.canvas), to find and ...
2k views

### Checking if Lng and Lat fall inside polygons from ESRI Shape file

I have two input files. First: CSV file with a list of points each defined with Lng, Lat, Name Second: ESRI Shape file defining a number of polygons I would like to determine for each point I have ...
3k views

### Is it possible to extract Coordinates of Polygon Centroid in QGIS?

I have created polygon centroids using one of the "Geometry Tools" but I would like to extract the actual coordinates into Excel for further work. Is this possible?
63 views

### Why do I get green crossed circles instead when I try to move a point?

It's really horrible I must say. I sometimes have geometry issues and then try to go one by one through them and fix these cases. Therefore I mark the area points and delete them for instance. After ...
1k views

### Geodjango - trying to get points within a polygon

I'm going through the Geodjango tutorial and trying to implement in my own project - I have loaded data from a shapefile into my model/database and I have a separate model that has a PointField. I am ...