1

I am starting with this Hazard Parcel Exposure dataset from the Metropolitan Transportation Commission which I downloaded as a shapefile.

http://opendata.mtc.ca.gov/datasets/parcel-hazard-exposure

I am using QGIS 3.4.3-Madeira on Mac OS High Sierra 10.13.6.

I tried to convert boolean to numeric values but the values did not calculate all the way through. Why are there blank rows when calculating attributes in QGIS3?

At first I thought maybe there is a selection on, but I did it all again with nothing selected and the same thing happened.

The 5 boolean attributes are shown below.

boolean_attributes

My goal is to convert each to a numeric value, sum into a new field, and represent each parcel with categorized symbology like so:

categorized_symbology

Where 0 means no hazards and 5 means there are 5 hazards (all five attributes are True).

First I added temporary fields for each hazard attribute and calculated so it is becomes numerical. This is what I calculated for the first boolean attribute.

"infltzone"='True'

temporary_attributes

The result of calculating that into the field "fltzone" is that True values become 1 and False values become 0. Then I sum all the values into a new field I called hazsum using this calculation:

 "fltzone"  +  "lndstdy"  +  "liqstdy"  +   "lndsus"  +  "liqsus" 

The fields calculated and it initially looked like they calculated. But I tried to symbolize it and it looked like this, with many parcels without a numerical hazard exposure value:

incomplete_map

When I identify a parcel with a hazsum, it looks great:

good_id

But when identifying a neighboring parcel with no hazsum...

bad_id

I tried to export to Excel and do the calculations there but it kept crashing.

Can you suggest a method to accomplish my goal or to explain why my calculation did not complete?

0

I found a way! TLDR I used postgres.

hazmap

I used:
PostgreSQL 11 via https://postgresapp.com/documentation/ and
pgAdmin 4.1 via https://www.pgadmin.org,

and the query I used was:

ALTER TABLE hazards 
    ADD fltzone integer, 
    ADD lndstdy integer, 
    ADD liqstdy integer, 
    ADD lndsus integer, 
    ADD liqsus integer, 
    ADD hazsum integer;
UPDATE hazards SET
    fltzone = CASE WHEN in_fltzone = 'True' THEN 1 else 0 END,
    lndstdy = CASE WHEN in_lndstdy = 'True' THEN 1 else 0 END,
    liqstdy = CASE WHEN in_liqstdy = 'True' THEN 1 else 0 END,
    lndsus = CASE WHEN in_lndsus = 'True' THEN 1 else 0 END,
    liqsus = CASE WHEN in_liqsus = 'True' THEN 1 else 0 END;

Then seperately run:

UPDATE hazards SET
    hazsum = fltzone + lndstdy + liqstdy + lndsus + liqsus;

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.