Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bings Maps geocoding control #498

Closed
1 task done
Raruto opened this issue Oct 10, 2023 · 6 comments · Fixed by #505
Closed
1 task done

Bings Maps geocoding control #498

Raruto opened this issue Oct 10, 2023 · 6 comments · Fixed by #505
Assignees
Labels
feature New feature or request
Milestone

Comments

@Raruto
Copy link
Collaborator

Raruto commented Oct 10, 2023

Checklist

  • I've searched through the current issues to make sure this feature hasn't been requested already.

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
Copy link
Collaborator Author

Raruto commented Oct 11, 2023

@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
Copy link
Member

leolami commented Oct 12, 2023

@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
Copy link
Collaborator Author

Raruto commented Oct 12, 2023

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
Copy link
Member

leolami commented Nov 17, 2023

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
Copy link
Member

702 S Jackson St, Seattle, WA

@Raruto It seems return only Local Business activities

@Raruto
Copy link
Collaborator Author

Raruto commented Nov 17, 2023

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 #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:

  • Bing searches are based on the current map map extent (ie. visible portion of the map).
  • Nominam maintains the old ("backwards compatible") behavior of searching on the initial map extent (project extent).

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

Raruto added a commit that referenced this issue Nov 21, 2023
- add folder `src/assets/gecoding-providers`
- extract `bing` into two new providers → `bing_places` and `bing_streets` (ref: #498 (comment))
- new gulp task `geocoding-providers`
Raruto added a commit that referenced this issue Nov 29, 2023
* overall code cleanup + draft provider class: `Bing`

* missing variables

* Misspelling v-placeholder directive. Fix with right v-t-placeholder

* Add comments and remove unused code

* Comment and what TODO

* add `name` and `type`

* comment

* remove helper funcion: `_createElement`

* un-destructure

* clean up query

* move guard condition

* set default options inside geocoding control

* simplify default `options` assignment

* dynamic extent

* remove nested classes (replaced by static: `GeocodingControl.providers`)

* move folder: `src/core/utils/` → `src/utils/`

* todo

* add `provider` attribute

* move class: `OLControl` into `ControlsFactory`

* add `pushin.svg`

* PoC reusable `<context-menu>` component

* watcher

* comments

* first attemp to handle multiple markers on map

* move event listeners into: `MapControlGeocoding.vue`

* make it vue

- move DOM logic within `src\components\MapControlGeocoding.vue`
- remove `src/components/MapControlNominatimResults.vue`

* make use of `v-for` for list rendering

* new function: `GeocodingControl::getExtentForProvider(provider)`

* extract function: `_showResults(results)` + remove `cssClassess`

* styling

* remove unusued options

* unusued variables

* sort css

* move class: `ControlsFactory` into `src/app/gui/map/mapservice.js`

* remove inner factory object

* comments

* bind event value to: `_onItemClick($event, item)`

* update index

* Add @click.stop to avoid to propagate click event.
Fix issue on search coordinates with a specific epsg

* ✨ Add MarkersPanel.vue to show markers result on sidebar

* Delete unused file: `src/app/core/map/mapsregistry.js`

* Remove test MarkesPanel (sidebar panel)

* Handle add remove marker feature on click result item using __uid proerty from search

* Add marker layer to query results

* Add MapControlGeocodingMarkerItem.vue and MapControlGeocodingMarkerItems.vue to show marker information to result content

* Remove console.log

* add space

* Add action to marker layer on query result

* Add reset button markers

* Rename Marker components

* Add MarkersEventBus

* In case of layer.id __g3w_marker (layer use to stor markers) not add action to feature results

* Add button on geoconding control to remove all markers and show marker info on result content. Change css

* Use MarkerResultFeature on QueryResuls.vue component

* Fix pass item.__uid

* Add open (plus) close (minu) marker feature show hide info data

* Add more than one markers action (zoom, remove)

* Add checkbox icon to set add or not marker. Liste vents form MarkerEventBus

* ✨ Edit (add) marker to Point layer

* ✨ Add toggle visibility of marker layer on map

* Fix visibility layer whe non marker are on map after remove

* attempt to get rid of `<marker-result-feature>`

* Chen geometry type of editable layer point and if is MultiPoint convert feature geometry to pass to editing api function

* attempt to dump data using: `QueryResults.vue`

* add showdat if to open close body marker

* move marker result feature component

* jsdoc

* Remove pencil icon tool and leave select for editing

* Fix show at least maxSubsetLength if layer is not __g3w_marker

* pretty print json attributes

* rename variable: `maxSubsetLength` → `MAX_SUBSET_LENGTH`

* code format

* comments

* remove ternary condition

* comments

* ensure boolean return type: `isExternalLayerSelected`

* remove short circuit condition

* draft reusable queryresults

* Add addActionsForLayers

* add `is_results_panel_open`

* create component: `QueryResultsActionChooseLayer.vue`

* Add       queryresults.state.actiontools[QueryResultsActionChooseLayer.name] = queryresults.state.actiontools[QueryResultsActionChooseLayer.name] || {};

* listen for: `removeFeatureLayerFromResult`

* remove commented code

* ♻️ Move feature tools action on top of atrributes. Add new component QueryResultsHeaderFeatureActionBody

* remove `markers-visibility-layer` + move css stuff `g3w-mapcontrols.less`

* Reomve contex menu from Map.vue

* make it scoped

* Fix edit amrker feature

* remove console.log

* add css var: `--skin-color`

* Uncomment toggle marker layer visibility. Handel show hide marker list query result

* css clean up

* code clean up

* Change style

* sticky header

* Fix open close marker results

* attempt to use: `addCurrentActionToolsLayer`

* missing config

* Fix zoom to relation feature whe click on attribute table of alphanumeric layer with a geomety layer relation

* attempt to simplify action registration

* Pass config object to component actiontools

* Disable control during editing

* Clean code

* ♻️ Set action tool configuration

* Clean code

* second attempt with `addCurrentActionToolsLayer`

* Fix in case of iframe, move show/hide sidebar on top

* todo

* formatting

* config label

* decrease border left

* Show edit tools only if there are point geometry layer editable

* Remove spaces

* Add remind to add translation

* Hide selection layer tool button if layer is g3w marker

* Update search_from_bing.js

* attempt to open sidebar panel on open

* workaround for click event listener

* hide interal properties +  include raw data in results

* restore subset for g3w marker

* check for single editable point layer

* sort attributes

* remove margins

* count selected features

* new utils: `flattenObject`

* Add Multipoint to is3DGeometry types

* Fix editing feature creation to pass on addLayerFeature editing api method

* Add condition to not sho editing action onb marker when editing panel is open

* enable/disable buttons on editing

* Handle configuration mapcontrol from server has object (key: neme/type of mapcontrol, value: configuration)

* disable control instead of clearing results

* Set items aligned to center

* comments

* vertical spacing

* wrong guard

* unified common controls factories

* Clean code

* Space

* call queryresultservice removeFeatureLayerFromResult method on clearMarkers

* remove internals

* simplify geoutils calls within `_editItem(layerId, feature)`

* wrong remove item uid

* keep markers results open when

* alias without `raw_` prefix

* replace `raw_` field prefix with provider name

* rename internal prop: `__add` → `__selected`

* add flag: `is_clearing`

* i18n

* replace directive: `v-html` → `v-t`

* add i18n: `mapcontrols.geocoding.nolayers`

* reduce delta

* Fix search autocomplete

* Chnage markers layer style to style function

* Add marker for search in lon lat

* Get configuration geocoding from server and pass it to provider, for example url

* Clean code

* attempt to use computed: `has_providers`

* replace directive: `v-show` → `v-if`

* add some help texts (eng only)

* remove unused child' class

* handle multiple tabs and subtabs color

* wrong merge

* Align skin tabs color base on blue

* increase clickable marker area (pushpin icon)

* Add common less g3w-tabs-form-query file to set common tab css rules

* Change css less color of tabs

* remove `v-else`

* tab group title more contrast between background color e text color

* remove console.log

* attempt to increment contrast

* Set group-title brackground tab

* Fix wrong assignment splice().concat(

* Add comment and remove logicop on filters string when value is single value and not an array

* set options.value instead of options.key to create filter for valuerelation widget

* Add event set-layerzindex to listen when a new layer is add to map and set a zindex

* Listen set-layer-zindex map service event and set marker layer on top

* Clean code

* Clean code

* Set footer map control more dark

* Fix change mouse position map coordinate due refactor

* Scale select map control arrow more dark

* Clean code and add shadow to logo image g3w

* Fix search value map dependency input

* Fix misspelled method

* Add field type bigint

* Show previous field label and values only if layer result has more than one feature. In this case when info is not collapsed, hide header previous fields and values

* Clean code

* Remove tooltip after copy url

* set tooltip width

* Use v-t-tooltip directive to show tooltip on query feature action

* closes: #501

- add folder `src/assets/gecoding-providers`
- extract `bing` into two new providers → `bing_places` and `bing_streets` (ref: #498 (comment))
- new gulp task `geocoding-providers`

* docs

* comments

* mispelling

* add option: `icon`

* replace `(new Error).fileName` → `document.currentScript.src`

* mobile css

* unusued rules

* Remove console.log

* Fix create right filter in case of input.attribute is not an array. Need to add logic operator

* Add formatter 0 based on g3w-suite/g3w-admin#671

* Clean code

* Add reference usage

---------

Co-authored-by: volterra79 <boccacci.francesco@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants