0

Output rasterI'm trying to rasterize a vector layer in GRASS after setting the geographic region to the vector layer extent. I also used v.category to add categories to my vector layer. The command I'm using to rasterize is:

v.to.rast -d --overwrite input=nyc_census_blocks@may type=boundary,centroid,area output=raster_map@may use=cat

However, the output I'm getting is just a yellow rectangle of the geographic region I set, not the shape of my vector layer.

The region is:

g.region -p                                                                     
projection: 3 (Latitude-Longitude)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      40:54:55.917994N
south:      40:29:46.015423N
west:       74:15:20.12891W
east:       73:42:00.03263W
nsres:      0:25:09.902571
ewres:      0:33:20.09628
rows:       1
cols:       1
cells:      1

Description of vector layer:

v.info nyc_census_blocks                                                        


+----------------------------------------------------------------------------+
 | Name:            nyc_census_blocks                                         |
 | Mapset:          may                                                       |
 | Location:        newLocation                                               |
 | Database:        /Users/may                                                |
 | Title:                                                                     |
 | Map scale:       1:1                                                       |
 | Name of creator: may                                                       |
 | Organization:                                                              |
 | Source date:     Thu Mar  4 11:32:24 2021                                  |
 | Timestamp (first layer): none                                              |
 |----------------------------------------------------------------------------|
 | Map format:      native                                                    |
 |----------------------------------------------------------------------------|
 |   Type of map: vector (level: 2)                                           |
 |                                                                            |
 |   Number of points:       0               Number of centroids:  39250      |
 |   Number of lines:        0               Number of boundaries: 91570      |
 |   Number of areas:        39250           Number of islands:    107        |
 |                                                                            |
 |   Map is 3D:              No                                               |
 |   Number of dblinks:      1                                                |
 |                                                                            |
 |   Projection: Latitude-Longitude                                           |
 |                                                                            |
 |               N:  40:54:55.917994N    S:  40:29:46.015423N                 |
 |               E:   73:42:00.03263W    W:   74:15:20.12891W                 |
 |                                                                            |
 |   Digitization threshold: 0                                                |
 |   Comment:                                                                 |
 |                                                                            |
 +----------------------------------------------------------------------------+
2
  • What are your region settings? i.e. please post the output of g.region -p and v.info nyc_census_blocks
    – Micha
    Mar 5, 2021 at 11:55
  • I added this. Thanks.
    – mazucci
    Mar 5, 2021 at 12:19

1 Answer 1

1

Thanks for the added information. Note that your region is set to 1 pixel by 1 pixel. The resolution (by default) is set to the extent of the vector, about 0.5 degrees (or approx 50 km.). In order to get a raster at higher resolution, just set a much finer resolution. i.e.:

g.region -ap res=00:00:03

That will give you a resolution of 3 arcseconds, or about 90 meters. Then redo

v.to.rast -d --overwrite input=nyc_census_blocks type=area output=raster_map use=cat

Your Answer

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

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