Convert Shapefiles or GeoJSON files into Radar CSV files ready for import. The final step in converting is always from GeoJSON to Radar CSV.
'Shapefile' -> 'GeoJSON' -> Radar CSV
Open the shapefile_to_geojson.py file and:
- Specify the shapefile location for geopandas to read.
- Specify the output file name/location.
Open the run.py file and:
- Update the parameters with the needed values.
- Run the file.
This is the main file to run to convert GeoJSON files into Radar CSV. There are a few parameters that need to be specified for the GeoJSON file conversion to run smoothly:
-filePath : Path to the GeoJSON file to convert
-useFileNameAsTag : Should the output file share the same name as input file. The file extension will always be .csv regardless.
-includePropertiesAsMetadata : Should all properties in the GeoJSON properties object be included as Metadata items for the Radar Geofence.
-descriptionKey : What GeoJSON proeprty key has the value for the Radar Description. If this value is null that description will be ignored.
-tagKey : What GeoJSON proeprty key has the value for the Radar Tag. This will default to the GeoJSON file name if property not specified or not found in the file.
-externalIdKey : What GeoJSON property key has the value for the Radar ExternalID. This will default to the GeoJSON file name concatonated with an index counter.
-isochroneKey : What GeoJSON proeprty key has the value for the Radar isochrone radius. This defaults to a static value specified in the GeoJsonConverter class.
-radiusKey : What GeoJSON property has the value for the radar geofence radius value. This defaults to a static value specified in the GeoJsonConverter class.
A simple file for converting Shapefiles to GeoJSON files using the geopandas library. We also convert/specify the coordinate system being used to the standard latitude/longitude system that Radar uses.
The current read path looks for a file in the Inputs file directory and outputs to the GeoJSONFiles directory.
####GeoJSON Types GoeJSON has multiple types of geometries that don't all have an analogous in Radar. Below is specified the types and the conversion done.
- Point : circle
- LineString : Not Supported
- Polygon : polygon
- MultiPoint : multiple circle
- MultiLineString : Not Supported
- MultiPolygon : multiple polygon
- GeometryCollection : Not Supported
(1) LineString, MultiLineString, and Geometry Collection are not supported simply due to either complexity or not a direct analogy in Radar.
(2) Polygons can have holes in them in GeoJSON. This is not supported and will be ignored.
(3) Due to Antimeridian Cutting that GeoJSON uses, this will almost garantee issues in the resulting Radar Geofence. This has not been solved for.
Converts a GeoJSON file to a Radar CSV file ready to import.
There is no specified path prefix for the GeoJSON file. The output CSV will be placed in the RadarFiles directory.
Python doesn't allow for easy conversion between single and double quotes on strings. Thus we need to execute a shell file to swap all the single quotes that python uses for file writes to double quotes. This is required since the Radar CSV import doesn't allow for single quotes.
- Support additional file types as needed.
- Use a GUI file picker
- Provide helpers for picking GeoJSON property keys.
- Automatially identify file type and run needed processes.
- Radar's CSV import requirements is currently changing so will likely need to support that.