# HG changeset patch # User iuc # Date 1745335092 0 # Node ID 7bc130112fa3d4d0f3669e94beb0b352c6e5e278 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/geopandas commit 76226199cd9ac3de12c81cc36b38c86bf4d676f5 diff -r 000000000000 -r 7bc130112fa3 table2geojson.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/table2geojson.xml Tue Apr 22 15:18:12 2025 +0000 @@ -0,0 +1,142 @@ + + + + 1.0.1 + 0 + + + + geopandas + + + + +import json +import pandas as pd +import geopandas as gpd +df = pd.read_csv('$infile', encoding="utf-8") + +#set exc = [int($col) - 1 for $col in $exclude_columns] +#set inc = [int($col) - 1 for $col in $include_columns] +property_df = df + +if "$include_columns" != "None": + property_df = df.iloc[:, $inc] + +if "$exclude_columns" != "None": + property_df = df.drop(columns=df.columns[$exc]) + +gdf = gpd.GeoDataFrame( + property_df, + geometry=gpd.points_from_xy(df.iloc[:,$lat_column-1], df.iloc[:,$long_column-1]), + crs="$crs", + ) + +# drop_id: bool, default: False +data = json.loads(gdf.to_json()) +with open('outfile.geojson', "w", encoding="utf8") as f: + ## Minify output json + f.write(json.dumps(data, indent=4)) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10.5281/zenodo.3946761 + + diff -r 000000000000 -r 7bc130112fa3 test-data/geolocation.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/geolocation.csv Tue Apr 22 15:18:12 2025 +0000 @@ -0,0 +1,21 @@ +latitude,longitude,timestamp,value,temperature +37.7749,-122.4194,2023-01-01T12:00:00Z,10,23 +37.7751,-122.4190,2023-01-01T12:05:00Z,15,23 +37.7753,-122.4185,2023-01-01T12:10:00Z,20,23 +37.7755,-122.4180,2023-01-01T12:15:00Z,25,24 +37.7757,-122.4175,2023-01-01T12:20:00Z,30,25 +37.7759,-122.4170,2023-01-01T12:25:00Z,35,23 +37.7761,-122.4165,2023-01-01T12:30:00Z,40,23 +37.7763,-122.4160,2023-01-01T12:35:00Z,45,23 +37.7765,-122.4155,2023-01-01T12:40:00Z,50,23 +37.7767,-122.4150,2023-01-01T12:45:00Z,55,23 +37.7769,-122.4145,2023-01-01T12:50:00Z,60,23 +37.7771,-122.4140,2023-01-01T12:55:00Z,65,23 +37.7773,-122.4135,2023-01-01T13:00:00Z,70,23 +37.7775,-122.4130,2023-01-01T13:05:00Z,75,23 +37.7777,-122.4125,2023-01-01T13:10:00Z,80,23 +37.7779,-122.4120,2023-01-01T13:15:00Z,85,23 +37.7781,-122.4115,2023-01-01T13:20:00Z,90,23 +37.7783,-122.4110,2023-01-01T13:25:00Z,95,23 +37.7785,-122.4105,2023-01-01T13:30:00Z,100,23 +37.7787,-122.4100,2023-01-01T13:35:00Z,105,23 \ No newline at end of file diff -r 000000000000 -r 7bc130112fa3 test-data/geolocation_1.geojson --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/geolocation_1.geojson Tue Apr 22 15:18:12 2025 +0000 @@ -0,0 +1,371 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "0", + "type": "Feature", + "properties": { + "latitude": 37.7749, + "longitude": -122.4194, + "timestamp": "2023-01-01T12:00:00Z", + "value": 10, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7749, + -122.4194 + ] + } + }, + { + "id": "1", + "type": "Feature", + "properties": { + "latitude": 37.7751, + "longitude": -122.419, + "timestamp": "2023-01-01T12:05:00Z", + "value": 15, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7751, + -122.419 + ] + } + }, + { + "id": "2", + "type": "Feature", + "properties": { + "latitude": 37.7753, + "longitude": -122.4185, + "timestamp": "2023-01-01T12:10:00Z", + "value": 20, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7753, + -122.4185 + ] + } + }, + { + "id": "3", + "type": "Feature", + "properties": { + "latitude": 37.7755, + "longitude": -122.418, + "timestamp": "2023-01-01T12:15:00Z", + "value": 25, + "temperature": 24 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7755, + -122.418 + ] + } + }, + { + "id": "4", + "type": "Feature", + "properties": { + "latitude": 37.7757, + "longitude": -122.4175, + "timestamp": "2023-01-01T12:20:00Z", + "value": 30, + "temperature": 25 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7757, + -122.4175 + ] + } + }, + { + "id": "5", + "type": "Feature", + "properties": { + "latitude": 37.7759, + "longitude": -122.417, + "timestamp": "2023-01-01T12:25:00Z", + "value": 35, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7759, + -122.417 + ] + } + }, + { + "id": "6", + "type": "Feature", + "properties": { + "latitude": 37.7761, + "longitude": -122.4165, + "timestamp": "2023-01-01T12:30:00Z", + "value": 40, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7761, + -122.4165 + ] + } + }, + { + "id": "7", + "type": "Feature", + "properties": { + "latitude": 37.7763, + "longitude": -122.416, + "timestamp": "2023-01-01T12:35:00Z", + "value": 45, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7763, + -122.416 + ] + } + }, + { + "id": "8", + "type": "Feature", + "properties": { + "latitude": 37.7765, + "longitude": -122.4155, + "timestamp": "2023-01-01T12:40:00Z", + "value": 50, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7765, + -122.4155 + ] + } + }, + { + "id": "9", + "type": "Feature", + "properties": { + "latitude": 37.7767, + "longitude": -122.415, + "timestamp": "2023-01-01T12:45:00Z", + "value": 55, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7767, + -122.415 + ] + } + }, + { + "id": "10", + "type": "Feature", + "properties": { + "latitude": 37.7769, + "longitude": -122.4145, + "timestamp": "2023-01-01T12:50:00Z", + "value": 60, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7769, + -122.4145 + ] + } + }, + { + "id": "11", + "type": "Feature", + "properties": { + "latitude": 37.7771, + "longitude": -122.414, + "timestamp": "2023-01-01T12:55:00Z", + "value": 65, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7771, + -122.414 + ] + } + }, + { + "id": "12", + "type": "Feature", + "properties": { + "latitude": 37.7773, + "longitude": -122.4135, + "timestamp": "2023-01-01T13:00:00Z", + "value": 70, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7773, + -122.4135 + ] + } + }, + { + "id": "13", + "type": "Feature", + "properties": { + "latitude": 37.7775, + "longitude": -122.413, + "timestamp": "2023-01-01T13:05:00Z", + "value": 75, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7775, + -122.413 + ] + } + }, + { + "id": "14", + "type": "Feature", + "properties": { + "latitude": 37.7777, + "longitude": -122.4125, + "timestamp": "2023-01-01T13:10:00Z", + "value": 80, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7777, + -122.4125 + ] + } + }, + { + "id": "15", + "type": "Feature", + "properties": { + "latitude": 37.7779, + "longitude": -122.412, + "timestamp": "2023-01-01T13:15:00Z", + "value": 85, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7779, + -122.412 + ] + } + }, + { + "id": "16", + "type": "Feature", + "properties": { + "latitude": 37.7781, + "longitude": -122.4115, + "timestamp": "2023-01-01T13:20:00Z", + "value": 90, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7781, + -122.4115 + ] + } + }, + { + "id": "17", + "type": "Feature", + "properties": { + "latitude": 37.7783, + "longitude": -122.411, + "timestamp": "2023-01-01T13:25:00Z", + "value": 95, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7783, + -122.411 + ] + } + }, + { + "id": "18", + "type": "Feature", + "properties": { + "latitude": 37.7785, + "longitude": -122.4105, + "timestamp": "2023-01-01T13:30:00Z", + "value": 100, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7785, + -122.4105 + ] + } + }, + { + "id": "19", + "type": "Feature", + "properties": { + "latitude": 37.7787, + "longitude": -122.41, + "timestamp": "2023-01-01T13:35:00Z", + "value": 105, + "temperature": 23 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7787, + -122.41 + ] + } + } + ], + "crs": { + "type": "name", + "properties": { + "name": "urn:ogc:def:crs:EPSG::3857" + } + } +} \ No newline at end of file diff -r 000000000000 -r 7bc130112fa3 test-data/geolocation_2.geojson --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/geolocation_2.geojson Tue Apr 22 15:18:12 2025 +0000 @@ -0,0 +1,311 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "0", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:00:00Z", + "value": 10 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7749, + -122.4194 + ] + } + }, + { + "id": "1", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:05:00Z", + "value": 15 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7751, + -122.419 + ] + } + }, + { + "id": "2", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:10:00Z", + "value": 20 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7753, + -122.4185 + ] + } + }, + { + "id": "3", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:15:00Z", + "value": 25 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7755, + -122.418 + ] + } + }, + { + "id": "4", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:20:00Z", + "value": 30 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7757, + -122.4175 + ] + } + }, + { + "id": "5", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:25:00Z", + "value": 35 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7759, + -122.417 + ] + } + }, + { + "id": "6", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:30:00Z", + "value": 40 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7761, + -122.4165 + ] + } + }, + { + "id": "7", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:35:00Z", + "value": 45 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7763, + -122.416 + ] + } + }, + { + "id": "8", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:40:00Z", + "value": 50 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7765, + -122.4155 + ] + } + }, + { + "id": "9", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:45:00Z", + "value": 55 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7767, + -122.415 + ] + } + }, + { + "id": "10", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:50:00Z", + "value": 60 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7769, + -122.4145 + ] + } + }, + { + "id": "11", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T12:55:00Z", + "value": 65 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7771, + -122.414 + ] + } + }, + { + "id": "12", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T13:00:00Z", + "value": 70 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7773, + -122.4135 + ] + } + }, + { + "id": "13", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T13:05:00Z", + "value": 75 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7775, + -122.413 + ] + } + }, + { + "id": "14", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T13:10:00Z", + "value": 80 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7777, + -122.4125 + ] + } + }, + { + "id": "15", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T13:15:00Z", + "value": 85 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7779, + -122.412 + ] + } + }, + { + "id": "16", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T13:20:00Z", + "value": 90 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7781, + -122.4115 + ] + } + }, + { + "id": "17", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T13:25:00Z", + "value": 95 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7783, + -122.411 + ] + } + }, + { + "id": "18", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T13:30:00Z", + "value": 100 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7785, + -122.4105 + ] + } + }, + { + "id": "19", + "type": "Feature", + "properties": { + "timestamp": "2023-01-01T13:35:00Z", + "value": 105 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7787, + -122.41 + ] + } + } + ], + "crs": { + "type": "name", + "properties": { + "name": "urn:ogc:def:crs:EPSG::3857" + } + } +} \ No newline at end of file diff -r 000000000000 -r 7bc130112fa3 test-data/geolocation_3.geojson --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/geolocation_3.geojson Tue Apr 22 15:18:12 2025 +0000 @@ -0,0 +1,351 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "0", + "type": "Feature", + "properties": { + "latitude": 37.7749, + "longitude": -122.4194, + "timestamp": "2023-01-01T12:00:00Z", + "value": 10 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7749, + -122.4194 + ] + } + }, + { + "id": "1", + "type": "Feature", + "properties": { + "latitude": 37.7751, + "longitude": -122.419, + "timestamp": "2023-01-01T12:05:00Z", + "value": 15 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7751, + -122.419 + ] + } + }, + { + "id": "2", + "type": "Feature", + "properties": { + "latitude": 37.7753, + "longitude": -122.4185, + "timestamp": "2023-01-01T12:10:00Z", + "value": 20 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7753, + -122.4185 + ] + } + }, + { + "id": "3", + "type": "Feature", + "properties": { + "latitude": 37.7755, + "longitude": -122.418, + "timestamp": "2023-01-01T12:15:00Z", + "value": 25 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7755, + -122.418 + ] + } + }, + { + "id": "4", + "type": "Feature", + "properties": { + "latitude": 37.7757, + "longitude": -122.4175, + "timestamp": "2023-01-01T12:20:00Z", + "value": 30 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7757, + -122.4175 + ] + } + }, + { + "id": "5", + "type": "Feature", + "properties": { + "latitude": 37.7759, + "longitude": -122.417, + "timestamp": "2023-01-01T12:25:00Z", + "value": 35 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7759, + -122.417 + ] + } + }, + { + "id": "6", + "type": "Feature", + "properties": { + "latitude": 37.7761, + "longitude": -122.4165, + "timestamp": "2023-01-01T12:30:00Z", + "value": 40 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7761, + -122.4165 + ] + } + }, + { + "id": "7", + "type": "Feature", + "properties": { + "latitude": 37.7763, + "longitude": -122.416, + "timestamp": "2023-01-01T12:35:00Z", + "value": 45 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7763, + -122.416 + ] + } + }, + { + "id": "8", + "type": "Feature", + "properties": { + "latitude": 37.7765, + "longitude": -122.4155, + "timestamp": "2023-01-01T12:40:00Z", + "value": 50 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7765, + -122.4155 + ] + } + }, + { + "id": "9", + "type": "Feature", + "properties": { + "latitude": 37.7767, + "longitude": -122.415, + "timestamp": "2023-01-01T12:45:00Z", + "value": 55 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7767, + -122.415 + ] + } + }, + { + "id": "10", + "type": "Feature", + "properties": { + "latitude": 37.7769, + "longitude": -122.4145, + "timestamp": "2023-01-01T12:50:00Z", + "value": 60 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7769, + -122.4145 + ] + } + }, + { + "id": "11", + "type": "Feature", + "properties": { + "latitude": 37.7771, + "longitude": -122.414, + "timestamp": "2023-01-01T12:55:00Z", + "value": 65 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7771, + -122.414 + ] + } + }, + { + "id": "12", + "type": "Feature", + "properties": { + "latitude": 37.7773, + "longitude": -122.4135, + "timestamp": "2023-01-01T13:00:00Z", + "value": 70 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7773, + -122.4135 + ] + } + }, + { + "id": "13", + "type": "Feature", + "properties": { + "latitude": 37.7775, + "longitude": -122.413, + "timestamp": "2023-01-01T13:05:00Z", + "value": 75 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7775, + -122.413 + ] + } + }, + { + "id": "14", + "type": "Feature", + "properties": { + "latitude": 37.7777, + "longitude": -122.4125, + "timestamp": "2023-01-01T13:10:00Z", + "value": 80 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7777, + -122.4125 + ] + } + }, + { + "id": "15", + "type": "Feature", + "properties": { + "latitude": 37.7779, + "longitude": -122.412, + "timestamp": "2023-01-01T13:15:00Z", + "value": 85 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7779, + -122.412 + ] + } + }, + { + "id": "16", + "type": "Feature", + "properties": { + "latitude": 37.7781, + "longitude": -122.4115, + "timestamp": "2023-01-01T13:20:00Z", + "value": 90 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7781, + -122.4115 + ] + } + }, + { + "id": "17", + "type": "Feature", + "properties": { + "latitude": 37.7783, + "longitude": -122.411, + "timestamp": "2023-01-01T13:25:00Z", + "value": 95 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7783, + -122.411 + ] + } + }, + { + "id": "18", + "type": "Feature", + "properties": { + "latitude": 37.7785, + "longitude": -122.4105, + "timestamp": "2023-01-01T13:30:00Z", + "value": 100 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7785, + -122.4105 + ] + } + }, + { + "id": "19", + "type": "Feature", + "properties": { + "latitude": 37.7787, + "longitude": -122.41, + "timestamp": "2023-01-01T13:35:00Z", + "value": 105 + }, + "geometry": { + "type": "Point", + "coordinates": [ + 37.7787, + -122.41 + ] + } + } + ], + "crs": { + "type": "name", + "properties": { + "name": "urn:ogc:def:crs:EPSG::3857" + } + } +} \ No newline at end of file