How to use the arcgis2geojson.arcgis2geojson function in arcgis2geojson

To help you get started, we’ve selected a few arcgis2geojson examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chris48s / arcgis2geojson / run_tests.py View on Github external
def test_convert_arcgis_polygon_with_z_values_to_geojson_polygon(self):
        input = {
            'rings': [
                [
                    [41.8359375, 71.015625, 1],
                    [56.953125, 33.75, 1],
                    [21.796875, 36.5625, 1],
                    [41.8359375, 71.015625, 1]
                ]
            ],
            'spatialReference': {
                'wkid': 4326
            }
        }
        output = arcgis2geojson(input)
        self.assertEqual(output['coordinates'], [
            [
                [41.8359375, 71.015625, 1],
                [21.796875, 36.5625, 1],
                [56.953125, 33.75, 1],
                [41.8359375, 71.015625, 1]
            ]
        ])
        self.assertEqual(output['type'], 'Polygon')
github chris48s / arcgis2geojson / run_tests.py View on Github external
def test_convert_arcgis_polygon_to_geojson_polygon(self):
        input = {
            'rings': [
                [
                    [41.8359375, 71.015625],
                    [56.953125, 33.75],
                    [21.796875, 36.5625],
                    [41.8359375, 71.015625]
                ]
            ],
            'spatialReference': {
                'wkid': 4326
            }
        }
        output = arcgis2geojson(input)
        self.assertEqual(output['coordinates'], [
            [
                [41.8359375, 71.015625],
                [21.796875, 36.5625],
                [56.953125, 33.75],
                [41.8359375, 71.015625]
            ]
        ])
        self.assertEqual(output['type'], 'Polygon')
github chris48s / arcgis2geojson / run_tests.py View on Github external
def test_convert_arcgis_point_with_z_value_to_geojson_point(self):
        input = {
            'x': -66.796875,
            'y': 20.0390625,
            'z': 1,
            'spatialReference': {
                'wkid': 4326
            }
        }
        output = arcgis2geojson(input)
        self.assertEqual(output['coordinates'], [-66.796875, 20.0390625, 1])
        self.assertEqual(output['type'], 'Point')
github chris48s / arcgis2geojson / run_tests.py View on Github external
def test_convert_string_json_to_string_json(self):
        input = json.dumps({
            'x': -66.796875,
            'y': 20.0390625,
            'spatialReference': {
                'wkid': 4326
            }
        })
        output = arcgis2geojson(input)
        self.assertIsInstance(output, str)
        output = json.loads(output)
        self.assertEqual(output['coordinates'], [-66.796875, 20.0390625])
        self.assertEqual(output['type'], 'Point')
github chris48s / arcgis2geojson / run_tests.py View on Github external
[41.8359375, 71.015625],
                        [56.953125, 33.75],
                        [21.796875, 36.5625],
                        [41.8359375, 71.015625]
                    ]
                ],
                'spatialReference': {
                    'wkid': 4326
                }
            },
            'attributes': {
                'OBJECTID': 123
            }
        }

        output = arcgis2geojson(input)
        self.assertEqual(output['id'], 123)
github chris48s / arcgis2geojson / run_tests.py View on Github external
def test_id_must_be_string_or_number(self):
        input = {
            'x': -66.796875,
            'y': 20.0390625,
            'spatialReference': {
                'wkid': 4326
            },
            'attributes': {
                'OBJECTID': 123,
                'some_field': {
                    'not a number': 'or a string'
                }
            }
        }

        output = arcgis2geojson(input, 'some_field')

        # 'some_field' isn't a number or string - fall back to OBJECTID
        self.assertEqual(123, output['id'])
github chris48s / arcgis2geojson / run_tests.py View on Github external
def test_convert_arcgis_polyline_with_z_values_to_geojson_linestring(self):
        input = {
            'paths': [
                [
                    [6.6796875, 47.8125, 1],
                    [-65.390625, 52.3828125, 1],
                    [-52.3828125, 42.5390625, 1]
                ]
            ],
            'spatialReference': {
                'wkid': 4326
            }
        }
        output = arcgis2geojson(input)
        self.assertEqual(output['coordinates'], [
            [6.6796875, 47.8125, 1],
            [-65.390625, 52.3828125, 1],
            [-52.3828125, 42.5390625, 1]
        ])
        self.assertEqual(output['type'], 'LineString')
github chris48s / arcgis2geojson / run_tests.py View on Github external
'geometry': {
                'rings': [
                    [
                        [41.8359375, 71.015625],
                        [56.953125, 33.75],
                        [21.796875, 36.5625],
                        [41.8359375, 71.015625]
                    ]
                ],
                'spatialReference': {
                    'wkid': 4326
                }
            }
        }

        output = arcgis2geojson(input)
        self.assertEqual(output['geometry']['coordinates'], [
            [
                [41.8359375, 71.015625],
                [21.796875, 36.5625],
                [56.953125, 33.75],
                [41.8359375, 71.015625]
            ]
        ])
        self.assertEqual(output['geometry']['type'], 'Polygon')
        self.assertEqual(output['properties'], None)
github chris48s / arcgis2geojson / run_tests.py View on Github external
[-122.49, 45.48],
                    [-122.64, 45.49]
                ],
                [
                    [-83, 35],
                    [-74, 35],
                    [-74, 41],
                    [-83, 41]
                ]
            ],
            'spatialReference': {
                'wkid': 4326
            }
        }

        output = arcgis2geojson(input)
        self.assertEqual(output['coordinates'], [
            [
                [
                    [-122.63, 45.52],
                    [-122.64, 45.49],
                    [-122.49, 45.48],
                    [-122.52, 45.5],
                    [-122.57, 45.53],
                    [-122.63, 45.52]
                ]
            ],
            [
                [
                    [-83, 35],
                    [-74, 35],
                    [-74, 41],
github chris48s / arcgis2geojson / run_tests.py View on Github external
def test_convert_arcgis_polyline_to_geojson_linestring(self):
        input = {
            'paths': [
                [
                    [6.6796875, 47.8125],
                    [-65.390625, 52.3828125],
                    [-52.3828125, 42.5390625]
                ]
            ],
            'spatialReference': {
                'wkid': 4326
            }
        }
        output = arcgis2geojson(input)
        self.assertEqual(output['coordinates'], [
            [6.6796875, 47.8125],
            [-65.390625, 52.3828125],
            [-52.3828125, 42.5390625]
        ])
        self.assertEqual(output['type'], 'LineString')

arcgis2geojson

A Python library for converting ArcGIS JSON to GeoJSON

MIT
Latest version published 5 months ago

Package Health Score

65 / 100
Full package analysis

Popular arcgis2geojson functions

Similar packages