g3w-suite / g3w-client

Map viewer addon for G3W-SUITE
https://g3w-suite.readthedocs.io/en/latest/g3wsuite_client.html
Mozilla Public License 2.0
21 stars 17 forks source link

Bings Maps geocoding control #498

Closed Raruto closed 11 months ago

Raruto commented 1 year ago

Checklist

Motivation

As per 2020's Google Maps Terms,

it is no longer allowed to use google maps in custom applications (eg. Open Layers)

(e) No Use With Non-Google Maps. To avoid quality issues and/or brand confusion, Customer will not use the Google Maps Core Services with or near a non-Google Map in a Customer Application. For example, Customer will not (i) display or use Places content on a non-Google map, (ii) display Street View imagery and non-Google maps on the same screen, or (iii) link a Google Map to non-Google Maps content or a non-Google map.

Suggested solution

  1. Deprecate Google Geocoding provider (ref: #131)
  2. Add support to Bing Locations API
  3. Allow the end user to inspect the resulting geocoded markers (similar to bing.com/maps search results)

image

image

Alternatives considered

Bing Maps

Section 4. Use of the Services.

(g) You may use geocodes with third-party maps.

Section 5. General Restrictions.

(g) Use of the Content may not be used in combination with any open source software or other data subject to an open source license that may impair the copyright protection of the Content.

(k) Redistribute, resell, or sublicense access to any Microsoft service or Content;

(m) Circumvent or bypass transaction limits by any means or in any manner, including by creating multiple accounts;

(r) Integrate road maps from the Services with third-party roadmaps;

(s) Display any Service results, except geocodes, on third-party maps;

(t) Replace imagery from the Services with imagery supplied by any other mapping platform. Notwithstanding the foregoing, you may overlay aerial imagery that you have the rights to use, provided that such imagery does not substantially replace the base aerial imagery provided by the Services. You may incorporate various data layers of types not available through the Services, in the Applications (for example, demographic or school location data); or

Arcgis

Is OpenLayers a supported API?

Yes, OpenLayers is a supported API that you can use to build applications with ArcGIS location services.

Which ArcGIS services can I access with OpenLayers?

You can access other services such as the geocoding service, routing service, and GeoEnrichment service by using ArcGIS REST JS.

What type of account do I need to access ArcGIS location services?

You need either an ArcGIS Developer account or ArcGIS Online account. This will give you the ability to access the developer dashboard, create API keys, set up OAuth 2.0, and manage your data.

Raruto commented 1 year ago

@leolami

Presently, the Local Search API supports business entities only in the US. https://learn.microsoft.com/en-us/bingmaps/rest-services/locations/local-search

image

As an alternative, I'm studying what can be done using the Overpass Turbo API, which queries OpenStreetMap data and requires no additional licenses / keys), eg: 👉 https://overpass-turbo.eu/s/1BKA

👋 Raruto

leolami commented 1 year ago

@Raruto

I fear that OSM's database is not advanced enough to replace that of Bing or Google

The customer is interested in commercial activities and I believe that the data on OSM is not that rich

I would ask you to wait for a customer evaluation before delving into Overpass Turbo API

Raruto commented 1 year ago

wait for a customer evaluation before delving into Overpass Turbo API

@leolami Ok.

Although they are not currently displayed in the search results, the Nominam API can also return desired data (eg. name and type of POI, and others depending on the amount of information available on OSM).

image

However, in the latter case, it should be noted that there is maximum number of 40 results per request (ie. with no "pagination", which may cause annoyance at lower zoom levels):

Limit the maximum number of returned results. Cannot be more than 40. Nominatim may decide to return less results than given, if additional results do not sufficiently match the query.

Related info:

leolami commented 11 months ago

Hi @Raruto ,

I did some tests with Galt which reports the following example cases of errors:

If I type the location name Lumen Field, Bing and Nominatim locate the stadium in the map extent, but if I type the address: 702 S Jackson St, Seattle, WA which is also in the extent Nominatim finds it, but not Bing.

If I text on the Bing online map the search works.

Also, is there a way to only find addresses within a certain distance of the current extent, such as 100km, to reduce false matches that take you far from your current area of ​​interest?

I thought that in this regard we said that the search had to work only on the displayed area, can you verify?

https://dev.g3wsuite.it/it/map/iim/qdjango/234/

Thanks

volterra79 commented 11 months ago

702 S Jackson St, Seattle, WA

@Raruto It seems return only Local Business activities

Raruto commented 11 months ago

if I type the location name Lumen Field, Bing and Nominatim locate the stadium in the map extent, but if I type the address: 702 S Jackson St, Seattle, WA which is also in the extent Nominatim finds it, but not Bing. If I text on the Bing online map the search works.

@leolami bing provides two different APIs, it cannot be done with a single call:

Bing Local Search (implemented in https://github.com/g3w-suite/g3w-client/pull/505)

The Bing Maps Local Search API returns a list of business entities centered around a location or a geographic region. Local Search requests are made by either specifying a list of type string IDs (e.g. "EatDrink") or a query (e.g. "Deep Dish Pizza"), and by specifying either the user's location or a geographical region. Aside from a point, two geographic regions are supported: a bounding box of coordinates or a circular region specified by a radius and a center point.

Note: Presently, the Local Search API supports business entities only in the US.

Bing Location by Query

Use the following URL templates to get latitude and longitude coordinates that correspond to location information provided as a query string. The strings "Space Needle" (a landmark) and "1 Microsoft Way Redmond WA" (an address) are examples of query strings with location information. These strings can be specified as a structured URL parameter or as a query parameter value. This URL template can be used to geocode information from any country/region. For more accurate results, use User Context Parameters, such as the coordinates of a user’s current location.

When you make a request by using one of the following URL templates, the response returns one or more Location resources that contain location information associated with the URL parameter values. The location information for each resource includes latitude and longitude coordinates, the type of location, and the geographical area that contains the location. For more information about the Location resource, see Location Data. You can also view the example URL and response values in the Examples section.


is there a way to only find addresses within a certain distance of the current extent, such as 100km, to reduce false matches that take you far from your current area of ​​interest? I thought that in this regard we said that the search had to work only on the displayed area, can you verify?

Currently the two providers work in a different way:

In future releases, to avoid further confusion, I would consider leave the end user free to decide which behavior is best suited to them (eg. a checkbox like "include searches only from current map extent"):

image

👋 Raruto