Point in shapefile

233
3
05-08-2021 06:49 PM
JohnAem
New Contributor

I have two files.  One has latitude and longitude coordinates.  The second is a shapefile made from some census districts.  I want to be able to check if any of the listed points are within the boundaries of the shapefile. I've searched the forum and the web but came up short.  Is there an example of this in c# or vb.net?

0 Kudos
3 Replies
DonKemlage
Esri Contributor

@JohnAem,

Look at the Esri.ArcGISRutime.Geometry.GeometryEngine.Within Method for some guidance on the classic point-in-polygon question. Here the URL in the WPF Library Reference API documentation: https://developers.arcgis.com/net/wpf/api-reference/html/M_Esri_ArcGISRuntime_Geometry_GeometryEngin.... It has a C# code example you can learn from.

-don

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

To avoid querying both tables and working with the result sets, you could also try querying the point shapefile feature table, creating a multipoint geometry from the results and passing that as the input geometry for a query on the polygon shapefile feature table.

0 Kudos
JohnAem
New Contributor

Don,

 I looked at the within method.  It's exactly the type of thing I would need.  However, I haven't been able to figure out how to get an object with that method from a shape file.  As a side note, the coordinates are now in an MS SQL database.  I don't know if it would be faster or better to put them in another GIS style format such as a shapefile or such.  We currently have 3.2 million coordinates with about 10-50k being made per day.

Michael,

If I am reading this correctly you are suggesting I create a shapefile with just the points (3.2M of them).  Then put them into a table inside the shapefile.  At this point I'm rather lost since I don't know which objects I would or could use.  I'm very lost as to how to break down a shapefile into it's geometry for example.  Would anyone be so kind as to write a quick example, pseudo code, or just the list of objects I should be looking in to?  

Thanks for all the help so far.

0 Kudos