从shapefile中的数据栅格化的矢量

时间:2020-01-21 10:36:23

标签: matlab mapping raster

我正在尝试将Shapefile中与国家/地区对应的矢量数据转换为0.1度分辨率的栅格, 为此,我正在使用

vec2mtx and imbedm

功能。这是我正在尝试的方法,但是MatLab抛出错误。

%%%%here states is a shapefile of the world.
states=shaperead('Z:\shpfiles\TM_WORLD_BORDERS_SIMPL-0.3.shp');
lat = [states.Y]; %%lat and lon are of size  30032x1 each and  there are 246 countries in the shapefile
lon = [states.X];
%%%% I convert it to a matrix of 0.1 degree resolution
[Z, R] = vec2mtx(lat, lon, ...
       10, [-90 90], [-180 180], 'filled');
%%%% The same shapefile has an attribute of literacy rate for each country, to convert the literacy rate at 0.1 degree resolution, keeping the 
%%%% value constant within each country,
Z =  imbedm(lat, lon, [states.Lit2005], Z, R)

%%%%%THE ERROR
Error using imbedm (line 53)
Function imbedm expected its LAT, LON, and VALUE inputs to have the same size.

0 个答案:

没有答案