maptiler sdk improve accuracy of search results

52 views Asked by At

I've implemented a map using the MapTiler SDK and Geocoding API for search purposes.

MapTiler SDK

Geocoding API

Geocoding API Reference

Per requirements, I'm only zooming to focus on the top result returned from the search. The problem is that with a number of tests, the best result returned is less than 0.50 relevance and while the map zooms to the general area, the map marker is way off even if an exact address is entered. (See map) Which setting best improves the accuracy of the map search results? I'm passing a street number, street, town, and state with or without zip code.

The value of reqParams is: "key=%mapkey%&address=Roswell+Road+Knoxville+TN+37923&fuzzyMatch=false&limit=1"

MapTiler map example

async updateMapByAddress(): Promise<any> {
    if (this.urlParams != null && this.urlParams != '') {
        
        const reqParams = 'key='+this.mapApiKey+'&'+this.urlParams;
        const results = await mapTiler.geocoding.forward(reqParams);

        if (this.map) {
            const mapSource: mapTiler.GeoJSONSource = this.map.getSource('search-results') as mapTiler.GeoJSONSource;

            if (mapSource.type === 'geojson' && results.features.length > 0) {
                mapSource.setData({
                    type: 'FeatureCollection',
                    features: results.features                
                });
                //move marker, reset center and zoom to map area
                this.marker.setLngLat([results.features[0]['center'][0], results.features[0]['center'][1]]);
                this.map.setCenter([results.features[0]['center'][0], results.features[0]['center'][1]]);
                this.map.setZoom(8);
            }
        }
    }
    return true;
}
0

There are 0 answers