Repository: geomet/geomet

Issue:
srid option for geomet.esri.dumps does not do anything
The option for defining output srid for the esrijson geometry is actively ignored
I have installed version 1.0.0
```python
import geomet.esri
from pprint import pprint

input_geojson =  {'coordinates': [494252.595744681, 7066045.31914894], 'type': 'Point'}

esri_json = geomet.esri.dumps(input_geojson, srid=32632)

pprint(esri_json)
# Expected output is 
# {'spatialReference': {'wkid': 32632},
# 'x': 494252.595744681,
# 'y': 7066045.31914894}
# Actual output is
# {'spatialReference': {'wkid': 4326},
# 'x': 494252.595744681,
# 'y': 7066045.31914894}

```
I did some investigating into the source code and found all the `_dump_* ` functions in the `esri.py` file includes this line:
```python
srid = _extract_geojson_srid(obj) or srid
```
And inside the `_extract_geojson_srid` function:
```python
def _extract_geojson_srid(obj):
  ...
  return srid or 4326
```
Which means it will never return the srid value i explicitly define. Workaround is the add the crs field into the `input_geojson`

```python
input_geojson =  {'coordinates': [494252.595744681, 7066045.31914894], 'type': 'Point', 'crs': {'type': 'name', 'properties': {'name': 'EPSG:32632'}}
```
The simple fix is to change all of the `_extract_geojson_srid(obj) or srid` to `srid or _extract_geojson_srid(obj)`

Discussion:
larsbutler: @achapkowski Would you mind reviewing? Thanks!

Patch:
diff --git a/geomet/esri.py b/geomet/esri.py
index e68772d..1000243 100644
--- a/geomet/esri.py
+++ b/geomet/esri.py
@@ -111,7 +111,8 @@ def _dump_geojson_point(obj, srid=None):
     """
     coordkey = "coordinates"
     coords = obj[coordkey]
-    srid = _extract_geojson_srid(obj) or srid
+    if srid is None:
+        srid = _extract_geojson_srid(obj)
     return {"x": coords[0], "y": coords[1], "spatialReference": {"wkid": srid}}
 
 
@@ -121,7 +122,8 @@ def _dump_geojson_multipoint(obj, srid=None):
 
     """
     coordkey = "coordinates"
-    srid = _extract_geojson_srid(obj) or srid
+    if srid is None:
+        srid = _extract_geojson_srid(obj)
     return {"points": obj[coordkey], "spatialReference": {"wkid": srid}}
 
 
@@ -136,7 +138,8 @@ def _dump_geojson_polyline(obj, srid=None):
         coordinates = [obj[coordkey]]
     else:
         coordinates = obj[coordkey]
-    srid = _extract_geojson_srid(obj) or srid
+    if srid is None:
+        srid = _extract_geojson_srid(obj)
     return {"paths": coordinates, "spatialReference": {"wkid": srid}}
 
 
@@ -157,7 +160,8 @@ def _dump_geojson_polygon(data, srid=None):
         else:
             for seg in part:
                 part_list.append([list(coord) for coord in seg])
-    srid = _extract_geojson_srid(data) or srid
+    if srid is None:
+        srid = _extract_geojson_srid(data)
     return {"rings": part_list, "spatialReference": {"wkid": srid}}
 
 


Test patch:
diff --git a/geomet/tests/esri_test.py b/geomet/tests/esri_test.py
index 10a7735..612c6e6 100644
--- a/geomet/tests/esri_test.py
+++ b/geomet/tests/esri_test.py
@@ -28,6 +28,13 @@ esri_json_mpt = {
     ],
     "spatialReference": {"wkid": 4326}
 }
+esri_json_mpt_srid_26955 = {
+    "points": [
+        [-97.06138, 32.837], [-97.06133, 32.836],
+        [-97.06124, 32.834], [-97.06127, 32.832],
+    ],
+    "spatialReference": {"wkid": 26955}
+}
 esri_json_polylines = {
     "paths": [
         [[-97.06138, 32.837], [-97.06133, 32.836],
@@ -361,5 +368,38 @@ class TestGeoJSONtoEsriJSON(unittest.TestCase):
         self.assertEqual(expected, actual)
 
 
+class TestGeoJSONtoEsriJSONCustomSRID(unittest.TestCase):
+    """Tests to convert GeoJSON to EsriJSON, with custom SRIDs.
+
+    Proof for https://github.com/geomet/geomet/issues/99.
+    """
+    def test_dumps_to_esrijson_point_custom_srid(self):
+        self.assertEqual(
+            esri.dumps(gj_pt, srid=2062), {
+                'spatialReference': {
+                    'wkid': 2062}, 'x': 25282, 'y': 43770})
+
+    def test_dumps_to_esrijson_multipoint_custom_srid(self):
+        self.assertEqual(
+            esri.dumps(gj_multi_pt, srid=26955),
+            esri_json_mpt_srid_26955,
+        )
+
+    def test_dumps_to_esrijson_polyline_custom_srid(self):
+        self.assertEqual(
+            esri.dumps(gj_lintstring, srid=3572),
+            {
+                'paths': [[[100.0, 100.0], [5.0, 5.0]]],
+                'spatialReference': {'wkid': 3572},
+            }
+        )
+
+    def test_dumps_to_esrijson_polygon_custom_srid(self):
+        vcheck = {'rings': [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [
+            100.0, 1.0], [100.0, 0.0]]], 'spatialReference': {'wkid': 2263}}
+        self.assertEqual(esri.dumps(gj_polygon, srid=2263),
+                         vcheck)
+
+
 if __name__ == "__main__":
     unittest.main()