GetLatLngByAddress

Sends a request to TerraFly® servers to geocode the specified address. If the address was successfully located, the user-specified callback function is invoked and the arguments conveyed to the callback function are latitude and longitude for the located point. Otherwise, the callback function is given a null point. In case of ambiguous addresses, only the point for the best match is passed to the callback function.
public GetLatLngByAddress(addressFull, CallBackFunctor):Void

Parameters

  • addressFull : String - Specify the address to be converted to latitude and longitude.
  • Functor : Functor Object - This function is called if the address is successfully located.The arguments conveyed to the callback function are latitude and longitude for the located point.
  • Returns

  • Void
  • Example

    The following example shows how to get latitude and longitude by address.
    <div id="mapContainer"  style="width: 640px; height: 400px;"></div>
    <script type="text/javascript">
        var map0 = new TMap(mapContainer, 25.7590256665386, -80.3738769902151, 15, mapLoaded, 1, true, "", "hybrid");
       
       function mapLoaded() {
                map0.SetPanelVisibility("NAV", "SHOW");
                map0.SetPanelVisibility("ZOOM", "SHOW");
                map0.SetPanelVisibility("OVERVIEW", "SHOW");
            }
       function Button_Goto_onclick(){
                var address = Text_Street.value;
                TGetLatLngByAddress(address, geoCode);
            }
     
       function geoCode(Lat, Lon){
                if ( Lat == 0.0 || Lon == 0.0 ){
                    alert("Could not find the location!");
                }
                else {
                    map0.PanTo(Lat, Lon);
                }
            }       
    </script>
        

    See also

  • TGetAddressByLatLng()

    See example

    Terrafly geocoding service