Upload or update weekly records

Hi,

I have build: BVB Worldmap by nicovadoy · MapHub which is a map around information about a football club.
For that I would like to build a new feature, why I can show for each matchday, where the matches of the club are shown for each country.
The information I want to display is something like this:
Austria: Sky Sport Bundesliga 1, Sky Go [Sat, 16.Jan.2021 15:30]

The issue is, that these countries and stations change from match to match. I can build a spreadsheet that contains all the code for the new matchday, but I am uncertain about some parts of the GeoJSON.

Idealy what I want is to download the current GeoJSON file from the map, paste my code for the current matchday, right below it, save the file and upload it again.

But I don’t think I can add it to the end of the file, can I?

here is how a new record could look like
{"type": "Feature", "id": 2143095766, "geometry": {"type": "Point", "coordinates": [-64.967282, -34.996496]}, "properties": {"title": "Argentina BVB vs Mainz", "description": "- Argentina: OneFootball App ^Sat, 16.Jan.2021 11:30", "group": 759738657, "marker-symbol": "cinema"}}],

questions:

  • id , is that a random ID, if I create new records, I don’t know these before. Do I need to?

To make it even easier, would it be possible to upload 2 files to the map? Would they overwrite or add after each other?

if you have any other suggestion on how to do this, please let me know.
I created a testing ground table here: https://maphub.net/nicovadoy/testingground

Arg, I saw already an error.
The first "Feature part is from another object. So I only need this:
{"type": "Point", "coordinates": [-64.967282, -34.996496]}, "properties": {"title": "Argentina BVB vs Mainz", "description": "- Argentina: OneFootball App ^Sat, 16.Jan.2021 11:30", "group": 759738657, "marker-symbol": "cinema"}}],

Hi Nico,

MapHub has an (currently very limited) API which allows you do to things by programming. Do you have some basic Python knowledge? Here is a small example about how to use the API: Append map · GitBook

For the random ID, you can generate any random number, but you can leave it empty.

I hope the API works for you, if it doesn’t, please share it here.

Zsolt

1 Like

I think it could be possible to just create the matchday records and upload this one separately into the map. These items will be placed at the bottom and I could just move them by drag and drop and remove easily / delete these records, once the matchday is over. I will test a bit around.

Now they’ll be added at the bottom, and then you and move them around. If you want 100% customization, it’ll be possible with the “replace_map” endpoint.

Hi @hyperknot ,

I want to take this up again. What I want to do, is to my BVB Map (BVB Worldmap by nicovadoy · MapHub), that for each match day I show the countries that broadcast the next match and what TV channel this is going on.
So, my source file is a google sheets file, where I basically have the country name and the broadcasting info:
for example:
Germany
Bundesliga #34: Borussia Dortmund vs. Bayer 04 Leverkusen
Germany: Sky Ticket, Sky Go, Sky Sport Bundesliga 6, Sky Sport Bundesliga 1
[Sat, 22.May.2021 15:30]

My plan is to place a placeholder pin for each country in the world.
for example for Germany, the GeoJSON would look like this:
{“type”: “Point”, “coordinates”: [10.423447, 51.08342]}, “properties”: {“title”: “:tv: Germany”, “description”: “No broadcasting available”}},

I then want copy the whole GeoJSON to my google sheets page, match the countries, and fill the “no broadcasting available” with the correct TV Stations.
This part I kind of got working, but when I create the GeoJSON to upload, I get the error message:
Problem with Importing GeoJSON
The uploaded file is not valid for GeoJSON.

I found some issue with double quotation marks, but I think I fixed this.

I am testing here: https://maphub.net/nicovadoy/testingground
The sourcefile GeoJSON contains:
{"type": "FeatureCollection", "features": [{"type": "Feature", "id": 564675079, "geometry": {"type": "Point", "coordinates": [10.423447, 51.08342]}, "properties": {"title": "📺 Germany", "description": "No broadcasting available"}}, {"type": "Feature", "id": 3398532725, "geometry": {"type": "Point", "coordinates": [9.099972, 60.500021]}, "properties": {"title": "📺 Norway", "description": "No broadcasting available"}}, {"type": "Feature", "id": 3866977156, "geometry": {"type": "Point", "coordinates": [14.520858, 59.674971]}, "properties": {"title": "📺 Sweden", "description": "No broadcasting available"}}, {"type": "Feature", "id": 2620404777, "geometry": {"type": "Point", "coordinates": [1.888334, 46.603354]}, "properties": {"title": "📺 France", "description": "No broadcasting available"}}, {"type": "Feature", "id": 890825126, "geometry": {"type": "Point", "coordinates": [-4.837979, 39.326068]}, "properties": {"title": "📺 Spain", "description": "No broadcasting available"}}, {"type": "Feature", "id": 4161780646, "geometry": {"type": "Point", "coordinates": [141.645938, -83.467247]}, "properties": {"title": "EOF", "description": "End_of_File", "marker-color": "#f1f3f6"}}], "groups": [{"title": "Broadcasting", "id": 3409780192}], "markers": [{"id": "ayoqlk5sjmnsab2e"}, {"id": "gbqnn8hc7qsorlgr"}, {"id": "uduqkcw1v6ldlvfi"}, {"id": "xunw6rshdedekxpg"}, {"id": "nwxc3x381xxv29wq"}, {"id": "0bvcbjxtb8jwayli"}, {"id": "6ib1jqjtrieqvgiu"}, {"id": "lbn1ejilp1y9aslc"}, {"id": "fzixqvm1ofsiya8y"}, {"id": "tpxrylqlxcnr26hb"}, {"id": "tr4c1pq2kghwydfc"}, {"id": "wm0dhzwqdlzjuhaf"}], "properties": {}, "export": {"title": "testingground", "description": "", "basemap": "maphub-classic"}}

And this is the GeoJSON I produced that I want to upload:
{"type": "FeatureCollection", "features": [ "{"type": "Feature", "id": 564675079, "geometry": {"type": "Point", "coordinates": [10.423447, 51.08342]}, "properties": {"title": "📺 Germany", "description": "Bundesliga #34: Borussia Dortmund vs. Bayer 04 Leverkusen Germany: Sky Ticket, Sky Go, Sky Sport Bundesliga 6, Sky Sport Bundesliga 1 [Sat, 22.May.2021 15:30]"}}, {"type": "Feature", "id": 3398532725, "geometry": {"type": "Point", "coordinates": [9.099972, 60.500021]}, "properties": {"title": "📺 Norway", "description": "Bundesliga #34: Borussia Dortmund vs. Bayer 04 Leverkusen Norway: Viaplay Norway, V Sport 1 [Sat, 22.May.2021 15:30]"}}, {"type": "Feature", "id": 3866977156, "geometry": {"type": "Point", "coordinates": [14.520858, 59.674971]}, "properties": {"title": "📺 Sweden", "description": "Bundesliga #34: Borussia Dortmund vs. Bayer 04 Leverkusen Sweden: Viaplay Sweden, V Sport Premium [Sat, 22.May.2021 15:30]"}}, {"type": "Feature", "id": 2620404777, "geometry": {"type": "Point", "coordinates": [1.888334, 46.603354]}, "properties": {"title": "📺 France", "description": "Bundesliga #34: Borussia Dortmund vs. Bayer 04 Leverkusen France: beIN SPORTS CONNECT, Free, beIN Sports MAX 5 [Sat, 22.May.2021 15:30]"}}, {"type": "Feature", "id": 890825126, "geometry": {"type": "Point", "coordinates": [-4.837979, 39.326068]}, "properties": {"title": "📺 Spain", "description": "Bundesliga #34: Borussia Dortmund vs. Bayer 04 Leverkusen Spain: Movistar+, Movistar Liga de Campeones 4 [Sat, 22.May.2021 15:30]"}}," {"type": "Feature", "id": 4161780646, "geometry": {"type": "Point", "coordinates": [141.645938, -83.467247]}, "properties": {"title": "EOF", "description": "End_of_File", "marker-color": "#f1f3f6"}}], "groups": [{"title": "Broadcasting", "id": 3409780192}], "markers": [{"id": "ayoqlk5sjmnsab2e"}, {"id": "gbqnn8hc7qsorlgr"}, {"id": "uduqkcw1v6ldlvfi"}, {"id": "xunw6rshdedekxpg"}, {"id": "nwxc3x381xxv29wq"}, {"id": "0bvcbjxtb8jwayli"}, {"id": "6ib1jqjtrieqvgiu"}, {"id": "lbn1ejilp1y9aslc"}, {"id": "fzixqvm1ofsiya8y"}, {"id": "tpxrylqlxcnr26hb"}, {"id": "tr4c1pq2kghwydfc"}, {"id": "wm0dhzwqdlzjuhaf"}], "properties": {}, "export": {"title": "testingground", "description": ", "basemap": "maphub-classic"}}

Any ideas what I am doing wrong? Or other suggestions on how to do this?
The idea is, that I can keep all other items on the map, but the broadcasting ones will be overwritten from matchday to matchday.

I found part of the issue I think. I tried to add Line Feeds into the description, and that broke the GeoJSON file.

ok @hyperknot, I got this kind of working, but I have an annoying issue.
When I create the file to upload with the country + matchday information, the existing Pins on the map are not overwritten. So I have to manually first delete the existing ones, and than upload the file.
This is very time consuming. (I have >200 countries covered here).
Can you make it possible to that I can select an item, hold shift, and select the last item in the list, and all items in between are automatically selected, which I then can delete?
Would that be possible?

Also, could you add a TV Icon if you have time. Google Fonts / Font Awesome have some TV ones.
(I can use the cinema for now)

Hi @nico.vadoy!

First for the JSON, you are having some syntax issues. You can use https://jsonlint.com/ to test it.

About updating GeoJSON data, I’ve just released an update for the API to support this. On this page you can see some snippets how to do this automatically:
https://docs.maphub.net/api/map_update.html

I recommend using the Python version, if you haven’t used Python before I totally recommend you to pick it up, from what you’ve done with your map I think Python will be an easy feat for you!

@hyperknot, this seems to work.

All the black points with the camera are now the fix countries, with possible matchday info.
I am still trial running, but everything you see on the picture has been uploaded via the API.

Happy days!

Wow, that’s quite an amazing progress, so quickly!

Hi, MapHub API has just received a major update, as well as a detailed tutorial about how to use it: