Repository: geopandas/geopandas

Issue:
ENH: geopandas.GeoDataFrame.from_dict() could accept crs as parameter
Tested on version 0.8.1, the following command:

```
gpd.GeoDataFrame.from_dict(nodes, columns=["geometry"], orient="index", crs=32637)
```

Returns:

```
TypeError: from_dict() got an unexpected keyword argument 'crs'
```

Is this normal? It seems to me it should be able to accept it because `crs` is a typical GeoDataFrame parameter


Discussion:
`from_dict` is a method inherited from `pandas.DataFrame.from_dict` and as such it does not support `crs` directly. But you are right, that it is a bit unexpected, so we may override it to add crs support.

For now, you will have to specify CRS manually after the creation of GeoDataFrame:

```py
df = df.set_crs(32637)
```
This also means that `from_dict` should be overloaded with a `geometry` argument along with `crs` right? since we don't wanna be assigning crs to geodataframes without a geometry column

I'm planning to work on this if noone else is : )
> This also means that from_dict should be overloaded with a geometry argument along with crs right?

@Sangarshanan Yes.

> I'm planning to work on this if noone else is : )

Thanks! :)

Resolving patch:
diff --git a/geopandas/geodataframe.py b/geopandas/geodataframe.py
--- a/geopandas/geodataframe.py
+++ b/geopandas/geodataframe.py
@@ -397,6 +397,32 @@ def __setstate__(self, state):
         except Exception:
             pass
 
+    @classmethod
+    def from_dict(cls, data, geometry=None, crs=None, **kwargs):
+        """
+        Construct GeoDataFrame from dict of array-like or dicts by
+        overiding DataFrame.from_dict method with geometry and crs
+
+        Parameters
+        ----------
+        data : dict
+            Of the form {field : array-like} or {field : dict}.
+        geometry : str or array (optional)
+            If str, column to use as geometry. If array, will be set as 'geometry'
+            column on GeoDataFrame.
+        crs : str or dict (optional)
+            Coordinate reference system to set on the resulting frame.
+        kwargs : key-word arguments
+            These arguments are passed to DataFrame.from_dict
+
+        Returns
+        -------
+        GeoDataFrame
+
+        """
+        dataframe = super().from_dict(data, **kwargs)
+        return GeoDataFrame(dataframe, geometry=geometry, crs=crs)
+
     @classmethod
     def from_file(cls, filename, **kwargs):
         """Alternate constructor to create a ``GeoDataFrame`` from a file.


Test patch:
diff --git a/geopandas/tests/test_geodataframe.py b/geopandas/tests/test_geodataframe.py
--- a/geopandas/tests/test_geodataframe.py
+++ b/geopandas/tests/test_geodataframe.py
@@ -479,6 +479,16 @@ def test_coord_slice_points(self):
         assert_frame_equal(self.df2.loc[5:], self.df2.cx[:, 5:])
         assert_frame_equal(self.df2.loc[5:], self.df2.cx[5:, 5:])
 
+    def test_from_dict(self):
+        data = {"A": [1], "geometry": [Point(0.0, 0.0)]}
+        df = GeoDataFrame.from_dict(data, crs=3857)
+        assert df.crs == "epsg:3857"
+        assert df._geometry_column_name == "geometry"
+
+        data = {"B": [1], "location": [Point(0.0, 0.0)]}
+        df = GeoDataFrame.from_dict(data, geometry="location")
+        assert df._geometry_column_name == "location"
+
     def test_from_features(self):
         nybb_filename = geopandas.datasets.get_path("nybb")
         with fiona.open(nybb_filename) as f: