new Geocoder(metaData)
Geocoder is a helper class for various geocoding functions. Once constructed,
it can be used to geocode a single address, a batch of addresses, or reverse
geocode a longitude/latitude point.
Parameters:
| Name | Type | Description | 
|---|---|---|
| metaData | Object | MetaData is a class that provides capability and data coverage information for the | 
Methods
- 
    batchGeoCode(addressList, callBack)
- 
    
    Use this method to efficiently batch geocode multiple addresses. Parameters:Name Type Description addressListarray an array of addresses to be geocoded. callBackfunction a user specified function that is invoked when 
 the input address is geocoded. It should declare one parameter, which is an
 address object that contains the geocoded result.Examplevar addressList = [ {"id":"100", "address":"1 oracle drv, Nashua, NH, 03062"}, {"id":"101", "address":"500 oracle pkwy, Redwood City, CA 94065"} ]; gc.bactchGeocode(addressList, function(results, status) { if(status===Geocoder.STATUS_OK) { for(var i = 0; i < results.length; i++) { var result = results[i]; if(result.matches) { var match = result.matches[0]; alert("address "+result.id+" : "+match.longitude+", "+match.latitude); } } } });
- 
    geocode(address, callBack)
- 
    
    This method invokes the geocoding service on Oracle's eLocation server to obtain the longitude/latitude 
 information for a given street address. It then invokes the user defined
 callback function and passes in the geocoded result. The call back function can
 then look up the result, extract the longitude/latitude information and display
 it on a map.Parameters:Name Type Description addressObject address is a single JSON object containing the input address. callBackfunction is a user specified function that is invoked when 
 the input address is geocoded. It should declare two parameters 'result' and 'status'.
 The 'status' parameter contains general status regarding the current geocoding request.
 For instance it will be set to Geocoder.STATUS_FAILED if there is network issue and the
 geocoding server cannot be reached. A value of Geocoder.STATUS_OK indicates the
 geocoding call went through, but it does not necessarily mean the input address
 actually has found a match by the service.
 The 'result' parameter contains the actual geocoding result, with the following
 properties that an application can look up:
 - id : the id (if any) specified in the input address.
- rawResponse : the raw (XML) response from the geocoding service.
- matches : an array containing one or more instances of Match class
 
 
 
 
 Examples//a single JSON object address var addr = {id:"100", address:"1 oracle drv, Nashua, NH, 03062", matchCode:OM.lbs.Geocoder.MATCH_MODE_RELAX_POSTAL_CODE} ; gc.geocode(addr, function(result, status) { if(status===Geocoder.STATUS_OK && result.matches) { var match = result.matches[0]; alert(long: +match.longitude + , lat: +match.latitude); } });//a formatted address //we can use the formatted address if we know the value for each field of the address. Now we support formatted address: //OM.lbs.GdfFormAddress, OM.lbs.GenFormAddress, OM.lbs.USForm1Address, OM.lbs.USForm2Address. //These could have a good performance. var options={street:"1 Oracle Drive", builtupArea:"Nashua", order1Area:"NH", postalCode:"03062", country:"US", matchCode:OM.lbs.Geocoder.MATCH_MODE_RELAX_POSTAL_CODE}; var address=new OM.lbs.GdfFormAddress(options); gc.geocode(addr, function(result, status) { if(status===Geocoder.STATUS_OK && result.matches) { var match = result.matches[0]; alert(long: +match.longitude + , lat: +match.latitude); } });
- 
    reverseGeocode(longitude, latitude, callback)
- 
    
    Find the nearest address to the specified location. Upon successful reverse geocoding, 
 an instance of the OM.lbs.OutputAddress is passed to the callback function.Parameters:Name Type Description longitudenumber the longitude of the location latitudenumber the latitude of the location callbackfunction is a user specified function that is invoked when 
 the input address is successfully reverse geocoded.
- 
    reverseGeocodePoint(mapPoint, callback)
- 
    
    Finds the nearest postal address to the specified map location point. 
 Similar to reverseGeocode but uses a OM.geometry.Point instance which
 may be in a projected coordinate system (as opposed to longitude/latitude).
 Such a point is typically obtained from the OM.Map's getCursorLocation() method,
 and its coordinates are always in the current map universe's SRID.Parameters:Name Type Description mapPointOM.geometry.Point a Point geometry callbackfunction callback function on success reverse geocoding