User talk:Twotwofourtysix/Archives/2022/June

Latest comment: 1 year ago by DiscoA340 in topic Follow up about the Maps

Interactive Congressional Maps

Hello,

I hope all is good. I just came across your interactive congressional maps for WA and would like to do them NC/SC. Do you have any tips for making them and or is there a tutorial om WP itself? Thank you! DiscoA340 (talk) 22:45, 13 June 2022 (UTC)

@DiscoA340: G'day. It's not just WA's districts that I've entered them in. I've done many other states, including NC's new 14th district. I didn't add them in for the rest of NC because the district boundaries will only be in effect for two years and for SC because I feared that the map might get struck down and I would have to do it all over again. Regardless, I use {{maplink}}, combined with {{switcher}}, for those maps and the map data comes from GeoJSON data in Wikimedia Commons in the Data: namespace and ending with .map; for NC-14 specifically, it's from this page: Data:North Carolina's 14th congressional district (2023–).map. You can get a GeoJSON file from Dave's Redistricting or pages linked to from 538 and Daily Kos' spreadsheet. If this sounds confusing, I suggest you use the already existing {{maplink}} template in the article and then copy and tweak it from there, while for the data page you just need to change the "North Carolina" and "14th" in the title accordingly. I can talk you through a lot more of this but let me know if you need any specific guidance. Thanks. twotwofourtysix(My talk page and contributions) 23:54, 13 June 2022 (UTC)
Yeah it's been a crazy ride down here in both states with redistricting. I think I understand how to insert the map into each wiki page but I need some help with getting the "GeoJSON District Shapes" converted and turned into a Data file. Looking at how you did with the 14th, I used Mapshaper but what file format do I convert it to? Also how do you separate each district into a file? And then when that's done, can I just upload it to commons using the standard way? Thank you for helping me! DiscoA340 (talk) 14:57, 14 June 2022 (UTC)
You can just import the shapefile to Mapshaper and then export it using the file format of GeoJSON, though remember that this step isn't necessary if the file that you have is already a GeoJSON file. I don't separate the file into several different files for each districts because that'd be confusing to work with. Instead, I open the file with Notepad to copy the district(s) from there directly. These districts are called features in the file and you will want to copy the code starting with {"type": "Feature", and ending with the corresponding closing bracket. Next you can paste this into the page that you want. If you want to explore around for a bit, you can, just as an example, use/create the page c:Data:Sandbox/DiscoA340/Sandbox.map. There, you'll automatically be given a template with some tutorials. (Tip: You can type "prettify" in the command line of the export tab of Mapshaper if you want to make the file more human-readable) twotwofourtysix(My talk page and contributions) 15:41, 14 June 2022 (UTC)
That makes more sense now. I have a question about the coordinates, is there way to easily turn each point in the document into code (Like coordinate [-78.15491,35.41781] into
[-78.15491,
35.41781
]. ), Thanks! DiscoA340 (talk) 17:44, 14 June 2022 (UTC)
You don't have to do this, it'll still work regardless of whether you entered a line break or not. Also, formatting work like this is automatically done by the system once you publish the data file at Commons. twotwofourtysix(My talk page and contributions) 22:45, 14 June 2022 (UTC)
I think I got it work on my Sandbox. Thank you so much for helping me getting this to work! I have one last question though, where can I upload Data files on Wikimedia so it can be added to the congressional district pages? Thanks again for your help! DiscoA340 (talk) 14:57, 15 June 2022 (UTC)
You just need to move that page, if you want to, to the appropriate/relevant title. Then, you can use {{maplink}} and enter the title of the page to the |from= parameter. twotwofourtysix(My talk page and contributions) 15:07, 15 June 2022 (UTC)
It's now Uploaded and Complete, Thank you for helping me! Two quick questions about some things I noticed. Fist, Is Creative Commons Zero a good license for the map as it uses Dave's Redistricting which uses data created by the Government? Second, Looking at the way you added points to larger maps, how do you find a number which locates each city location in "|idX=" part of the code? Thanks again! DiscoA340 (talk) 18:03, 15 June 2022 (UTC)
I usually just assume that data from the government, be it the Census Bureau or the state legislatures or others, are released into the public domain unless explicitly written otherwise. For your second question, the id parameter is the Wikidata id of the city or county's article in question. To find this, you either need to search for the article in Wikipedia and go to "Wikidata item" on the left sidebar or search for the item on Wikidata directly. twotwofourtysix(My talk page and contributions) 01:17, 16 June 2022 (UTC)
Sorry for asking another question but I was also looking in the coding of the Data map you did for NC14 and found this parameter "PL20AA_TOT":, What should I put in it and or is it needed for all data maps? Again sorry for the questions, I believe this will be the last as I have figured out the rest of what needs to be done to make them all work. Thanks again for your all your help! DiscoA340 (talk) 18:07, 16 June 2022 (UTC)
Because I copy this shapefile right from the source, it often includes many unnecessary parameters, like the one you just mentioned. In fact, I think it's ok for you to only keep the title and district parameter; as an interactive feature and as a unique id respectively. twotwofourtysix(My talk page and contributions) 22:18, 16 June 2022 (UTC)
I uploaded the files to the Wikipedia page. All seems to be good but It seems like the original image in the infobox was tied to the image that can be seen when you cite it in a page as the article currently has no image. Is there a way I can fix this issue? But nevertheless thank you so much for helping me and I will now add the rest of the files to Wikipedia and their pages. I have learned something new and I appreciate it! DiscoA340 (talk) 23:12, 16 June 2022 (UTC)
You're right and it also happens to me when I replace the images on the infobox. I don't make an effort to fix it, though, as I don't think it's important. twotwofourtysix(My talk page and contributions) 23:17, 16 June 2022 (UTC)
I understand, well thanks again for your help. I think all the questions I had have been answered. Have a good week! DiscoA340 (talk) 14:45, 17 June 2022 (UTC)
No problem! Thanks so much to you too for taking your time to make & add these maps twotwofourtysix(My talk page and contributions) 23:57, 17 June 2022 (UTC)

Follow up about the Maps

Hi again,

All seems to be good with the maps, Thanks again for helping me! If you ever need help with something, feel free to contact me in my Talk section. DiscoA340 (talk) 00:49, 22 June 2022 (UTC)