I'm trying to create a GeoDataFrame points grid from a numpy.mgrid. I already have created the numpy.mgrid with coordinates of future points.
>>>arr = np.mgrid[-1827342.1753285176:-1827523.6181312904:121j,5328243.703187092:5328092.54873913:152j]
>>>arr
array([[[-1827342.17532852, -1827342.17532852, -1827342.17532852, ...,
-1827342.17532852, -1827342.17532852, -1827342.17532852],
[-1827343.68735187, -1827343.68735187, -1827343.68735187, ...,
-1827343.68735187, -1827343.68735187, -1827343.68735187],
[-1827345.19937523, -1827345.19937523, -1827345.19937523, ...,
-1827345.19937523, -1827345.19937523, -1827345.19937523],
...,
[-1827520.59408458, -1827520.59408458, -1827520.59408458, ...,
-1827520.59408458, -1827520.59408458, -1827520.59408458],
[-1827522.10610793, -1827522.10610793, -1827522.10610793, ...,
-1827522.10610793, -1827522.10610793, -1827522.10610793],
[-1827523.61813129, -1827523.61813129, -1827523.61813129, ...,
-1827523.61813129, -1827523.61813129, -1827523.61813129]],
[[ 5328243.70318709, 5328242.70216426, 5328241.70114142, ...,
5328094.5507848 , 5328093.54976196, 5328092.54873913],
[ 5328243.70318709, 5328242.70216426, 5328241.70114142, ...,
5328094.5507848 , 5328093.54976196, 5328092.54873913],
[ 5328243.70318709, 5328242.70216426, 5328241.70114142, ...,
5328094.5507848 , 5328093.54976196, 5328092.54873913],
...,
[ 5328243.70318709, 5328242.70216426, 5328241.70114142, ...,
5328094.5507848 , 5328093.54976196, 5328092.54873913],
[ 5328243.70318709, 5328242.70216426, 5328241.70114142, ...,
5328094.5507848 , 5328093.54976196, 5328092.54873913],
[ 5328243.70318709, 5328242.70216426, 5328241.70114142, ...,
5328094.5507848 , 5328093.54976196, 5328092.54873913]]])
After, I tried this method:
>>>pd.DataFrame(data=arr[0:,0:],
index=???,
columns=['x','y'])
And after use x and y fields to create a POINT shapely geometry field. But I didn't find how to create an index.
So I tried to convert 2 parts oh the array in 2 lists like this:
>>>x = marr[0,0:].tolist()
>>>y = marr[1,0:].tolist()
But it doesn't really unpack the array.
Somebody have some tips?