ESRI ArcGIS REST API URL giving me a blank image - rest

I'm trying to use the following URL to export a map image and I'm not getting anything other than a blank image...
http://demographics6.arcgis.com/arcgis/rest/services/USA_Demographics_and_Boundaries_2016/MapServer/export?f=json&format=png&bbox=-82.728110%2C27.719379%2C-82.532320%2C27.816795&size=600,600&token=[my-token]
Any ideas?

Are you constructing this url yourself or is that request coming from a layer added to the map?
After logging in to ArcGIS Online, I was able to use the export endpoint just fine with this url:
http://demographics6.arcgis.com/arcgis/rest/services/USA_Demographics_and_Boundaries_2016/MapServer/export?bbox=-2.601910765504469E7%2C4619421.289780159%2C1199812.3691861853%2C1.6262309438175105E7&size=600%2C600&format=png&f=json
My hunch is you are supplying an invalid bounding box, it looks like it may be in a different spatial reference than the service, the service is expecting web mercator (102100) and looks like you may be giving it geographic (4326)

Related

Standard way to display Bing API Truck Route JSON response on a Bing Map?

I'm successfully calling Bing's Truck Route API (below) to get a JSON response for a route.
https://learn.microsoft.com/en-us/bingmaps/rest-services/routes/calculate-a-truck-route
What's the standard way to get that to show up on a Bing Map? From their documentation here, I can't quite tell.
https://learn.microsoft.com/en-us/bingmaps/rest-services/imagery/get-a-static-map
To display a truck route result on an interactive map in Bing Maps, the easiest option is to leverage the directions module which supports truck routing. The directions module is an integrated part of the interactive map SDK. Here are some examples:
https://www.bing.com/api/maps/sdk/mapcontrol/isdk/directionscreatetruckroute
https://learn.microsoft.com/en-us/bingmaps/v8-web-control/map-control-concepts/directions-module-examples/calculate-driving-directions
If you want to instead directly access the REST routing API and display the results from that on a map, you will need to loop through and extract the route points from the route response, and create a line.

Unable to render OneNote image resource after appending preAuthenticated=true option in OneNote api call

https://github.com/microsoftgraph/microsoft-graph-docs/issues/2624
I am experience the issue as the above.
I am trying to save the content of a page with a reference to an image by calling https://graph.microsoft.com/v1.0/users/{userId}/onenote/pages/{pageId}/content?preAuthenticated=true
Per this - Downloading one note page with image content as HTML
By appending "?preAuthenticated=true" when you do the fetch, it will make the image public.
But when I tried to render the html, it's giving me "Failed to load resource: the server responded with a status of 401 (Unauthorized)".
It appears that something is wrong with the official document: Get OneNote content and structure with Microsoft Graph.
We can see that the service root URL is https://graph.microsoft.com/{version}/{location}/onenote/.
But in any of the samples on this page, the URL is still https://www.onenote.com/api/v1.0/me/notes.
Currently, when you add ?preAuthenticated=true you will get such a URL for a image on this page:
https://graph.microsoft.com/v1.0/users('{userID}')/onenote/resources/{resourceID}/content?publicAuth=true&mimeType=image/png
But when you try to access it in a browser, you will get 401 error Access token is empty.
A workaround is to modify the URL to:
https://www.onenote.com/api/v1.0/resources/{resourceID}/content?publicAuth=true&mimeType=image/png
Then you will get the image.
https://github.com/microsoftgraph/microsoft-graph-docs/pull/4339/files
I think they removed the support for it.
Bit of off topic, but I figured out how to get the image to render.
https://learn.microsoft.com/en-us/graph/api/resource-get?view=graph-rest-1.0&tabs=http
When you call /onenote/pages/{id}/content, the image has a reference to a source like this
src="https://graph.microsoft.com/v1.0/users({userId})/onenote/resources/{resourceId}/$value" along with data-src-type="image/jpeg"
do a get request to this endpoint and you'll the image binary, convert the binary to base64, and then just render the html by replacing the src with base64.

ArcGIS REST API - How to view the geoJSON results?

How do you use the ArcGIS REST API to view the geoJSON results for fires? The URL is https://wildfire.cr.usgs.gov/arcgis/rest/services/geomac_dyn/MapServer/3/ or https://wildfire.cr.usgs.gov/arcgis/rest/services/geomac_dyn/MapServer/3?f=json but it isn't displaying the latest fire perimeter data just the metadata.
ArcGIS REST URL
I figured it out above with the help of the original commentator. usgs.gov/arcgis has a query guide and you just need to know SQL Where commands.
i.e. query?where=active = 'Y'

Adding GeoJSON data to Bing maps api

I'm gettign CORS error while accessing "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson" through Microsoft.Maps.GeoJson.readFromUrl method.
FYR: https://msdn.microsoft.com/en-us/library/mt712806.aspx
Please assist on how to fix it.
I don't believe CORS is setup on the USGS servers. Instead you have to use JSONP. The feeds are documented here: http://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php and they say that the feeds are wrapped with a function called: eqfeed_callback. However, it looks like the URL that they link on their site at the moment are the non-JSONP ones. To correct your issue, simply add a "p" to the end of your URL like this:
http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojsonp
Once you do this, you can then follow this code sample for adding this feed to the Map: http://www.bing.com/api/maps/sdk/mapcontrol/isdk#geoJsonReadExternal+JS

Bing maps: Direct Access to tiles and Api key

i am using Bing map tiles in my Android application. I download tiles from http://h0.ortho.tiles.virtualearth.net/tiles/h<quadkey>.jpeg?g=131 and it works fine, but i understand that i need to append a token to this URL in order to make this operation legal (and ask some kind of special permission from Microsoft). It is all well explained here: http://blogs.msdn.com/b/virtualearth/archive/2008/04/29/tracking-virtual-earth-tile-usage.aspx. But this post is from 2008 and i found on msdn site that in 2012, token-auth system will be replaced with key auth system.
Does anybody know how can i perform the direct tile access with this new auth system?
Thanks in advance
Accessing tiles directly with key-based authentication can be accomplished like so:
Using the REST ‘Get Imagery Metadata’ service to obtain the tile URL format for the type of tiles you wish to display:
http://msdn.microsoft.com/en-us/library/ff701716.aspx
- For example, if you wish to display Road tiles, the following request could be used (taken from the above documentation): http://dev.virtualearth.net/REST/V1/Imagery/Metadata/Road?mapVersion=v1&output=xml&key=BingMapsKey
Within the response, the URL for tiles is returned, with a placeholder for the tile quadkey.
A new REST request should be issued each time the map viewer in the application is instantiated, or whenever the map type is changed (eg. You wish to switch to aerial or hybrid map style)
Your platform usage can then be tracked based on the calls to the REST service.