Open Source Geocoding Engine

David Bitner osgis.lists at GMAIL.COM
Fri Mar 4 14:24:33 EST 2005


PostgreSQL/PostGIS combined with PL/PGSQL can create a very good
localized geocoder.  I have created a geocoder using PostgreSQL that
is very specific to a particular local streets dataset without much
difficulty.

The previously mentioned OS geocoders will not do anything for
Southern Ontario out of the box since they are specific to the US
Census Tiger Data.

The first thing that you will need regardless of how you are planning
on creating your geocoder is good address matchable street data.  This
streets data must have separated fields for the different component
address parts as well as from and to address ranges for each street
segment (often a group of fields l_f_add,l_t_add,r_f_add,r_t_add).

If you do not have address matchable street data, you are dead in the
water regardless of whether you have geocoding software.

I do know that Refractions has been working on some geocoding pl/pgsql as well.

A rough outline of a plpgsql geocoder follows (assuming you can split
the address into the appropriate parts):

create a type to hold the results of your geocode query -- this should
include all fields that you'll want in your result and a field to hold
a rank.

create a function that returns your geocode result type:
set up a loop with the pieces of the address that you want to force an
exact match --

for i in select * from roads where streetname=inputstreetname and
inputstreetnumber between minimum_address_number and maximum address
number LOOP
if i.prefix_direction=inputprefixdirection then rank=rank+1; end if;
if i.street_type=inputstreettype then rank=rank+1;end if;
...
result.prefix_direction:=i.prefix_direction;
result.street_type:=i.street_type;
...
percent:=(street_number-i.minimum_address)/(i.maximum_address-i.minimum_address);
result.geometry:=line_interpolate_point(geometryn(i.geometry,1),percent);
result.rank=rank;
return next result;
end LOOP;


The to get your result, you could use a query like:
select * from geocode_function(inputstreetnumber,inputprefixdirection,...)
order by rank limit 1;




On Fri, 4 Mar 2005 11:50:31 -0600, Poopalasingham Elankeswaran
<pelankes at gmail.com> wrote:
> Hi there,
>
> I am doing research on Address gecoding with Mapserver and
> PostgreSQL/PostGIS. Does anyone have any idea in this area? It is not like
> Goole Map or Mapquest. This has to be specifically for Southern Ontario,
> Canada. I need to search list of addresses and displaying them together on a
> Map or save all the corresponding points to a shape file.
>
> Is there any Open Source Geocoding Engine?
>
> Thanks,
>
> P.Elankes
> Computer System Engineering
> Carleton University
> Ottawa,Canada
>



More information about the mapserver-users mailing list