cpsc
2009-03-25 01:20:43 UTC
I have tried both the GeocodeService and the SearchService to obtain the
lattitude/longitude for a specific city/state. My application does not have
street address or postal code (zipcode), it only has city and state.
When providing a query string such as "Chicago, IL" the GeoCodeService does
not return the proper coordinates for the city. Instead, it attempts to use
the city as a street name and then searches alphabetally through the cities
within the state until it finds a match.
Example: "Chicago, IL" returns Chicago St, Alvin, IL 61811
40.2982629521424,-87.6056455399844
Example source code:
// Set the full address query
geocodeRequest.Query = "Chicago, IL";
// Set the options to accept low confidence results
GeocodeService.ConfidenceFilter[] filters = new
GeocodeService.ConfidenceFilter[1];
filters[0] = new GeocodeService.ConfidenceFilter();
filters[0].MinimumConfidence = GeocodeService.Confidence.Low;
GeocodeService.GeocodeOptions geocodeOptions = new
GeocodeService.GeocodeOptions();
geocodeOptions.Filters = filters;
geocodeRequest.Options = geocodeOptions;
// Make the geocode request
GeocodeService.GeocodeServiceClient geocodeService = new
GeocodeService.GeocodeServiceClient();
geocodeResponse = geocodeService.Geocode(geocodeRequest);
What is the proper way to use the GeocodeService to obtain the lat/long for
a specific city/state?
lattitude/longitude for a specific city/state. My application does not have
street address or postal code (zipcode), it only has city and state.
When providing a query string such as "Chicago, IL" the GeoCodeService does
not return the proper coordinates for the city. Instead, it attempts to use
the city as a street name and then searches alphabetally through the cities
within the state until it finds a match.
Example: "Chicago, IL" returns Chicago St, Alvin, IL 61811
40.2982629521424,-87.6056455399844
Example source code:
// Set the full address query
geocodeRequest.Query = "Chicago, IL";
// Set the options to accept low confidence results
GeocodeService.ConfidenceFilter[] filters = new
GeocodeService.ConfidenceFilter[1];
filters[0] = new GeocodeService.ConfidenceFilter();
filters[0].MinimumConfidence = GeocodeService.Confidence.Low;
GeocodeService.GeocodeOptions geocodeOptions = new
GeocodeService.GeocodeOptions();
geocodeOptions.Filters = filters;
geocodeRequest.Options = geocodeOptions;
// Make the geocode request
GeocodeService.GeocodeServiceClient geocodeService = new
GeocodeService.GeocodeServiceClient();
geocodeResponse = geocodeService.Geocode(geocodeRequest);
What is the proper way to use the GeocodeService to obtain the lat/long for
a specific city/state?