I've been trying to fill a google spreadsheet column with static satellite maps giving the coords from latitude and longitude columns.
Something like this:
=IMAGE("https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/"&K1&","&J1&",14.25,0,60/600x600?access_token=API_KEY")
My problem is constructing the API call using Lat, long pairs stored in the Google Sheet cells.
I am getting a range of errors from both Google sheets and mapbox, so obviously my syntax within sheets is bad. When I type the url in a browser, with hard-coded lat,lng the correct map image is displayed.
A typical Google error is
Function ADD parameter 1 expects number values. But
'https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/' is a
text and cannot be coerced to a number
Can someone please assist?
I think you had Lat, long wrong way around. Some mapping systems require Lat, Lng and others Lng, Lat (go figure!)
If you change as below, you will get an image, but you may need to play with other parameters to get it working as you need.
=IMAGE("https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/"&K3&","&J3&",14.25,0,60/600x600?access_token=API_KEY")
You can also use the form below which is another way to construct the API string from the component parts.
=image(concatenate("https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/",K3,",",J3,",14.25,0,60/600x600?access_token=ACCESS_KEY"))
In both cases, the parameters after the Coordinates represent the desired zoom, orientation angles and image resolution. You can play around with image formats here https://www.mapbox.com/help/static-api-playground/.
Also note that you have options in Google sheets to adjust how the image is displayed (resize, stretch etc) in the cell, using the IMAGE parameters. This is explained here https://support.google.com/docs/answer/3093333?hl=en
Related
I'm sorry this is probably a very basic issue, but I just can't seem to figure it out.
I wanted to map some data using D3.js and the map shape I wanted to use is provided by the UK's Office for National Statistics. I managed to get their geojson data to display, but as soon as I try to do anything with scaling, transforms, topojson, I've been a complete failure.
I've been through many, many, different approaches and I think it's something about the map data that is causing the issue. If I open the shape files in Mapshaper it looks perfect. If I export as geo or topojson and re-import, it looks perfect. If I try to run geo2svg on the geojson export it produces a lot of data, but nothing visible. If I try to import the original shape file into mapstarter.com it produces a flat line. And if I put the topojson into the D3 v4 bounding example I end up with a load of random triangles.
So, can someone show me how do you get ONS mapping data such as http://geoportal.statistics.gov.uk/datasets/1bc1e6a77cdd4b3a9a0458b64af1ade4_3 to display in a d3 example such as https://bl.ocks.org/iamkevinv/0a24e9126cd2fa6b283c6f2d774b69a2?
Thanks
The data that you have linked to is projected. Mapshaper supports projected data, but using d3.geoProjection with projected data will result in no data being displayed in most situations. You need to ensure your data is in lat long pairs for proper display with a d3.geoProjection.
Luckily, in Mapshaper you can reproject your data. Copy all the files of the shapefile into mapshaper, and in the console change the projection to wgs84 (unprojecting your data):
proj wgs84
This data is now easily displayed and manipulated using a d3.geoProjection. Here is an example using the data that you referenced. Also a screenshot:
Lastly: It is possible to display projected data as well, but this is much less common.
I am currently trying to adapt an excel dashboard I created a few years back into spotfire. The data previously fit onto one page, but this year the number of metrics has doubled and I thought it would be a good opportunity to try spotfire.
The current dashboard has a number of scatter plot charts showing the values from a range of cells (rank 1-5). Overlaid is another scatter plot that shows the groups results.
I have found it easy enough to run the scatter plot in Excel based on a range of data, but as of right now I am stumped on how to choose a range of values for my spotfire scatters.
Here is an example (in excel) of what I am trying to accomplish. The data example is how my data is currently setup.
Would you have any tips on how I may be able to produce a similar chart in Spotfire?
You can create a Document.Properties with all the values you want. Then create a slider in a text area with this document properties. You will be able to select a range of values with this slider.
To use your range in a scatter plot, on the axis you want, right click and custom expression then write something like $(my_docproperty).
Hope it will a solution to your problem !
So I need to create the map of my country from the coordinates I have so that I can plot some xyz data on it.
I was able to plot the map with the help of Mike Bostock tut http://bost.ocks.org/mike/map/
But when I went through the .json file, the coordinates mentioned are totally different from the coordinates I have. Like Patna(India) has [5812,6567] as coordinates in the json file while actual coordinates are [25,85].
Could anybody guide me how can I use the coordinates with me to plot the map and then display some data on it??
EDIT:
With the help from #user1614080, I was able to understand how coordinates are converted into screen coordinates.
The issue I have is: I want the map of India in a certain way. For that purpose, I would like to use the list of latitude & longitude I have. But I dont know how to convert these lat-longs into topojson/geojson format.
For the time being I did a simple line plot with the lat-long I had. Some of the values from the coordinates.csv I used for the line plot are:
Longitude,Latitude
88.75,21.58
88.33,21.50
88.17,22.08
88.00,21.75
87.58,21.58
87.08,21.42
But I would like to use topojson/geojson for the same. how can I convert the data from "coordinates.csv" into json?
I've created a Google Spreadsheet with logo images in one column of cells, but when I try to create a table to add into my website the images do not display in the table.
I need them to display so The logos are visible within a webpage? Does anyone know why the images are not displaying in table format, or how I can fix this.
Not sure which method did you choose to display images. My solution worked for images embedded with the IMAGE function and not showing inside the new spreadsheets, but showing inside the old. I must admit I haven't tested it with embedded documents but it should work too:
SPACE character is an offending character in the new Google spreadsheets when embedding images using the IMAGE function. Replace it with another, 'safe' character like '-' or '_'
Not sure how much this helps, since I don't know what you did/did wrong, but here's a pasted table with images from the new Google Sheets. The only thing of note is that in the pasted table, all images scale to the cell size with aspect ratios retained, ignoring the parameters in the spreadsheet.
formula: =IMAGE("https://www.google.com/images/srpr/logo3w.png")
copy/pasted into document:
original spreadsheet:
I have a few questions regarding his calendar view of mine
http://bl.ocks.org/mhska/5333055
data ranges from 1 to 4317 so the colours are not very "evenly" distributed. is there any way to improve it? (i mean basically everything below 100 is just one red colour)
is there a way to change the date format when you hover over the field from yyy-mm-dd to dd-mm-yyyy?
how could one change the colour of fields with no data? (generally this means weekends)
at the moment the fileds with no data and with most data (over 1000) are of the same colour.
thanks a bunch.
You can change the date format that is displayed by adapting the line
date = d3.time.format("%Y-%m-%d")
More information on the specifiers can be found in the documentation.
For changing the colour, you need to provide a different function for mapping values to colours. It looks like you're currently mapping your input values to only 40 output colours.
.range(d3.range([40]))
Increasing this number might be a good starting point. Note that you can provide an arbitrary function, in particular you could handle missing values separately in it.