Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

project-open-data/SpatialSearch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpatialSearch

SpatialSearch is a RESTful API that allows the user to query geographic entities by latitude and longitude, and extract data.

What Problem This Solves

Implementing spatial data analysis and queries can often be combersome and difficult for end users. This provides a simple way to search any spatial data with a latitude / longitude (e.g. GPS point from a smartphone).

How This Solves It

With this simple search, any spatial data can return the attributes at any given location. This is a RESTful API with simple approaches for the query and response; there is no complicated middle-ware for this implementation.

Building

SpatialSearch is built with Maven http://maven.apache.org/. The build produces a WAR file suitable for deployment on any JEE 5 compliant Web Container (i.e. Jetty, Tomcat, etc.).

To perform a full build, including integration tests (see dependencies below before doing this):

mvn clean install

To run the unit tests (in-memory):

mvn test

Dependencies

  • PostGIS http://postgis.refractions.net/, the spatial extension to PostgreSQL, is necessary to run the API in production. The Unit tests included with this project use the H2 GeoDB https://github.com/jdeolive/geodb in-memory database, allowing for rapid development without the need for a database server.

  • Data. The API exposes the State, County and Census Block geographic layers from the 2010 Census Bureau. These can be obtained from the TIGER http://www.census.gov/geo/www/tiger/tgrshp2010/tgrshp2010.html download page and need to be imported into PostGIS in order to be able to publish the API. SpatialSearch uses the default schema of the tables, grouped into a census schema within a database called gisdb by default. All these parameters can be changed

  • SpatialSearch uses Hibernate Spatial http://www.hibernatespatial.org/ for the geospatial functionality. This library supports the same type of functionality on other Spatial DBMS systems such as Oracle Spatial, Microsoft SQL Server, etc. For more information please visit its website.

Usage

This first version of the API exposes a "point in polygon" functionality, as follows (example running locally from embedded Jetty Servlet Container)

http://localhost:8081/spatialsearch/census/<geography>?latitude=<latitude>&longitude=<longitude>&format=<format> _

where

<geography> is the type of layer being queried. Currently it can take the following values: state2010, county2010, block2010

<longitude> is the Longitude of the position to query on. Expresses in decimal degrees, WGS84 projection is assumed (EPSG code 4326)

<latitude> is the Latitude of the position to query on. Expresses in decimal degrees, WGS84 projection is assumed (EPSG code 4326)

<format> is the output format. Currently it can take the following values: xml, json and jsonp. This parameter is optional, if not specified the response will be enconded as XML

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%