Using NHibernate Spatial
NHibernate Spatial brings the spatial capabilities of several relational databases to the NHibernate API. In this recipe, we'll show you how to use NHibernate Spatial with Microsoft SQL Server 2014 to query for a geographic region containing a point.
Getting ready
In SQL Server 2014 Express, create a new, blank database named Spatial.
Download State shapes from the US Census website by following these steps:
- Inside the solution directory, create a directory named
SpatialData
. - Download the Shape file containing all 50 states, D.C., and Puerto Rico from the United States Census website at https://www.census.gov/geo/maps-data/data/cbf/cbf_counties.html or from the code download for this book. The file is named
st99_d00_shp.zip
. - Extract all three files to the
SpatialData
folder. The files are namedst99_d00.shp
,st99_d00.dbf
, andst99_d00.shx
.
Import the data from the Shapefile into the Spatial
database using the following steps:
- Inside the solution directory, create a...