0

I'm editing a shapefile for an election map, so I downloaded some county level vote totals and am adding them to a preexisting shapefile. This works for the most part (I can produce most of a new map with the added data) and I have been able to solve most problems I get, but I am stuck on something.

After joining the edited CSV file, most of the new attribute table fills out correctly and can be mapped, but some precinct vote counts are left null. After investigating, I discovered these null precincts are all precinct names that are reused in other counties (counties which have not yet been completed). I have only completed 5 counties so far. In the attribute table of the CSV file, the same precinct fields are not null, and correctly filled out.

The data appears to be organized using two fields, with one field labeled "COUNTYFP", indicating the county using an FIPS code, and the other labeled "NAME", indicating the name of the precinct within the county. Some precinct names are used in multiple counties, and I'm guessing that is the problem, though the original shapefile I started with didn't have any problems with that until I joined more data.

enter image description here

Here is a sample of the attribute table of the CSV file. This is just one small county (Alexander county, IL), but it illustrates the point. Notice how the precinct named "CACHE" has data across all fields.

enter image description here

After joining, this is the resultant portion of attribute table for the same county. The same precinct ("CACHE") now has null values across all fields.

enter image description here

This is the map I get, notice that there is a missing portion. my code is definitely working, bit I think the problem is with the join I am performing. There is another "CACHE" precinct in another county. It has exactly the same name, but a different "COUNTYFPS" number.

enter image description here

Here is snapshot of the the two precincts in an attribute table for the shapefile of a different election (a shapefile which I downloaded). It differentiates the two, despite them having the same name. The resulting map colors both precincts differently in accordance with my color coding.

3
  • 1
    HI Lucas, to help us understand your problem, can you add screenshots of your map and some example of the code you already tried ? May 27, 2021 at 6:58
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    May 27, 2021 at 7:20
  • I added some images and further info to better explain the problem.
    – Lucas
    May 27, 2021 at 16:54

1 Answer 1

1

I have resolved my issue. I used a concat function in my CSV file and added an identical field to the shapefile attribute table. I then joined the two at that field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.