The GIS Book containing details and examples for creating GIS based content.
These couple of pages will hopefully break you in gently to the world of geographical searching.

The areas we will cover are

  • Local Solr (the search engine)
  • Local Lucene (the search library)
  • Geo Coding (converting an address to latitude / longitude)

In essence what we are attempting to accomplish is, from point x, find me all items within y miles which
contain this piece of text.

For example at the end of this chapter, you should be able to search for a restaurant, with in
25 miles of a location in New York.
In industries this is commonly known as local search, which is where the name local lucene, and local solr
came from.


Quick Start

Beginner Level
This is a one pager on how to get up and running with a geographical search engine.
Later on we will discuss how to configure LocalSolr to meet your needs, as well as
LocalLucene which is the set of libraries used for geographical searching.
To begin with we will down load the a demo version of local solr, this demo contains a recent
version of local lucene and local solr with some sample data and a html / javascript UI.
It’s designed to give you a quick view of local solr and help you get up and running with it quickly.

  1. Java 1.5 configured and in your path, or at least a knowledge of how to run java.

Yes seriously that’s about it…
First download the demo from
Even though it’s a .tgz (tarred, gzip) file winzip will open it for windows users.
Unix users can issue
tar -zvxf solr-example.tgz
After exploding / unzipping the file, you should be left with a solr-example directory
with the following layout








This shows that we have supplied localsolr with solr, and set it up with some data already.
Using a terminal, or windows dos prompt go to solr-example>apache-solr-1.*
(replace * with whatever version of apache-solr is supplied)
Then run

java -jar start.jar

The demo data has already been indexed, and the UI has been set up.
All you need to do is open up a browser and go to http://localhost:8983/localcinema/

As we are using google maps as a demo, google requires an API key which is bound to an url.
The one supplied in the demo is bound to “http://localhost:8983/localcinema/”, if you wish to run it on
something other than your localhost, you need to register and apply for an API key from

Click the “go” button on the page, and drag the map around.
LocalSolr supports sorting by score, distance, or any other indexed field that solr itself can sort on.



Using Local Solr

Beginner Level
Under the covers of the demo, there are several processes occurring.


The demo already comes with data indexed, the raw data we’re using in the demo is available in


Lets begin with removing solrs existing index, stop solr if it’s running, then delete / rename


Restart solr, by running java -jar start.jar again, verify that the index directory if empty by going
to solr’s admin web page http://localhost:8983/solr/admin/, and clicking on [Statistics].
Uploading the data is as simple as running solr’s post jar

java -jar solr-example/apache-solr-1.3-dev/example/exampledocs/post.jar

*Obviously on Windows, the ‘/’ would be replaced with ”.
Querying localsolr is as simple as using 5 parameters

  • q, solr’s query parameter
  • qt, query type, we specify ‘geo’ to activate local solr.
  • lat, latitude of the point you want to begin searching from.
  • long, longitude of the point you want to begin searching from.
  • radius, radius in miles from the point you want search from.

Resulting in:
There are often questions around this, some of which are answered in the F.A.Q or in the up coming pages.

  • One common question is, ‘how do I get the latitude / longitude of an address?’
    • Hopefully this is addressed in the GeoCoding section.



Fill in your details below or click an icon to log in: 徽标

You are commenting using your account. Log Out /  更改 )

Google+ photo

You are commenting using your Google+ account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )


Connecting to %s