com.gisgraphy.geocoding
Class GeocodingService

java.lang.Object
  extended by com.gisgraphy.geocoding.GeocodingService
All Implemented Interfaces:
com.gisgraphy.geocoding.IGeocodingService

@Service
public class GeocodingService
extends Object
implements com.gisgraphy.geocoding.IGeocodingService

Geocode internationnal address via gisgraphy services

Author:
David Masclet

Field Summary
static int ACCEPT_DISTANCE_BETWEEN_CITY_AND_STREET
           
static SolrResponseDtoDistanceComparator comparator
           
static com.gisgraphy.domain.valueobject.Pagination FIVE_RESULT_PAGINATION
           
protected static org.slf4j.Logger logger
          The logger
static com.gisgraphy.domain.valueobject.Output LONG_OUTPUT
           
static com.gisgraphy.domain.valueobject.Output MEDIUM_OUTPUT
           
static com.gisgraphy.domain.valueobject.Pagination ONE_RESULT_PAGINATION
           
 
Constructor Summary
GeocodingService()
           
 
Method Summary
protected  com.gisgraphy.addressparser.AddressResultsDto buildAddressResultDtoFromSolrResponseDto(List<com.gisgraphy.fulltext.SolrResponseDto> solResponseDtos)
           
protected  com.gisgraphy.addressparser.AddressResultsDto buildAddressResultDtoFromStreetsAndCities(List<com.gisgraphy.fulltext.SolrResponseDto> streets, List<com.gisgraphy.fulltext.SolrResponseDto> cities)
           
protected  List<com.gisgraphy.fulltext.SolrResponseDto> findCitiesInText(String text, String countryCode)
           
protected  List<com.gisgraphy.fulltext.SolrResponseDto> findExactMatches(String text, String countryCode)
           
protected  List<com.gisgraphy.fulltext.SolrResponseDto> findInText(String text, String countryCode, com.vividsolutions.jts.geom.Point point, Class<?>[] placetypes)
           
protected  List<com.gisgraphy.fulltext.SolrResponseDto> findStreetInText(String text, String countryCode, com.vividsolutions.jts.geom.Point point)
           
 com.gisgraphy.addressparser.AddressResultsDto geocode(com.gisgraphy.addressparser.AddressQuery query)
           
 com.gisgraphy.addressparser.AddressResultsDto geocode(com.gisgraphy.addressparser.Address address, String countryCode)
           
 void geocodeAndSerialize(com.gisgraphy.addressparser.AddressQuery query, OutputStream outputStream)
           
 String geocodeToString(com.gisgraphy.addressparser.AddressQuery query)
           
protected  String getBestCitySearchSentence(com.gisgraphy.addressparser.Address address)
           
protected  boolean isGeocodable(com.gisgraphy.addressparser.Address address)
           
protected  List<com.gisgraphy.fulltext.SolrResponseDto> mergeSolrResponseDto(List<com.gisgraphy.fulltext.SolrResponseDto> exactMatches, List<com.gisgraphy.fulltext.SolrResponseDto> aproximativeMatches)
           
protected  void populateAddressFromCity(com.gisgraphy.fulltext.SolrResponseDto city, com.gisgraphy.addressparser.Address address)
           
 void setAddressParser(com.gisgraphy.addressparser.IAddressParserService addressParser)
           
 void setFullTextSearchEngine(com.gisgraphy.fulltext.IFullTextSearchEngine fullTextSearchEngine)
           
 void setGisgraphyConfig(com.gisgraphy.domain.valueobject.GisgraphyConfig gisgraphyConfig)
           
 void setImporterConfig(ImporterConfig importerConfig)
           
 void setStatsUsageService(IStatsUsageService statsUsageService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPT_DISTANCE_BETWEEN_CITY_AND_STREET

public static final int ACCEPT_DISTANCE_BETWEEN_CITY_AND_STREET
See Also:
Constant Field Values

LONG_OUTPUT

public static final com.gisgraphy.domain.valueobject.Output LONG_OUTPUT

MEDIUM_OUTPUT

public static final com.gisgraphy.domain.valueobject.Output MEDIUM_OUTPUT

ONE_RESULT_PAGINATION

public static final com.gisgraphy.domain.valueobject.Pagination ONE_RESULT_PAGINATION

FIVE_RESULT_PAGINATION

public static final com.gisgraphy.domain.valueobject.Pagination FIVE_RESULT_PAGINATION

comparator

public static final SolrResponseDtoDistanceComparator comparator

logger

protected static final org.slf4j.Logger logger
The logger

Constructor Detail

GeocodingService

public GeocodingService()
Method Detail

geocodeAndSerialize

public void geocodeAndSerialize(com.gisgraphy.addressparser.AddressQuery query,
                                OutputStream outputStream)
                         throws com.gisgraphy.geocoding.GeocodingException
Specified by:
geocodeAndSerialize in interface com.gisgraphy.geocoding.IGeocodingService
Throws:
com.gisgraphy.geocoding.GeocodingException

geocodeToString

public String geocodeToString(com.gisgraphy.addressparser.AddressQuery query)
                       throws com.gisgraphy.geocoding.GeocodingException
Specified by:
geocodeToString in interface com.gisgraphy.geocoding.IGeocodingService
Throws:
com.gisgraphy.geocoding.GeocodingException

geocode

public com.gisgraphy.addressparser.AddressResultsDto geocode(com.gisgraphy.addressparser.AddressQuery query)
                                                      throws com.gisgraphy.geocoding.GeocodingException
Specified by:
geocode in interface com.gisgraphy.geocoding.IGeocodingService
Throws:
com.gisgraphy.geocoding.GeocodingException

isGeocodable

protected boolean isGeocodable(com.gisgraphy.addressparser.Address address)

geocode

public com.gisgraphy.addressparser.AddressResultsDto geocode(com.gisgraphy.addressparser.Address address,
                                                             String countryCode)
                                                      throws com.gisgraphy.geocoding.GeocodingException
Specified by:
geocode in interface com.gisgraphy.geocoding.IGeocodingService
Throws:
com.gisgraphy.geocoding.GeocodingException

getBestCitySearchSentence

protected String getBestCitySearchSentence(com.gisgraphy.addressparser.Address address)

buildAddressResultDtoFromStreetsAndCities

protected com.gisgraphy.addressparser.AddressResultsDto buildAddressResultDtoFromStreetsAndCities(List<com.gisgraphy.fulltext.SolrResponseDto> streets,
                                                                                                  List<com.gisgraphy.fulltext.SolrResponseDto> cities)

buildAddressResultDtoFromSolrResponseDto

protected com.gisgraphy.addressparser.AddressResultsDto buildAddressResultDtoFromSolrResponseDto(List<com.gisgraphy.fulltext.SolrResponseDto> solResponseDtos)

populateAddressFromCity

protected void populateAddressFromCity(com.gisgraphy.fulltext.SolrResponseDto city,
                                       com.gisgraphy.addressparser.Address address)

findCitiesInText

protected List<com.gisgraphy.fulltext.SolrResponseDto> findCitiesInText(String text,
                                                                        String countryCode)

findStreetInText

protected List<com.gisgraphy.fulltext.SolrResponseDto> findStreetInText(String text,
                                                                        String countryCode,
                                                                        com.vividsolutions.jts.geom.Point point)

findInText

protected List<com.gisgraphy.fulltext.SolrResponseDto> findInText(String text,
                                                                  String countryCode,
                                                                  com.vividsolutions.jts.geom.Point point,
                                                                  Class<?>[] placetypes)

mergeSolrResponseDto

protected List<com.gisgraphy.fulltext.SolrResponseDto> mergeSolrResponseDto(List<com.gisgraphy.fulltext.SolrResponseDto> exactMatches,
                                                                            List<com.gisgraphy.fulltext.SolrResponseDto> aproximativeMatches)
Parameters:
exactMatches -
aproximativeMatches -
Returns:
a list of SolrResponseDto with list1[0],list2[0],list1[1],list2[1],... it remove duplicates and null

findExactMatches

protected List<com.gisgraphy.fulltext.SolrResponseDto> findExactMatches(String text,
                                                                        String countryCode)

setAddressParser

public void setAddressParser(com.gisgraphy.addressparser.IAddressParserService addressParser)

setFullTextSearchEngine

public void setFullTextSearchEngine(com.gisgraphy.fulltext.IFullTextSearchEngine fullTextSearchEngine)

setStatsUsageService

public void setStatsUsageService(IStatsUsageService statsUsageService)

setImporterConfig

public void setImporterConfig(ImporterConfig importerConfig)

setGisgraphyConfig

public void setGisgraphyConfig(com.gisgraphy.domain.valueobject.GisgraphyConfig gisgraphyConfig)


Copyright © 2012. All Rights Reserved.