01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.location;
16:
17: import java.io.IOException;
18: import java.util.List;
19:
20: import org.apache.xmlrpc.XmlRpcException;
21: import org.eclipse.core.runtime.IProgressMonitor;
22: import org.geotools.feature.Feature;
23:
24: import com.vividsolutions.jts.geom.Envelope;
25:
26: /**
27: * Find a location, using the USG service.
28: *
29: * @author Jody Garnett
30: * @since 1.0.0
31: */
32: public class USGLocation {
33:
34: public List<Feature> search(String pattern, Envelope bbox,
35: IProgressMonitor monitor) throws IOException {
36: AddressSeeker seek = new AddressSeeker();
37: List<Feature> stuff;
38: try {
39: stuff = seek.geocode(pattern);
40: } catch (IOException e) {
41: return null;
42: } catch (XmlRpcException e) {
43: return null;
44: }
45: return stuff;
46: }
47:
48: }
|