I'm trying to get the GeoEngFindPostalCentroid() function to work but the
result latitude and longitude are 0.
This is the function Mach_Addres that contain GeoEngFindPostalCentroid() ,
Please Help
This function supposed to GeoCode an address and return one of the cases,
if (for example) the case is NO_CANDIDATES then the engine run time
parameters are being change, the last resort is to do GeoCode to Centeroid.
I will appreciate any help, I'm new to C and MapMarker/MapInfo.
Thank you in advanced.
Lee Sagi
[EMAIL PROTECTED]
***************************************************************************
*********************
short Mach_Address(int *pGeoEngHandle,
ADDRESS *myAddress,
PARSED_ADDRESS *cleanAddress)
{
short matchStatus;
PARSED_ADDRESS MycleanAddress;
GEO_ENG_CFG_PARMS geoEngParms;
short retCode;
DOUBLE_POINT location;
short precision;
CANDIDATE_ADDRESS candidate;
retCode = GeoEngMatchAddress(
*pGeoEngHandle,
myAddress,
&MycleanAddress,
&matchStatus
);
if (retCode != SUCCESS)
{
fprintf(stderr, "Error %d trying to Mach Address\n", retCode);
}
else if (retCode == SUCCESS)
{
switch (matchStatus)
{
case SINGLE_MATCH:
printf("Single Match\n");
retCode = GeoEngGetCandidateCoords(*pGeoEngHandle, 0,
&precision, &location);
if (retCode != SUCCESS)
{
fprintf(stderr, "Error %d getting candidate
coordinates\n", retCode);
return retCode;
}
longitude = location.x;
latitude = location.y;
break;
case MULTIPLE_MATCHES:
printf("Multiple Matches\n");
retCode = GeoEngGetCandidateCoords(*pGeoEngHandle, 0,
&precision, &location);
if (retCode != SUCCESS)
{
fprintf(stderr, "Error %d getting candidate
coordinates\n", retCode);
return retCode;
}
longitude = location.x;
latitude = location.y;
break;
case NO_MATCHES:
printf("No Matches\n");
Mach_Status = 3;
retCode = GeoEngGetCfgParms (*pGeoEngHandle,
&geoEngParms);
if (retCode != SUCCESS)
{
fprintf(stderr, "Error %d reading configuration
parameters\n", retCode);
return FAILURE;
}
else
{
if (Count == 1)
{
geoEngParms.relaxHouseNumber = TRUE;
geoEngParms.relaxName = FALSE;
geoEngParms.relaxPostalCode = FALSE;
break;
}
else if (Count == 2)
{
geoEngParms.relaxHouseNumber = FALSE;
geoEngParms.relaxName = TRUE;
geoEngParms.relaxPostalCode = FALSE;
break;
}
else if (Count == 3)
{
geoEngParms.relaxHouseNumber = FALSE;
geoEngParms.relaxName = FALSE;
geoEngParms.relaxPostalCode = TRUE;
break;
}
else if (Count == 4)
{
geoEngParms.relaxHouseNumber = TRUE;
geoEngParms.relaxName = TRUE;
geoEngParms.relaxPostalCode = FALSE;
break;
}
else if (Count == 5)
{
geoEngParms.relaxHouseNumber = TRUE;
geoEngParms.relaxName = FALSE;
geoEngParms.relaxPostalCode = TRUE;
break;
}
else if (Count == 6)
{
geoEngParms.relaxHouseNumber = FALSE;
geoEngParms.relaxName = TRUE;
geoEngParms.relaxPostalCode = TRUE;
break;
}
else if (Count == 7)
{
geoEngParms.relaxHouseNumber = TRUE;
geoEngParms.relaxName = TRUE;
geoEngParms.relaxPostalCode = TRUE;
break;
}
else if (Count == 8)
{
GeoEngFindPostalCentroid(*pGeoEngHandle,
myAddress->postalCode,
myAddress->postalAddOnCode,
&precision,
&location,
&candidate);
}
}
break;
case NO_CANDIDATES:
printf("No Candidates\n");
Mach_Status = 2;
retCode = GeoEngGetCfgParms (*pGeoEngHandle,
&geoEngParms);
if (retCode != SUCCESS)
{
fprintf(stderr, "Error %d reading configuration
parameters\n", retCode);
return FAILURE;
}
else
{
if (Count == 1)
{
geoEngParms.relaxHouseNumber = TRUE;
geoEngParms.relaxName = FALSE;
geoEngParms.relaxPostalCode = FALSE;
break;
}
else if (Count == 2)
{
geoEngParms.relaxHouseNumber = FALSE;
geoEngParms.relaxName = TRUE;
geoEngParms.relaxPostalCode = FALSE;
break;
}
else if (Count == 3)
{
geoEngParms.relaxHouseNumber = FALSE;
geoEngParms.relaxName = FALSE;
geoEngParms.relaxPostalCode = TRUE;
break;
}
else if (Count == 4)
{
geoEngParms.relaxHouseNumber = TRUE;
geoEngParms.relaxName = TRUE;
geoEngParms.relaxPostalCode = FALSE;
break;
}
else if (Count == 5)
{
geoEngParms.relaxHouseNumber = TRUE;
geoEngParms.relaxName = FALSE;
geoEngParms.relaxPostalCode = TRUE;
break;
}
else if (Count == 6)
{
geoEngParms.relaxHouseNumber = FALSE;
geoEngParms.relaxName = TRUE;
geoEngParms.relaxPostalCode = TRUE;
break;
}
else if (Count == 7)
{
geoEngParms.relaxHouseNumber = TRUE;
geoEngParms.relaxName = TRUE;
geoEngParms.relaxPostalCode = TRUE;
break;
}
else if (Count == 8)
{
GeoEngFindPostalCentroid(*pGeoEngHandle,
myAddress->postalCode,
myAddress->postalAddOnCode,
&precision,
&location,
&candidate);
break;
}
}
retCode = GeoEngSetCfgParms(*pGeoEngHandle,
&geoEngParms);
if (retCode != SUCCESS)
{
fprintf(stderr, "Warnnig: Error %d setteng
configuration parameters\n", retCode);
fprintf(stderr, "\tDEFAULT VALUES WILL BE
USED\n");
}
break;
}
return matchStatus;
}
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
