none
Search POI location using QueryAPIManager RRS feed

  • Question

  • We wanted to search POI location using spatial data service QueryAPIManager . I have code as below :

      Microsoft.Maps.loadModule('Microsoft.Maps.SpatialDataService', function () {
                    var queryOptions = {
                        queryUrl: sdsDataSourceUrl,
                        spatialFilter: {
                            spatialFilterType: 'nearby',
                            location: 'New York',
                            radius: 25
                        },
              filter: 'EntityTypeID eq 5540' // Filter to retrieve Gas Stations
                       
                    };

    We get proper data using above code. However  we want to filter 'Gas Stations' or any other location  by it's name instead of EntityTypeID. 

    Thursday, November 3, 2016 8:40 AM

Answers

  • There is limited support for finding things by name in this service. You can search for locations who's Name or DisplayName completely equals a specific text value but that is about it. The NAVTEQ data sources don't support wildcard searches due to their size. Here is an example query:

    • filter: "Name eq 'Shell'"

    I would also recommend using the Filter class rather than string to create your filter as it will properly encode and escape special characters in your string value as needed for OData URL's. Here is a modified version of this query using the Filter class:

    • filter: new Microsoft.Maps.SpatialDataService.Filter('Name', 'eq', 'Shell')

    [Blog] [twitter] [LinkedIn]

    Thursday, November 3, 2016 5:02 PM
  • That's not how you use multiple filters. You can combine them using string of your the FilterGroup class.

    Example, using string:

    filter: "EntityTypeID eq 7011 or Name eq 'Hotel'"

    Example using FilterGroup class:

    Microsoft.Maps.loadModule('Microsoft.Maps.SpatialDataService', function () {
    	//Create local variable for namespace to reduce coding.
    	var sds = Microsoft.Maps.SpatialDataService;
    
    	//Create individual filters.
    	var typeIdFilter = new sds.Filter('EntityTypeID', 'eq', 7011);
    	var nameFilter = new sds.Filter('Name', 'eq', 'Shell');
    
    	var queryOptions = {
    		queryUrl: sdsDataSourceUrl,
    		spatialFilter: {
    			spatialFilterType: 'nearby',
    			location: 'London',
    			radius: 25
    		},
    		//Combine filters into a group and use in your query.
    		filter: new sds.FilterGroup([typeIdFilter, nameFilter], sds.FilterLogicalOperator.or)
    	};
    	
    	//Process the query: getting all hotels with 25km 
    	Microsoft.Maps.SpatialDataService.QueryAPIManager.search(queryOptions, map, function (data) {
    		//code
    	}
    });

    Note that passing in "London" as the location will likely geocode to London, UK which is outside of North America which is the data source used in the sample. You will want to use the NavteqEU data source:

    https://msdn.microsoft.com/en-us/library/hh478193.aspx


    [Blog] [twitter] [LinkedIn]


    Friday, November 4, 2016 9:38 PM
  • 1) If you are filtering the name by "Restaurant" then only POI's that have the name "Restaurant" will be returned. The Bing Maps V7 uses the old legacy SOAP services of POI data. That service is reaching end of life as well.

    2) Yes. The Bing Maps Website uses a lot of additional data sources for POI data which Bing Maps can't expose through the developer API due to data provider restrictions. Some of these data sources include; Yelp, Trip Advisor.

    3) There currently s no data source in the Bing Maps Spatial Data service that provide points of interest in Asia.


    [Blog] [twitter] [LinkedIn]

    Monday, November 7, 2016 5:43 PM

All replies

  • There is limited support for finding things by name in this service. You can search for locations who's Name or DisplayName completely equals a specific text value but that is about it. The NAVTEQ data sources don't support wildcard searches due to their size. Here is an example query:

    • filter: "Name eq 'Shell'"

    I would also recommend using the Filter class rather than string to create your filter as it will properly encode and escape special characters in your string value as needed for OData URL's. Here is a modified version of this query using the Filter class:

    • filter: new Microsoft.Maps.SpatialDataService.Filter('Name', 'eq', 'Shell')

    [Blog] [twitter] [LinkedIn]

    Thursday, November 3, 2016 5:02 PM
  • Thank you for your reply. I tried your solution and it works for USA. However for another location it is not giving any result by filtering as EntityTypeID or Name . I tried below code:

    var sdsDataSourceUrl = 'https://spatial.virtualearth.net/REST/v1/data/f22876ec257b474b82fe2ffcb8393150/NavteqNA/NavteqPOIs';
                // Load the Bing Spatial Data Services module
               Microsoft.Maps.loadModule('Microsoft.Maps.SpatialDataService', function () {
                    var queryOptions = {
                        queryUrl: sdsDataSourceUrl,
                        spatialFilter: {
                            spatialFilterType: 'nearby',
                           location: 'London',
                            radius: 25
                            
                        },
                        filter: 'EntityTypeID eq 7011' //to get hotels OR
                        filter: "Name eq 'Hotel'"  OR
                        filter: new Microsoft.Maps.SpatialDataService.Filter('Name', 'eq', 'Hotel')

                    };
                    //Process the query: getting all hotels with 25km 
                    Microsoft.Maps.SpatialDataService.QueryAPIManager.search(queryOptions, map, function (data) {
                   //code
                     }

    However it is not retriving anything for london location filtering by EntityTypeID or Name. Is there is any other way to get POI locations around specified location by filtering name? And if I am searching it for USA it is returning data but not giving name of POI searched records (Ex. If I searched Bank in Newyork, It is not showing name of bank).
    Friday, November 4, 2016 11:11 AM
  • That's not how you use multiple filters. You can combine them using string of your the FilterGroup class.

    Example, using string:

    filter: "EntityTypeID eq 7011 or Name eq 'Hotel'"

    Example using FilterGroup class:

    Microsoft.Maps.loadModule('Microsoft.Maps.SpatialDataService', function () {
    	//Create local variable for namespace to reduce coding.
    	var sds = Microsoft.Maps.SpatialDataService;
    
    	//Create individual filters.
    	var typeIdFilter = new sds.Filter('EntityTypeID', 'eq', 7011);
    	var nameFilter = new sds.Filter('Name', 'eq', 'Shell');
    
    	var queryOptions = {
    		queryUrl: sdsDataSourceUrl,
    		spatialFilter: {
    			spatialFilterType: 'nearby',
    			location: 'London',
    			radius: 25
    		},
    		//Combine filters into a group and use in your query.
    		filter: new sds.FilterGroup([typeIdFilter, nameFilter], sds.FilterLogicalOperator.or)
    	};
    	
    	//Process the query: getting all hotels with 25km 
    	Microsoft.Maps.SpatialDataService.QueryAPIManager.search(queryOptions, map, function (data) {
    		//code
    	}
    });

    Note that passing in "London" as the location will likely geocode to London, UK which is outside of North America which is the data source used in the sample. You will want to use the NavteqEU data source:

    https://msdn.microsoft.com/en-us/library/hh478193.aspx


    [Blog] [twitter] [LinkedIn]


    Friday, November 4, 2016 9:38 PM
  • Hi, We are facing couple of issues in using Nearby places (POI) in Bing Map v8 SDK:

    1. If we search Restaurants, we’re not getting the names of Restaurants in meta data instead we get only category. We have tried this for couple of other categories like Bank, Coffee shops etc. as shown in the below screenshot:

    Could you please help us in getting the display name. Meta data part was working fine in Bing Map v7 sdk.

    2. Does developer API and Bing Map for end user has different POI database? For Ex., If I search for ‘Restaurants’ with POI location as ‘Boston’ we get different-different results in Bing Map and SDK as shown below two screenshot:

    <o:p></o:p>

    Bing Map V8 SDK:

    <o:p></o:p>

    UsinUsing URL to search poi

    https://spatial.virtualearth.net/REST/v1/data/f22876ec257b474b82fe2ffcb8393150/NavteqEU/NavteqPOIs;   -- For Europe

    https://spatial.virtualearth.net/REST/v1/data/f22876ec257b474b82fe2ffcb8393150/NavteqNA/NavteqPOIs;  -- For North America

    We have checked that these URLs are not working in Asia while in Bing Map v7 user had access to POI location in Asia region also. Are we missing anything from Bing Map V8 sdk?

     We highly appreciated any help on above point. 


    Monday, November 7, 2016 1:54 PM
  • 1) If you are filtering the name by "Restaurant" then only POI's that have the name "Restaurant" will be returned. The Bing Maps V7 uses the old legacy SOAP services of POI data. That service is reaching end of life as well.

    2) Yes. The Bing Maps Website uses a lot of additional data sources for POI data which Bing Maps can't expose through the developer API due to data provider restrictions. Some of these data sources include; Yelp, Trip Advisor.

    3) There currently s no data source in the Bing Maps Spatial Data service that provide points of interest in Asia.


    [Blog] [twitter] [LinkedIn]

    Monday, November 7, 2016 5:43 PM