|
43 | 43 | "source": [ |
44 | 44 | "## Loading CSV Data\n", |
45 | 45 | "\n", |
46 | | - "First up, let’s load a CSV file with PLUTO data. We’ll tell UrbanMapper where to find the longitude and latitude columns so it knows what’s what and can make sure those colums are well formatted prior any analysis.\n", |
| 46 | + "First up, let’s load a CSV file with PLUTO data. We’ll tell UrbanMapper where to find the longitude-latitude or geometry columns so it knows what’s what and can make sure those colums are well formatted prior any analysis.\n", |
47 | 47 | "\n", |
48 | 48 | "Note that below we employ a given csv, but you can put your own path, try it out!" |
49 | 49 | ] |
|
59 | 59 | " .loader # From the loader module\n", |
60 | 60 | " .from_file(\"<path_to>/pluto.csv\") # To update with your own path\n", |
61 | 61 | " .with_columns(longitude_column=\"longitude\", latitude_column=\"latitude\") # Inform your long and lat columns\n", |
| 62 | + "# .with_columns(geometry_column=<geometry_column_name>\") # Replace <geometry_column_name> with the actual name of your geometry column instead of latitude and longitude columns.\n", |
62 | 63 | ")\n", |
63 | 64 | "\n", |
64 | 65 | "gdf = csv_loader.load() # Load the data and create a geodataframe's instance\n", |
|
87 | 88 | " loader. # From the loader module\n", |
88 | 89 | " from_file(\"<path_to>/taxisvis5M.parquet\") # To update with your own path\n", |
89 | 90 | " .with_columns(\"pickup_longitude\", \"pickup_latitude\") # Inform your long and lat columns\n", |
| 91 | + "# .with_columns(geometry_column=<geometry_column_name>\") # Replace <geometry_column_name> with the actual name of your geometry column instead of latitude and longitude columns.\n", |
90 | 92 | ")\n", |
91 | 93 | "\n", |
92 | 94 | "gdf = parquet_loader.load() # Load the data and create a geodataframe's instance\n", |
|
163 | 165 | " .loader # From the loader module\n", |
164 | 166 | " .from_dataframe(df) # To update with your dataframe\n", |
165 | 167 | " .with_columns(longitude_column=\"longitude\", latitude_column=\"latitude\") # Inform your long and lat columns\n", |
| 168 | + "# .with_columns(geometry_column=<geometry_column_name>\") # Replace <geometry_column_name> with the actual name of your geometry column instead of latitude and longitude columns.\n", |
166 | 169 | ")\n", |
167 | 170 | "\n", |
168 | 171 | "gdf = df_loader.load() # Load the data and create a geodataframe's instance\n", |
|
187 | 190 | "outputs": [], |
188 | 191 | "source": [ |
189 | 192 | "# Load a full dataset directly from Hugging Face\n", |
190 | | - "loader = mapper.loader.from_huggingface(\"oscur/pluto\", number_of_rows=100).with_columns(longitude_column=\"longitude\", latitude_column=\"latitude\")\n", |
| 193 | + "loader = (\n", |
| 194 | + " mapper\n", |
| 195 | + " .loader\n", |
| 196 | + " .from_huggingface(\"oscur/pluto\", number_of_rows=100)\n", |
| 197 | + " .with_columns(longitude_column=\"longitude\", latitude_column=\"latitude\")\n", |
| 198 | + "# .with_columns(geometry_column=<geometry_column_name>\") # Replace <geometry_column_name> with the actual name of your geometry column instead of latitude and longitude columns. \n", |
| 199 | + ") \n", |
| 200 | + "gdf = loader.load()\n", |
| 201 | + "gdf # Next steps: analyze or visualize the data" |
| 202 | + ] |
| 203 | + }, |
| 204 | + { |
| 205 | + "cell_type": "code", |
| 206 | + "execution_count": null, |
| 207 | + "metadata": {}, |
| 208 | + "outputs": [], |
| 209 | + "source": [ |
| 210 | + "# Load a full dataset directly from Hugging Face\n", |
| 211 | + "loader = (\n", |
| 212 | + " mapper\n", |
| 213 | + " .loader\n", |
| 214 | + " .from_huggingface(\"oscur/NYC_raised_crosswalk\", number_of_rows=100)\n", |
| 215 | + " .with_columns(geometry_column=\"WKT Geometry\") # Inform your geometry column instead of longitude and latitude columns. \n", |
| 216 | + ") \n", |
191 | 217 | "gdf = loader.load()\n", |
192 | 218 | "gdf # Next steps: analyze or visualize the data" |
193 | 219 | ] |
|
224 | 250 | "outputs": [], |
225 | 251 | "source": [ |
226 | 252 | "# Load datasets directly from Hugging Face\n", |
227 | | - "pluto_data = mapper.loader.from_huggingface(\"oscur/pluto\", number_of_rows=100).with_columns(longitude_column=\"longitude\", latitude_column=\"latitude\").load()\n", |
| 253 | + "pluto_data = (\n", |
| 254 | + " mapper\n", |
| 255 | + " .loader\n", |
| 256 | + " .from_huggingface(\"oscur/pluto\", number_of_rows=100)\n", |
| 257 | + " .with_columns(longitude_column=\"longitude\", latitude_column=\"latitude\")\n", |
| 258 | + "# .with_columns(geometry_column=<geometry_column_name>\") # Replace <geometry_column_name> with the actual name of your geometry column instead of latitude and longitude columns. \n", |
| 259 | + " .load()\n", |
| 260 | + ")\n", |
228 | 261 | "taxi_data = (\n", |
229 | 262 | " mapper\n", |
230 | 263 | " .loader\n", |
231 | 264 | " .from_huggingface(\"oscur/taxisvis1M\", number_of_rows=100)\n", |
232 | 265 | " .with_columns(longitude_column=\"pickup_longitude\", latitude_column=\"pickup_latitude\")\n", |
| 266 | + "# .with_columns(geometry_column=<geometry_column_name>\") # Replace <geometry_column_name> with the actual name of your geometry column instead of latitude and longitude columns. \n", |
233 | 267 | " .with_map({\"pickup_longitude\": \"longitude\", \"pickup_latitude\": \"latitude\"}) ## Routines like layer.map_nearest_layer needs datasets with the same longitude_column and latitude_column\n", |
234 | 268 | " .load()\n", |
235 | 269 | ")\n", |
|
0 commit comments