ArcGIS Spatial Query

Source: Internet
Author: User

Creates a spatial query which performs a spatial search for features in the supplied feature class and have the option to a LSO apply an attribute query via a WHERE clause.

///<summary>creates a spatial query which performs a spatial search for features in the supplied feature class and have the option To also apply an attribute query via a WHERE clause.</summary>///  ///<param name= "Featureclass" >An ESRI. ArcGIS.Geodatabase.IFeatureClass</param>///<param name= "Searchgeometry" >An ESRI. ArcGIS.Geometry.IGeometry (high-level geometries can be used)</param>///<param name= "SpatialRelation" >An ESRI. ArcGIS.Geodatabase.esriSpatialRelEnum (e.g., esrispatialrelintersects)</param>///<param name= "Whereclause" >A System.String, (e.g., "city_name = ' Redlands '").</param>///   ///<returns>An ifeaturecursor holding the results of the query would be returned.</returns>///   ///<remarks>Call the Spatialquery method by passing in a reference to the Feature Class, a Geometry used for the search and the SP Atial operation to be preformed. An exmaple of a spatial opertaion would is intersects (e.g., esrispatialrelenum.esrispatialrelcontains). If you would a-return everything found by the spatial operation use "" for the WHERE clause. Optionally a whereclause (e.g. "Income >") maybe applied if desired. The SQL syntax used to specify the WHERE clause are the same as that of the underlying database holding the data.</remarks> PublicESRI. ArcGIS.Geodatabase.IFeatureCursor Performspatialquery (ESRI. ArcGIS.Geodatabase.IFeatureClass Featureclass, ESRI. ArcGIS.Geometry.IGeometry Searchgeometry, ESRI. ArcGIS.Geodatabase.esriSpatialRelEnum spatialrelation, System.String whereclause) {//Create a spatial query filterESRI. ArcGIS.Geodatabase.ISpatialFilter Spatialfilter =NewESRI.  ArcGIS.Geodatabase.SpatialFilterClass (); //Specify the geometry to query withSpatialfilter.geometry =Searchgeometry; //Specify what's the geometry field is called on the Feature Class so we'll be querying againstSystem.String Nameofshapefield =Featureclass.shapefieldname; Spatialfilter.geometryfield=Nameofshapefield; //specify the type of spatial operation to useSpatialfilter.spatialrel =spatialrelation; //create the WHERE statementSpatialfilter.whereclause =Whereclause; //perform the query and use a cursor to the resultsESRI. ArcGIS.Geodatabase.IQueryFilter QueryFilter =NewESRI.  ArcGIS.Geodatabase.QueryFilterClass (); QueryFilter=(ESRI.  ArcGIS.Geodatabase.IQueryFilter) Spatialfilter; ESRI. ArcGIS.Geodatabase.IFeatureCursor Featurecursor= Featureclass.search (QueryFilter,false); returnfeaturecursor;}

ArcGIS Spatial Query

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.