0

I have a problem that's stumped me. I'm merging flood hazard layers from FEMA. For most states, the objectid is a real number. California (we're always the weird ones) has an objectid that's 'integer64'. I don't know enough about objectids to know which one is correct or if there's a correct option. Merging the layers into a single layer runs into problems with the difference in object ids. Can anyone suggest a solution to this problem? Is there way to convert one or the other objectid fields to match or a setting to select to enable the different types to work together?

I'm using QGIS. I pulled the data from FEMA's Esri Geodatabase. I then clip these layers to my study area and save 'em as shapefiles. I'm working with those, trying to merge them into a single layer

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • Welcome to GIS SE! What file types are you working with? – Barbarossa Jan 25 at 18:51
  • Thanks! I pulled the data from FEMA's Esri Geodatabase. I then clip these layers to my study area and save 'em as shapefiles. I'm working with those, trying to merge them into a single layer. – AM Dagoski Jan 25 at 19:07
  • Please Edit the question in response to requests for clarification. It's not fair to those who would help you to need to mine the comments for critical information. – Vince Jan 25 at 19:12
  • Vince. Thanks for the etiquette tip. I'll remember that because you're totally right. – AM Dagoski Jan 25 at 19:14
  • That's strange that fields coming from a GDB are not int32, the default OID field type for ESRI shapefile is Int32 - https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf. QGIS documentation even notes that it uses ESRI specification. I'd revisit how the shapefiles were generated. – Barbarossa Jan 25 at 19:24
0

Change the data-type of the "objectid" field on the California layer as follows:

  1. Use the Field Calculator to copy the "objectid" values into a new field with the correct data.

    • Output Field Name: objectid2
    • Output Field Type: Decimal number (real)
    • Expression: "objectid"

    enter image description here

  2. Open the attribute table. Check that the "objectid" values transferred over correctly into the "objectid2" field. Delete the original "objectid" field.

  3. Open layer properties > Source Fields. Change the name of the "objectid2" field to "objectid". Check that the new field still has the correct data type.

  4. You should now be able to merge the California layer with the other layers.

WARNING: Data type: Decimal number (real) contains chemicals known to the State of California to cause cancer and birth defects or other reproductive harm.

  • Heh. I like that. I was hesitant to change the object id for fear of doing Bad Things to the file, but YOLO. – AM Dagoski Jan 25 at 19:46
  • By all means, make a backup copy before you begin editing the original. YOWTDTODO (You only want to download the original data once). – csk Jan 25 at 20:09
0

Not an answer as much as a resolution. Turned out that I clipped the California file to a different layer that happened to hold the same geography, but with additional data joined in. It looks like that layer has issues. Re-ran the clip on California with the right layer (one that only holds TIGER Geographies for coastal counties) and the merge goes fine. This is just another instance of the maxim "Garbage in, garbage out." If a component in your data supply chain has a problem, that problem is likely to propagate.

Thanks for your help and suggestions, everyone. You all got me going on the right debugging path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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