Get Embed html code for bing map based on dynamic address - bing-api

How to get the Bing maps embed html code based on dynamic address. In my page i have a city and state based on the i need to show the embed map in a page.

In order to do this, you will have several options including embedded maps, using interactive controls or even static imagery service.
Embedded Maps:
Based on your feedback, the simplest way to achieve what you want to do is for you to use the embedded maps, you will find options on the MSDN:
http://msdn.microsoft.com/en-us/library/ee692180.aspx
You can also think at using the Bing Maps website and configure the behavior of the portal using extra parameters:
http://msdn.microsoft.com/en-us/library/dn217138.aspx
Static imagery map
If you just want to display a static map (image) with a pushpin at the specific location, see the REST Imagery service here:
http://msdn.microsoft.com/en-us/library/ff701724.aspx
Sample url: http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/Bellevue%20Washington?mapLayer=TrafficFlow&key=BingMapsKey
Interactive map using AJAX v7
You can find everything you need to implement your own interactive map using JavaScript on your page:
http://msdn.microsoft.com/en-us/library/gg427610.aspx

Related

How to download the content of the web page to Google sheet, using importxml [duplicate]

I am trying to import data from the following website to Google Sheets. I want to import all the matches for the day.
https://www.tournamentsoftware.com/tournament/b731fdcd-a0c8-4558-9344-2a14c267ee8b/Matches
I have tried importxml and importhtml, but it seems this does not work as the website uses JavaScript. I have also tried to use Apipheny without any success.
When using Apipheny, the error message is
'Failed to fetch data - please verify your API Request: {DNS error'
Tl;Dr
Adapted from my answer to How to know if Google Sheets IMPORTDATA, IMPORTFEED, IMPORTHTML or IMPORTXML functions are able to get data from a resource hosted on a website? (also posted by me)
Please spend some time learning how to use the browsers developers tools so you will be able to identify
if the data is already included in source code of the webpage as JSON / literal JavaScript object or in another form
if the webpage is doing a GET or POST requests to retrieve the data and when those requests are done (i.e. as some point of the page parsing, or on event)
if the requests require data from cookies
Brief guide about how to use the web browser to find useful details about the webpage / data to import
Open the source code and look if the required data is included. Sometimes the data is included as JSON and added to the DOM using JavaScript. In this case it might be possible to retrieve the data by using the Google Sheets functions or URL Fetch Service from Google Apps Script.
Let say that you use Chrome. Open the Dev Tools, then look at the Elements tab. There you will see the DOM. It might be helpful to identify if the data that you want to import besides being on visible elements is included in hidden / not visible elements like <script> tags.
Look at Source, there you might be able to see the JavaScript code. It might include the data that you want to import as JavaScript object (commonly referred as JSON).
There are a lot of questions about google-sheets +web-scraping that mentions problems using importhtml and/or importxml that already have answers and even many include code (JavaScript snippets, Google Apps Script functions, etc.) that might save you to have to use an specialized web-scraping tool that has a more stepped learning curve. At the bottom of this answer there is a list of questions about using Google Sheets built-in functions, including annotations of the workaround proposed.
On Is there a way to get a single response from a text/event-stream without using event listeners? ask about using EventSource. While this can't be used on server side code, the answer show how to use the HtmlService to use it on client-side code and retrieve the result to Google Sheets.
As you already realized, the Google Sheets built-in functions importhtml(), importxml(), importdata() and importfeed() only work with static pages that do not require signing in or other forms of authentication.
When the content of a public page is created dynamically by using JavaScript, it cannot be accessed with those functions, by the other hand the website's webmaster may also purposefully have prevented web scraping.
How to identify if content is added dynamically
To check if the content is added dynamically, using Chrome,
Open the URL of the source data.
Press F12 to open Chrome Developer Tools
Press Control+Shift+P to open the Command Menu.
Start typing javascript, select Disable JavaScript, and then press Enter to run the command. JavaScript is now disabled.
JavaScript will remain disabled in this tab so long as you have DevTools open.
Reload the page to see if the content that you want to import is shown, if it's shown it could be imported by using Google Sheets built-in functions, otherwise it's not possible but might be possible by using other means for doing web scraping.
According to Wikipedia,
Web scraping, web harvesting, or web data extraction is data scraping used for extracting data from websites.
Use of robots.txt to block Web crawlers
The webmasters could use robots.txt file to block access to website. In such case the result will be #N/A Could not fetch URL.
Use of User agent
The webpage could be designed to return a special a custom message instead of the data.
Below there are more details about how Google Sheets built-in "web-scraping" functions works
IMPORTDATA, IMPORTFEED, IMPORTHTML and IMPORTXML are able to get content from resources hosted on websites that are:
Publicly available. This means that the resource doesn't require authorization / to be logged in into any service to access it.
The content is "static". This mean that if you open the resource using the view source code option of modern web browsers it will be displayed as plain text.
NOTE: The Chrome's Inspect tool shows the parsed DOM; in other works the actual structure/content of the web page which could be dynamically modified by JavaScript code or browser extensions/plugins.
The content has the appropriated structure.
IMPORTDATA works with structured content as csv or tsv doesn't matter of the file extension of the resource.
IMPORTFEED works with marked up content as ATOM/RSS
IMPORTHTML works with marked up content as HTML that includes properly markedup list or tables.
IMPORTXML works with marked up content as XML or any of its variants like XHTML.
The content doesn't exceeds the maximum size. Google haven't disclosed this limit but the below error will be shown when the content exceeds the maximum size:
Resource at url contents exceeded maximum size.
Google servers are not blocked by means of robots.txt or the user agent.
On W3C Markup Validator there are several tools to checkout is the resources had been properly marked up.
Regarding CSV check out Are there known services to validate CSV files
It's worth to note that the spreadsheet
should have enough room for the imported content; Google Sheets has a 10 million cell limit by spreadsheet, according to this post a columns limit of 18278, and a 50 thousand characters as cell content even as a value or formula.
it doesn't handle well large in-cell content; the "limit" depends on the user screen size and resolution as now it's possible to zoom in/out.
References
https://developers.google.com/web/tools/chrome-devtools/javascript/disable
https://en.wikipedia.org/wiki/Web_scraping
Related
Using Google Apps Script to scrape Dynamic Web Pages
Scraping data from website using vba
Block Website Scraping by Google Docs
Is there a way to get a single response from a text/event-stream without using event listeners?
Software Recommendations
Web scraping tool/software available for free?
Recommendations for web scraping tools that require minimal installation
Web Applications
The following question is about a different result, #N/A Could not fetch URL
Inability to use IMPORTHTML in Google sheets
Similar questions
Some of this questions might be closed as duplicate of this one
Importing javascript table into Google Docs spreadsheet
Importxml Imported Content Empty
scrape table using google app scripts
One answer includes Google Apps Script code using the URL Fetch Service
Capture element using ImportXML with XPath
How to import Javascript tables into Google spreadsheet?
Scrape the current share price data from the ASX
One of the answers includes Google Apps Script code to get data from a JSON source
Guidance on webscraping using Google Sheets
How to Scrape data from Indiegogo.com in google sheets via IMPORTXML formula
Why importxml and importhtml not working here?
Google Sheet use Importxml error could not fetch url
One answer includes Google Apps Script code using the URL Fetch Service
Google Sheets - Pull Data for investment portfolio
Extracting value from API/Webpage
IMPORTXML shows an error while scraping data from website
One answer shows the xhr request found using browser developer tools
Replacing =ImportHTML with URLFetchApp
One answer includes Google Apps Script code using the URL Fetch Service
How to use IMPORTXML to import hidden div tag?
Google Sheet Web-scraping ImportXml Xpath on Yahoo Finance doesn't works with french stock
One of the answers includes Google Apps Script code to get data from a JSON source. As of January 4th 2023, it's not longer working, very likely because Yahoo! Finance is now encrying the JSON. See the Tainake's answer to How to pull Yahoo Finance Historical Price Data from its Object with Google Apps Script? for script using Crypto.js to handle this.
How to fetch data which is loaded by the ajax (asynchronous) method after the web page has already been loaded using apps script?
One answer suggest to read the data from the server instead of scraping from a webpage.
Using ImportXML to pull data
Extracting data from web page using Cheerio Library
One answer suggest the use of an API and Google Apps Script
ImportXML is good for basic tasks, but it won't get you too far if you are serious in scraping:
The approach only works with the most basic websites (no SPAs rendered in browsers can be scraped this way. Any basic web scraping protection or connectivity issue breaks the process, and there isn't any control over HTTP request geo location, or number of retries) - and Yahoo Finance is not a simple website
If the target website data requires some cleanup post-processing, it's getting very complicated since you are now "programming with Excel formulas", rather a painful process compared to regular code writing in conventional programming languages
There isn't any proper launch and cache control, so the function can be triggered occasionally and if the HTTP request fails, cells will be populated with ERR! values
I recommend using proper tools (automation framework and scraping engine which can render JavaScript-powered websites) and use Google Sheets just for basic storage purposes:
https://youtu.be/uBC752CWTew (Pipedream for automation and ScrapeNinja engine for scraping)

Microsoft translator widget not translating contents loaded dynamically(e.g. using ajax call)

We are trying to understand different language translation options for our mvc application.
We checked how Microsoft translator widget working. As per their document, we have added embedded script to our pages. It loaded translate button. it is translating content to selected language. But then after if any content loaded dynamically (e.g. making ajax call and loaded some partials in the page), it is not automatically convert to language. We need to again reset and re-select the language to convert again.
Note: In case of google translate widget, they are converting automatically all dynamic content after loading them.
We want same functionality using Microsoft translator widget. Is there any way to achieve this functionality?
Yes there is, Microsoft no longer supports the Translator widget and the available solution is to integrate the Translator Text API in your website or application. To do this you will need to subscribe to the Microsoft Translator Text API. Visit the Getting Started page at http://www.aka.ms/TranslatorGettingStarted and you will find the steps.

How to add map to a custom entity in MSCRM 2015 and how to plot multiple locations on it?

How to add map to a custom entity in MSCRM 2015 and how to plot multiple locations on it ?
It would be helpful to know more details about your situation, what you're trying to accomplish, what mapping tool you're trying to use. Without that the best I can do is offer some basic suggestions...
Making the assumption that you're going to use the Bing maps ajax control, you can put a map on a custom entity's form using a html web resource in combination with some javascript to manage the map control. Here is the Bing maps interactive SDK where you can play around with some different features of the map control to plot points, etc. And here is the Bing Maps MSDN area where you can get into the details on how to use the control.
To put some points on the map, assuming the data you want to use is related to the entity record/form currently open, you can use the javascript provided as part of the CRM SDK to retrieve data directly off the form or current record, or do some ajax calls to the CRM OData endpoint to retrieve the necessary data and finally plot that data on the map.

How to create propertyPage having crossbar plus video-decoder in directshow

I'm new to directshow to show capturing device video. I need to have video decoder (NTSC/PAL) and CrossBar tabs on a single propertPage dialog (see image).
I'm able to show propertyPage separately but I want both in one dialog, as in the image.
In my attempts I was able to get tabs on a page but not getting any inputPin and outputPins in the crossbar tab. I could not get them all to work together. If I manage to get crossbar to work, then the rest of the tabs crash on click???
Please guide me on how to have multiple propertyPages tabs on the same dialog. I'm working in vs2010. Code sample in C++ or .net will be appreciated. Thanks a lot !!!
This is a screenshot of standard property page, such as popped up with OleCreatePropertyFrame API for specific filter. It is using standard APIs to read and write settings for given COM object (DirectShow filter).
To put the settings onto one page, you can create your own property page, or other UI which talks programmatically to the filter and calls the respective methods via IAMCrossbar and IAMTVTuner interfaces.
You won't be able to replace existing property pages for existing (not yours) filter, for use with OleCreatePropertyFrame API, but other conbinations are doable:
custom property page for your filter, with/without OleCreatePropertyFrame API
custom property page for existing filter, without OleCreatePropertyFrame API
custom UI for existing filter
UPD. Another thing is that some standard pages might be filter specific, and other might be pin specific. Standard API shows pages for one object only, that is either filter or pin. In order to combine pages within one sheet, with standard API, you need to enumerate property pages on all objects, merge into single array, then create a fake COM object which forwards IUnknown::QueryInterface calls to specific COM objects (or just iterate through through array until you find first one implementing requested interface) and then use OleCreatePropertyFrame API against this proxy COM object. This can gather pages under one sheet/dialog.

How to create or modify the google maps controls?s

I wonder how sites like trulia.com and fotocasa.com customized the google maps ui for their website
ex1:
http://www.trulia.com/for_sale/Pinecrest,FL/x_map/#for_sale/Pinecrest,FL/x_map/2_p/
They created custom controls for their maps (think custom html elements overlayed on the map), which is explained with examples in the Google Maps API v3 (click here).

Resources