├── .gitignore ├── README.md ├── appendto ├── .gitignore ├── python_maps │ ├── .ipynb_checkpoints │ │ ├── Untitled-checkpoint.ipynb │ │ └── campground data-checkpoint.ipynb │ ├── Untitled.ipynb │ ├── campground data.ipynb │ ├── campgrounds.csv │ └── collection.geojson ├── python_maps_2 │ └── collection.geojson ├── react_nps │ ├── __init__.py │ ├── get_nps_from_ridb.ipynb │ ├── missing_lat_longs.csv │ ├── np.geojson │ └── np_info.csv └── react_redux_camping_filters │ ├── .gitignore │ ├── README.md │ ├── collection.geojson │ ├── images │ ├── Crater_Lake_Mazama_Campground.jpg │ ├── craterlake_smaller.jpg │ ├── farewellbend.jpg │ ├── hamaker.jpg │ ├── huckleberry.jpg │ ├── lost creek cg nps.html │ ├── lostcreek.jpg │ ├── mazama.jpg │ ├── naturalbridge.jpg │ ├── scottcreek.jpg │ ├── screenshot.png │ └── unioncreek.jpg │ ├── package.json │ ├── public │ ├── favicon.ico │ └── index.html │ └── src │ ├── App.css │ ├── App.test.js │ ├── CampFilter.jsx │ ├── CampFilterApp.jsx │ ├── CampFilterList.jsx │ ├── CampList.jsx │ ├── CampListItem.jsx │ ├── CampMap.jsx │ ├── CampMapContainer.jsx │ ├── GoogleApiComponent.js │ ├── InfoWindow.jsx │ ├── Marker.jsx │ ├── WeatherDatePicker.jsx │ ├── action_creators.js │ ├── config.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── reducer.js │ └── utils │ ├── GoogleApi.js │ └── ScriptCache.js ├── distance_calc ├── Untitled.ipynb ├── __pycache__ │ └── config.cpython-34.pyc ├── cl3.csv ├── distance box.ipynb └── distance.ipynb └── odsc └── intro_oods ├── .gitignore ├── .ipynb_checkpoints └── OODS post-checkpoint.ipynb ├── OODS post.ipynb ├── __pycache__ └── config.cpython-34.pyc └── pdsg_meetup_nov_2016.pdf /.gitignore: -------------------------------------------------------------------------------- 1 | */.ipynb_checkpoints/ 2 | .ipynb_checkpoints/* 3 | *config.py 4 | __pycache__/* 5 | 6 | node_modules 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repo contains code samples for my blog articles 2 | -------------------------------------------------------------------------------- /appendto/.gitignore: -------------------------------------------------------------------------------- 1 | blog post images/ 2 | -------------------------------------------------------------------------------- /appendto/python_maps/.ipynb_checkpoints/Untitled-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [], 3 | "metadata": {}, 4 | "nbformat": 4, 5 | "nbformat_minor": 0 6 | } 7 | -------------------------------------------------------------------------------- /appendto/python_maps/.ipynb_checkpoints/campground data-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 156, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import pandas as pd\n", 12 | "import numpy as np\n", 13 | "from pandas import json" 14 | ] 15 | }, 16 | { 17 | "cell_type": "code", 18 | "execution_count": 157, 19 | "metadata": { 20 | "collapsed": true 21 | }, 22 | "outputs": [], 23 | "source": [ 24 | "cg_data = pd.read_csv('campgrounds.csv')" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 158, 30 | "metadata": { 31 | "collapsed": false 32 | }, 33 | "outputs": [ 34 | { 35 | "data": { 36 | "text/plain": [ 37 | "(11, 6)" 38 | ] 39 | }, 40 | "execution_count": 158, 41 | "metadata": {}, 42 | "output_type": "execute_result" 43 | } 44 | ], 45 | "source": [ 46 | "cg_data.shape" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 159, 52 | "metadata": { 53 | "collapsed": false 54 | }, 55 | "outputs": [ 56 | { 57 | "data": { 58 | "text/html": [ 59 | "
\n", 60 | "\n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | " \n", 66 | " \n", 67 | " \n", 68 | " \n", 69 | " \n", 70 | " \n", 71 | " \n", 72 | " \n", 73 | " \n", 74 | " \n", 75 | " \n", 76 | " \n", 77 | " \n", 78 | " \n", 79 | " \n", 80 | " \n", 81 | " \n", 82 | " \n", 83 | " \n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | "
facilitynamefacilitylatitudefacilitylongitudeflushshowervault
0Mazama42.865508-122.16614911\\N
1Claude Lewis Sno-Park-USFS43.063217-122.342876\\N\\N1
2Lost Creek42.879145-122.0378811\\N\\N
3Hamaker43.056641-122.330322\\N\\N1
4Huckleberry Mountain42.877807-122.337174\\N\\N1
\n", 120 | "
" 121 | ], 122 | "text/plain": [ 123 | " facilityname facilitylatitude facilitylongitude flush \\\n", 124 | "0 Mazama 42.865508 -122.166149 1 \n", 125 | "1 Claude Lewis Sno-Park-USFS 43.063217 -122.342876 \\N \n", 126 | "2 Lost Creek 42.879145 -122.037881 1 \n", 127 | "3 Hamaker 43.056641 -122.330322 \\N \n", 128 | "4 Huckleberry Mountain 42.877807 -122.337174 \\N \n", 129 | "\n", 130 | " shower vault \n", 131 | "0 1 \\N \n", 132 | "1 \\N 1 \n", 133 | "2 \\N \\N \n", 134 | "3 \\N 1 \n", 135 | "4 \\N 1 " 136 | ] 137 | }, 138 | "execution_count": 159, 139 | "metadata": {}, 140 | "output_type": "execute_result" 141 | } 142 | ], 143 | "source": [ 144 | "cg_data.head()" 145 | ] 146 | }, 147 | { 148 | "cell_type": "markdown", 149 | "metadata": {}, 150 | "source": [ 151 | "Cleaning the data. We want to transform the info in this dataframe to be used for creating geojson. A new field 'description' will be created to convey the flush / shower / vault toilet amentities" 152 | ] 153 | }, 154 | { 155 | "cell_type": "raw", 156 | "metadata": {}, 157 | "source": [ 158 | "Example GeoJSON:\n", 159 | "{\n", 160 | " \"type\": \"Feature\",\n", 161 | " \"properties\": {\n", 162 | " \"title\":\"Ainsworth State Park\",\n", 163 | " \"description\": \"Flush toilet, shower\"\n", 164 | " }\n", 165 | " \"geometry\": {\n", 166 | " \"type\": \"Point\",\n", 167 | " \"coordinates\":[-122.048974,45.59844]\n", 168 | " }\n", 169 | "}" 170 | ] 171 | }, 172 | { 173 | "cell_type": "code", 174 | "execution_count": 166, 175 | "metadata": { 176 | "collapsed": true 177 | }, 178 | "outputs": [], 179 | "source": [ 180 | "cg_data_clean = cg_data" 181 | ] 182 | }, 183 | { 184 | "cell_type": "markdown", 185 | "metadata": {}, 186 | "source": [ 187 | "The flush, shower, and vault fields have a possible value of 0=False, 1=True, or \\N= info not available. We are only interested in the presence or lack of for these fields, so change values of '1' to the amenity name and values of '0' and '\\N' to empty. Note the second \\ used to escape the \\N" 188 | ] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": 167, 193 | "metadata": { 194 | "collapsed": false 195 | }, 196 | "outputs": [], 197 | "source": [ 198 | "cg_data_clean = cg_data_clean.replace({'flush': {'1':'Flush toilet', '0':'', '\\\\N':''}})\n", 199 | "cg_data_clean = cg_data_clean.replace({'shower': {'1':'Shower', '0':'', '\\\\N':''}})\n", 200 | "cg_data_clean = cg_data_clean.replace({'vault': {'1':'Vault toilet', '0':'', '\\\\N':''}})" 201 | ] 202 | }, 203 | { 204 | "cell_type": "markdown", 205 | "metadata": {}, 206 | "source": [ 207 | "The title field for the geojson feature will be the campground name. Standardize the lat/long names as well" 208 | ] 209 | }, 210 | { 211 | "cell_type": "code", 212 | "execution_count": 168, 213 | "metadata": { 214 | "collapsed": false 215 | }, 216 | "outputs": [], 217 | "source": [ 218 | "cg_data_clean = cg_data_clean.rename(columns={'facilityname': 'title', \n", 219 | " 'facilitylatitude':'latitude', \n", 220 | " 'facilitylongitude':'longitude'})" 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 169, 226 | "metadata": { 227 | "collapsed": false, 228 | "scrolled": true 229 | }, 230 | "outputs": [ 231 | { 232 | "data": { 233 | "text/html": [ 234 | "
\n", 235 | "\n", 236 | " \n", 237 | " \n", 238 | " \n", 239 | " \n", 240 | " \n", 241 | " \n", 242 | " \n", 243 | " \n", 244 | " \n", 245 | " \n", 246 | " \n", 247 | " \n", 248 | " \n", 249 | " \n", 250 | " \n", 251 | " \n", 252 | " \n", 253 | " \n", 254 | " \n", 255 | " \n", 256 | " \n", 257 | " \n", 258 | " \n", 259 | " \n", 260 | " \n", 261 | " \n", 262 | " \n", 263 | " \n", 264 | " \n", 265 | " \n", 266 | " \n", 267 | " \n", 268 | " \n", 269 | " \n", 270 | " \n", 271 | " \n", 272 | " \n", 273 | " \n", 274 | " \n", 275 | " \n", 276 | " \n", 277 | " \n", 278 | " \n", 279 | " \n", 280 | " \n", 281 | " \n", 282 | " \n", 283 | " \n", 284 | " \n", 285 | " \n", 286 | " \n", 287 | " \n", 288 | " \n", 289 | " \n", 290 | " \n", 291 | " \n", 292 | " \n", 293 | " \n", 294 | " \n", 295 | " \n", 296 | " \n", 297 | " \n", 298 | " \n", 299 | " \n", 300 | " \n", 301 | " \n", 302 | " \n", 303 | " \n", 304 | " \n", 305 | " \n", 306 | " \n", 307 | " \n", 308 | " \n", 309 | " \n", 310 | " \n", 311 | " \n", 312 | " \n", 313 | " \n", 314 | " \n", 315 | " \n", 316 | " \n", 317 | " \n", 318 | " \n", 319 | " \n", 320 | " \n", 321 | " \n", 322 | " \n", 323 | " \n", 324 | " \n", 325 | " \n", 326 | " \n", 327 | " \n", 328 | " \n", 329 | " \n", 330 | " \n", 331 | " \n", 332 | " \n", 333 | " \n", 334 | " \n", 335 | " \n", 336 | " \n", 337 | " \n", 338 | " \n", 339 | " \n", 340 | " \n", 341 | " \n", 342 | " \n", 343 | " \n", 344 | " \n", 345 | " \n", 346 | " \n", 347 | " \n", 348 | "
titlelatitudelongitudeflushshowervault
0Mazama42.865508-122.166149Flush toiletShower
1Claude Lewis Sno-Park-USFS43.063217-122.342876Vault toilet
2Lost Creek42.879145-122.037881Flush toilet
3Hamaker43.056641-122.330322Vault toilet
4Huckleberry Mountain42.877807-122.337174Vault toilet
5Natural Bridge -USFS42.889648-122.463867Vault toilet
6Farewell Bend42.919678-122.433105
7Scott Creek42.884588-121.924772Vault toilet
8Thousand Springs Sno-Park-USFS42.913045-122.324644Vault toilet
9Union Creek42.910278-122.450000Vault toilet
10Farewell Bend Campground42.916239-122.435331
\n", 349 | "
" 350 | ], 351 | "text/plain": [ 352 | " title latitude longitude flush \\\n", 353 | "0 Mazama 42.865508 -122.166149 Flush toilet \n", 354 | "1 Claude Lewis Sno-Park-USFS 43.063217 -122.342876 \n", 355 | "2 Lost Creek 42.879145 -122.037881 Flush toilet \n", 356 | "3 Hamaker 43.056641 -122.330322 \n", 357 | "4 Huckleberry Mountain 42.877807 -122.337174 \n", 358 | "5 Natural Bridge -USFS 42.889648 -122.463867 \n", 359 | "6 Farewell Bend 42.919678 -122.433105 \n", 360 | "7 Scott Creek 42.884588 -121.924772 \n", 361 | "8 Thousand Springs Sno-Park-USFS 42.913045 -122.324644 \n", 362 | "9 Union Creek 42.910278 -122.450000 \n", 363 | "10 Farewell Bend Campground 42.916239 -122.435331 \n", 364 | "\n", 365 | " shower vault \n", 366 | "0 Shower \n", 367 | "1 Vault toilet \n", 368 | "2 \n", 369 | "3 Vault toilet \n", 370 | "4 Vault toilet \n", 371 | "5 Vault toilet \n", 372 | "6 \n", 373 | "7 Vault toilet \n", 374 | "8 Vault toilet \n", 375 | "9 Vault toilet \n", 376 | "10 " 377 | ] 378 | }, 379 | "execution_count": 169, 380 | "metadata": {}, 381 | "output_type": "execute_result" 382 | } 383 | ], 384 | "source": [ 385 | "cg_data_clean" 386 | ] 387 | }, 388 | { 389 | "cell_type": "markdown", 390 | "metadata": {}, 391 | "source": [ 392 | "Create a description field that combines our amenities into a single string" 393 | ] 394 | }, 395 | { 396 | "cell_type": "code", 397 | "execution_count": 190, 398 | "metadata": { 399 | "collapsed": false 400 | }, 401 | "outputs": [], 402 | "source": [ 403 | "cg_data_clean['description'] = cg_data_clean[['flush','shower','vault']].apply(lambda x: ', '.join(x), axis=1)" 404 | ] 405 | }, 406 | { 407 | "cell_type": "markdown", 408 | "metadata": {}, 409 | "source": [ 410 | "Clean the extraneous commas from the start and end of the description. Note that this will not strip extra commas in the middle of the description!" 411 | ] 412 | }, 413 | { 414 | "cell_type": "code", 415 | "execution_count": 173, 416 | "metadata": { 417 | "collapsed": true 418 | }, 419 | "outputs": [], 420 | "source": [ 421 | "def clean_description(description):\n", 422 | " description = description.strip()\n", 423 | " while((description.startswith(',') or description.endswith(',')) and len(description) > -1):\n", 424 | " if description.endswith(',') :\n", 425 | " description = description[0:len(description)-1]\n", 426 | " if description.startswith(',') :\n", 427 | " description = description[1:len(description)] \n", 428 | " description = description.strip()\n", 429 | " return description" 430 | ] 431 | }, 432 | { 433 | "cell_type": "code", 434 | "execution_count": 177, 435 | "metadata": { 436 | "collapsed": false 437 | }, 438 | "outputs": [], 439 | "source": [ 440 | "cg_data_clean['description'] = cg_data_clean.description.apply(lambda x: clean_description(x))" 441 | ] 442 | }, 443 | { 444 | "cell_type": "code", 445 | "execution_count": 178, 446 | "metadata": { 447 | "collapsed": false 448 | }, 449 | "outputs": [ 450 | { 451 | "data": { 452 | "text/html": [ 453 | "
\n", 454 | "\n", 455 | " \n", 456 | " \n", 457 | " \n", 458 | " \n", 459 | " \n", 460 | " \n", 461 | " \n", 462 | " \n", 463 | " \n", 464 | " \n", 465 | " \n", 466 | " \n", 467 | " \n", 468 | " \n", 469 | " \n", 470 | " \n", 471 | " \n", 472 | " \n", 473 | " \n", 474 | " \n", 475 | " \n", 476 | " \n", 477 | " \n", 478 | " \n", 479 | " \n", 480 | " \n", 481 | " \n", 482 | " \n", 483 | " \n", 484 | " \n", 485 | " \n", 486 | " \n", 487 | " \n", 488 | " \n", 489 | " \n", 490 | " \n", 491 | " \n", 492 | " \n", 493 | " \n", 494 | " \n", 495 | " \n", 496 | " \n", 497 | " \n", 498 | " \n", 499 | " \n", 500 | " \n", 501 | " \n", 502 | " \n", 503 | " \n", 504 | " \n", 505 | " \n", 506 | " \n", 507 | " \n", 508 | " \n", 509 | " \n", 510 | " \n", 511 | " \n", 512 | " \n", 513 | " \n", 514 | " \n", 515 | " \n", 516 | " \n", 517 | " \n", 518 | " \n", 519 | " \n", 520 | " \n", 521 | " \n", 522 | " \n", 523 | " \n", 524 | " \n", 525 | " \n", 526 | " \n", 527 | " \n", 528 | " \n", 529 | " \n", 530 | " \n", 531 | " \n", 532 | " \n", 533 | " \n", 534 | " \n", 535 | " \n", 536 | " \n", 537 | " \n", 538 | " \n", 539 | " \n", 540 | " \n", 541 | " \n", 542 | " \n", 543 | " \n", 544 | " \n", 545 | " \n", 546 | " \n", 547 | " \n", 548 | " \n", 549 | " \n", 550 | " \n", 551 | " \n", 552 | " \n", 553 | " \n", 554 | " \n", 555 | " \n", 556 | " \n", 557 | " \n", 558 | " \n", 559 | " \n", 560 | " \n", 561 | " \n", 562 | " \n", 563 | " \n", 564 | " \n", 565 | " \n", 566 | " \n", 567 | " \n", 568 | " \n", 569 | " \n", 570 | " \n", 571 | " \n", 572 | " \n", 573 | " \n", 574 | " \n", 575 | " \n", 576 | " \n", 577 | " \n", 578 | " \n", 579 | "
titlelatitudelongitudeflushshowervaultdescription
0Mazama42.865508-122.166149Flush toiletShowerFlush toilet, Shower
1Claude Lewis Sno-Park-USFS43.063217-122.342876Vault toiletVault toilet
2Lost Creek42.879145-122.037881Flush toiletFlush toilet
3Hamaker43.056641-122.330322Vault toiletVault toilet
4Huckleberry Mountain42.877807-122.337174Vault toiletVault toilet
5Natural Bridge -USFS42.889648-122.463867Vault toiletVault toilet
6Farewell Bend42.919678-122.433105
7Scott Creek42.884588-121.924772Vault toiletVault toilet
8Thousand Springs Sno-Park-USFS42.913045-122.324644Vault toiletVault toilet
9Union Creek42.910278-122.450000Vault toiletVault toilet
10Farewell Bend Campground42.916239-122.435331
\n", 580 | "
" 581 | ], 582 | "text/plain": [ 583 | " title latitude longitude flush \\\n", 584 | "0 Mazama 42.865508 -122.166149 Flush toilet \n", 585 | "1 Claude Lewis Sno-Park-USFS 43.063217 -122.342876 \n", 586 | "2 Lost Creek 42.879145 -122.037881 Flush toilet \n", 587 | "3 Hamaker 43.056641 -122.330322 \n", 588 | "4 Huckleberry Mountain 42.877807 -122.337174 \n", 589 | "5 Natural Bridge -USFS 42.889648 -122.463867 \n", 590 | "6 Farewell Bend 42.919678 -122.433105 \n", 591 | "7 Scott Creek 42.884588 -121.924772 \n", 592 | "8 Thousand Springs Sno-Park-USFS 42.913045 -122.324644 \n", 593 | "9 Union Creek 42.910278 -122.450000 \n", 594 | "10 Farewell Bend Campground 42.916239 -122.435331 \n", 595 | "\n", 596 | " shower vault description \n", 597 | "0 Shower Flush toilet, Shower \n", 598 | "1 Vault toilet Vault toilet \n", 599 | "2 Flush toilet \n", 600 | "3 Vault toilet Vault toilet \n", 601 | "4 Vault toilet Vault toilet \n", 602 | "5 Vault toilet Vault toilet \n", 603 | "6 \n", 604 | "7 Vault toilet Vault toilet \n", 605 | "8 Vault toilet Vault toilet \n", 606 | "9 Vault toilet Vault toilet \n", 607 | "10 " 608 | ] 609 | }, 610 | "execution_count": 178, 611 | "metadata": {}, 612 | "output_type": "execute_result" 613 | } 614 | ], 615 | "source": [ 616 | "cg_data_clean" 617 | ] 618 | }, 619 | { 620 | "cell_type": "code", 621 | "execution_count": 179, 622 | "metadata": { 623 | "collapsed": false 624 | }, 625 | "outputs": [], 626 | "source": [ 627 | "geojson_df = cg_data_clean[['title','latitude','longitude','description']]" 628 | ] 629 | }, 630 | { 631 | "cell_type": "code", 632 | "execution_count": 180, 633 | "metadata": { 634 | "collapsed": false 635 | }, 636 | "outputs": [ 637 | { 638 | "data": { 639 | "text/html": [ 640 | "
\n", 641 | "\n", 642 | " \n", 643 | " \n", 644 | " \n", 645 | " \n", 646 | " \n", 647 | " \n", 648 | " \n", 649 | " \n", 650 | " \n", 651 | " \n", 652 | " \n", 653 | " \n", 654 | " \n", 655 | " \n", 656 | " \n", 657 | " \n", 658 | " \n", 659 | " \n", 660 | " \n", 661 | " \n", 662 | " \n", 663 | " \n", 664 | " \n", 665 | " \n", 666 | " \n", 667 | " \n", 668 | " \n", 669 | " \n", 670 | " \n", 671 | " \n", 672 | " \n", 673 | " \n", 674 | " \n", 675 | " \n", 676 | " \n", 677 | " \n", 678 | " \n", 679 | " \n", 680 | " \n", 681 | " \n", 682 | " \n", 683 | " \n", 684 | " \n", 685 | " \n", 686 | " \n", 687 | " \n", 688 | " \n", 689 | " \n", 690 | " \n", 691 | " \n", 692 | " \n", 693 | " \n", 694 | " \n", 695 | " \n", 696 | " \n", 697 | " \n", 698 | " \n", 699 | " \n", 700 | " \n", 701 | " \n", 702 | " \n", 703 | " \n", 704 | " \n", 705 | " \n", 706 | " \n", 707 | " \n", 708 | " \n", 709 | " \n", 710 | " \n", 711 | " \n", 712 | " \n", 713 | " \n", 714 | " \n", 715 | " \n", 716 | " \n", 717 | " \n", 718 | " \n", 719 | " \n", 720 | " \n", 721 | " \n", 722 | " \n", 723 | " \n", 724 | " \n", 725 | " \n", 726 | " \n", 727 | " \n", 728 | " \n", 729 | " \n", 730 | "
titlelatitudelongitudedescription
0Mazama42.865508-122.166149Flush toilet, Shower
1Claude Lewis Sno-Park-USFS43.063217-122.342876Vault toilet
2Lost Creek42.879145-122.037881Flush toilet
3Hamaker43.056641-122.330322Vault toilet
4Huckleberry Mountain42.877807-122.337174Vault toilet
5Natural Bridge -USFS42.889648-122.463867Vault toilet
6Farewell Bend42.919678-122.433105
7Scott Creek42.884588-121.924772Vault toilet
8Thousand Springs Sno-Park-USFS42.913045-122.324644Vault toilet
9Union Creek42.910278-122.450000Vault toilet
10Farewell Bend Campground42.916239-122.435331
\n", 731 | "
" 732 | ], 733 | "text/plain": [ 734 | " title latitude longitude \\\n", 735 | "0 Mazama 42.865508 -122.166149 \n", 736 | "1 Claude Lewis Sno-Park-USFS 43.063217 -122.342876 \n", 737 | "2 Lost Creek 42.879145 -122.037881 \n", 738 | "3 Hamaker 43.056641 -122.330322 \n", 739 | "4 Huckleberry Mountain 42.877807 -122.337174 \n", 740 | "5 Natural Bridge -USFS 42.889648 -122.463867 \n", 741 | "6 Farewell Bend 42.919678 -122.433105 \n", 742 | "7 Scott Creek 42.884588 -121.924772 \n", 743 | "8 Thousand Springs Sno-Park-USFS 42.913045 -122.324644 \n", 744 | "9 Union Creek 42.910278 -122.450000 \n", 745 | "10 Farewell Bend Campground 42.916239 -122.435331 \n", 746 | "\n", 747 | " description \n", 748 | "0 Flush toilet, Shower \n", 749 | "1 Vault toilet \n", 750 | "2 Flush toilet \n", 751 | "3 Vault toilet \n", 752 | "4 Vault toilet \n", 753 | "5 Vault toilet \n", 754 | "6 \n", 755 | "7 Vault toilet \n", 756 | "8 Vault toilet \n", 757 | "9 Vault toilet \n", 758 | "10 " 759 | ] 760 | }, 761 | "execution_count": 180, 762 | "metadata": {}, 763 | "output_type": "execute_result" 764 | } 765 | ], 766 | "source": [ 767 | "geojson_df" 768 | ] 769 | }, 770 | { 771 | "cell_type": "markdown", 772 | "metadata": {}, 773 | "source": [ 774 | "Creating the geojson from the dataframe. To use the apply function over each row of the dataframe, we will create a feature_from_row function that will be used as the lambda function. \n", 775 | "\n", 776 | "Each campground is a feature and will be added to the 'features' array in the FeatureCollection" 777 | ] 778 | }, 779 | { 780 | "cell_type": "code", 781 | "execution_count": 214, 782 | "metadata": { 783 | "collapsed": true 784 | }, 785 | "outputs": [], 786 | "source": [ 787 | "collection = {'type':'FeatureCollection', 'features':[]}" 788 | ] 789 | }, 790 | { 791 | "cell_type": "code", 792 | "execution_count": 215, 793 | "metadata": { 794 | "collapsed": true 795 | }, 796 | "outputs": [], 797 | "source": [ 798 | "def feature_from_row(title, latitude, longitude, description):\n", 799 | " feature = { 'type': 'Feature', \n", 800 | " 'properties': { 'title': '', 'description': ''},\n", 801 | " 'geometry': { 'type': 'Point', 'coordinates': []}\n", 802 | " }\n", 803 | " feature['geometry']['coordinates'] = [longitude, latitude]\n", 804 | " feature['properties']['title'] = title\n", 805 | " feature['properties']['description'] = description\n", 806 | " collection['features'].append(feature)\n", 807 | " return feature" 808 | ] 809 | }, 810 | { 811 | "cell_type": "code", 812 | "execution_count": 216, 813 | "metadata": { 814 | "collapsed": false 815 | }, 816 | "outputs": [], 817 | "source": [ 818 | "geojson_series = geojson_df.apply(lambda x: feature_from_row(x['title'],x['latitude'],x['longitude'],x['description']),\n", 819 | " axis=1)" 820 | ] 821 | }, 822 | { 823 | "cell_type": "code", 824 | "execution_count": 217, 825 | "metadata": { 826 | "collapsed": false 827 | }, 828 | "outputs": [ 829 | { 830 | "data": { 831 | "text/plain": [ 832 | "{'features': [{'geometry': {'coordinates': [-122.166149, 42.865508],\n", 833 | " 'type': 'Point'},\n", 834 | " 'properties': {'description': 'Flush toilet, Shower', 'title': 'Mazama'},\n", 835 | " 'type': 'Feature'},\n", 836 | " {'geometry': {'coordinates': [-122.342876, 43.063217], 'type': 'Point'},\n", 837 | " 'properties': {'description': 'Vault toilet',\n", 838 | " 'title': 'Claude Lewis Sno-Park-USFS'},\n", 839 | " 'type': 'Feature'},\n", 840 | " {'geometry': {'coordinates': [-122.037881, 42.879145], 'type': 'Point'},\n", 841 | " 'properties': {'description': 'Flush toilet', 'title': 'Lost Creek'},\n", 842 | " 'type': 'Feature'},\n", 843 | " {'geometry': {'coordinates': [-122.330322, 43.056641], 'type': 'Point'},\n", 844 | " 'properties': {'description': 'Vault toilet', 'title': 'Hamaker'},\n", 845 | " 'type': 'Feature'},\n", 846 | " {'geometry': {'coordinates': [-122.337174, 42.877807], 'type': 'Point'},\n", 847 | " 'properties': {'description': 'Vault toilet',\n", 848 | " 'title': 'Huckleberry Mountain'},\n", 849 | " 'type': 'Feature'},\n", 850 | " {'geometry': {'coordinates': [-122.463867, 42.889648], 'type': 'Point'},\n", 851 | " 'properties': {'description': 'Vault toilet',\n", 852 | " 'title': 'Natural Bridge -USFS'},\n", 853 | " 'type': 'Feature'},\n", 854 | " {'geometry': {'coordinates': [-122.433105, 42.91967800000001],\n", 855 | " 'type': 'Point'},\n", 856 | " 'properties': {'description': '', 'title': 'Farewell Bend'},\n", 857 | " 'type': 'Feature'},\n", 858 | " {'geometry': {'coordinates': [-121.924772, 42.884588], 'type': 'Point'},\n", 859 | " 'properties': {'description': 'Vault toilet', 'title': 'Scott Creek'},\n", 860 | " 'type': 'Feature'},\n", 861 | " {'geometry': {'coordinates': [-122.324644, 42.913045], 'type': 'Point'},\n", 862 | " 'properties': {'description': 'Vault toilet',\n", 863 | " 'title': 'Thousand Springs Sno-Park-USFS'},\n", 864 | " 'type': 'Feature'},\n", 865 | " {'geometry': {'coordinates': [-122.45, 42.910277777800005], 'type': 'Point'},\n", 866 | " 'properties': {'description': 'Vault toilet', 'title': 'Union Creek'},\n", 867 | " 'type': 'Feature'},\n", 868 | " {'geometry': {'coordinates': [-122.43533055555599, 42.9162388889],\n", 869 | " 'type': 'Point'},\n", 870 | " 'properties': {'description': '', 'title': 'Farewell Bend Campground'},\n", 871 | " 'type': 'Feature'}],\n", 872 | " 'type': 'FeatureCollection'}" 873 | ] 874 | }, 875 | "execution_count": 217, 876 | "metadata": {}, 877 | "output_type": "execute_result" 878 | } 879 | ], 880 | "source": [ 881 | "collection" 882 | ] 883 | }, 884 | { 885 | "cell_type": "code", 886 | "execution_count": 185, 887 | "metadata": { 888 | "collapsed": false 889 | }, 890 | "outputs": [], 891 | "source": [ 892 | "with open('collection.geojson', 'w') as outfile:\n", 893 | " \n", 894 | " json.dump(collection, outfile)" 895 | ] 896 | }, 897 | { 898 | "cell_type": "code", 899 | "execution_count": 188, 900 | "metadata": { 901 | "collapsed": true 902 | }, 903 | "outputs": [], 904 | "source": [ 905 | "test = pd.read_json('collection.geojson')" 906 | ] 907 | }, 908 | { 909 | "cell_type": "code", 910 | "execution_count": 189, 911 | "metadata": { 912 | "collapsed": false 913 | }, 914 | "outputs": [ 915 | { 916 | "data": { 917 | "text/html": [ 918 | "
\n", 919 | "\n", 920 | " \n", 921 | " \n", 922 | " \n", 923 | " \n", 924 | " \n", 925 | " \n", 926 | " \n", 927 | " \n", 928 | " \n", 929 | " \n", 930 | " \n", 931 | " \n", 932 | " \n", 933 | " \n", 934 | " \n", 935 | " \n", 936 | " \n", 937 | " \n", 938 | " \n", 939 | " \n", 940 | " \n", 941 | " \n", 942 | " \n", 943 | " \n", 944 | " \n", 945 | " \n", 946 | " \n", 947 | " \n", 948 | " \n", 949 | " \n", 950 | " \n", 951 | " \n", 952 | " \n", 953 | " \n", 954 | " \n", 955 | " \n", 956 | " \n", 957 | " \n", 958 | " \n", 959 | " \n", 960 | " \n", 961 | " \n", 962 | " \n", 963 | " \n", 964 | " \n", 965 | " \n", 966 | " \n", 967 | " \n", 968 | " \n", 969 | " \n", 970 | " \n", 971 | " \n", 972 | " \n", 973 | " \n", 974 | " \n", 975 | " \n", 976 | " \n", 977 | " \n", 978 | " \n", 979 | " \n", 980 | " \n", 981 | " \n", 982 | " \n", 983 | " \n", 984 | "
featurestype
0{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
1{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
2{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
3{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
4{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
5{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
6{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
7{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
8{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
9{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
10{'type': 'Feature', 'geometry': {'type': 'Poin...FeatureCollection
\n", 985 | "
" 986 | ], 987 | "text/plain": [ 988 | " features type\n", 989 | "0 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 990 | "1 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 991 | "2 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 992 | "3 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 993 | "4 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 994 | "5 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 995 | "6 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 996 | "7 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 997 | "8 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 998 | "9 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection\n", 999 | "10 {'type': 'Feature', 'geometry': {'type': 'Poin... FeatureCollection" 1000 | ] 1001 | }, 1002 | "execution_count": 189, 1003 | "metadata": {}, 1004 | "output_type": "execute_result" 1005 | } 1006 | ], 1007 | "source": [ 1008 | "test" 1009 | ] 1010 | }, 1011 | { 1012 | "cell_type": "code", 1013 | "execution_count": null, 1014 | "metadata": { 1015 | "collapsed": true 1016 | }, 1017 | "outputs": [], 1018 | "source": [] 1019 | } 1020 | ], 1021 | "metadata": { 1022 | "kernelspec": { 1023 | "display_name": "Python 3", 1024 | "language": "python", 1025 | "name": "python3" 1026 | }, 1027 | "language_info": { 1028 | "codemirror_mode": { 1029 | "name": "ipython", 1030 | "version": 3 1031 | }, 1032 | "file_extension": ".py", 1033 | "mimetype": "text/x-python", 1034 | "name": "python", 1035 | "nbconvert_exporter": "python", 1036 | "pygments_lexer": "ipython3", 1037 | "version": "3.4.3" 1038 | } 1039 | }, 1040 | "nbformat": 4, 1041 | "nbformat_minor": 0 1042 | } 1043 | -------------------------------------------------------------------------------- /appendto/python_maps/Untitled.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.4.3" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 0 34 | } 35 | -------------------------------------------------------------------------------- /appendto/python_maps/campground data.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import pandas as pd\n", 12 | "import numpy as np\n", 13 | "from pandas import json" 14 | ] 15 | }, 16 | { 17 | "cell_type": "code", 18 | "execution_count": 2, 19 | "metadata": { 20 | "collapsed": true 21 | }, 22 | "outputs": [], 23 | "source": [ 24 | "cg_data = pd.read_csv('campgrounds.csv')" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 3, 30 | "metadata": { 31 | "collapsed": false 32 | }, 33 | "outputs": [ 34 | { 35 | "data": { 36 | "text/plain": [ 37 | "(11, 6)" 38 | ] 39 | }, 40 | "execution_count": 3, 41 | "metadata": {}, 42 | "output_type": "execute_result" 43 | } 44 | ], 45 | "source": [ 46 | "cg_data.shape" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 4, 52 | "metadata": { 53 | "collapsed": false 54 | }, 55 | "outputs": [ 56 | { 57 | "data": { 58 | "text/html": [ 59 | "
\n", 60 | "\n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | " \n", 66 | " \n", 67 | " \n", 68 | " \n", 69 | " \n", 70 | " \n", 71 | " \n", 72 | " \n", 73 | " \n", 74 | " \n", 75 | " \n", 76 | " \n", 77 | " \n", 78 | " \n", 79 | " \n", 80 | " \n", 81 | " \n", 82 | " \n", 83 | " \n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | "
facilitynamefacilitylatitudefacilitylongitudeflushshowervault
0Mazama42.865508-122.16614911\\N
1Claude Lewis Sno-Park-USFS43.063217-122.342876\\N\\N1
2Lost Creek42.879145-122.0378811\\N\\N
3Hamaker43.056641-122.330322\\N\\N1
4Huckleberry Mountain42.877807-122.337174\\N\\N1
\n", 120 | "
" 121 | ], 122 | "text/plain": [ 123 | " facilityname facilitylatitude facilitylongitude flush \\\n", 124 | "0 Mazama 42.865508 -122.166149 1 \n", 125 | "1 Claude Lewis Sno-Park-USFS 43.063217 -122.342876 \\N \n", 126 | "2 Lost Creek 42.879145 -122.037881 1 \n", 127 | "3 Hamaker 43.056641 -122.330322 \\N \n", 128 | "4 Huckleberry Mountain 42.877807 -122.337174 \\N \n", 129 | "\n", 130 | " shower vault \n", 131 | "0 1 \\N \n", 132 | "1 \\N 1 \n", 133 | "2 \\N \\N \n", 134 | "3 \\N 1 \n", 135 | "4 \\N 1 " 136 | ] 137 | }, 138 | "execution_count": 4, 139 | "metadata": {}, 140 | "output_type": "execute_result" 141 | } 142 | ], 143 | "source": [ 144 | "cg_data.head()" 145 | ] 146 | }, 147 | { 148 | "cell_type": "markdown", 149 | "metadata": {}, 150 | "source": [ 151 | "Cleaning the data. We want to transform the info in this dataframe to be used for creating geojson. A new field 'description' will be created to convey the flush / shower / vault toilet amentities" 152 | ] 153 | }, 154 | { 155 | "cell_type": "raw", 156 | "metadata": {}, 157 | "source": [ 158 | "Example GeoJSON:\n", 159 | "{\n", 160 | " \"type\": \"Feature\",\n", 161 | " \"properties\": {\n", 162 | " \"title\":\"Ainsworth State Park\",\n", 163 | " \"description\": \"Flush toilet, shower\"\n", 164 | " }\n", 165 | " \"geometry\": {\n", 166 | " \"type\": \"Point\",\n", 167 | " \"coordinates\":[-122.048974,45.59844]\n", 168 | " }\n", 169 | "}" 170 | ] 171 | }, 172 | { 173 | "cell_type": "code", 174 | "execution_count": 5, 175 | "metadata": { 176 | "collapsed": true 177 | }, 178 | "outputs": [], 179 | "source": [ 180 | "cg_data_clean = cg_data" 181 | ] 182 | }, 183 | { 184 | "cell_type": "markdown", 185 | "metadata": {}, 186 | "source": [ 187 | "The flush, shower, and vault fields have a possible value of 0=False, 1=True, or \\N= info not available. We are only interested in the presence or lack of for these fields, so change values of '1' to the amenity name and values of '0' and '\\N' to empty. Note the second \\ used to escape the \\N" 188 | ] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": 6, 193 | "metadata": { 194 | "collapsed": false 195 | }, 196 | "outputs": [], 197 | "source": [ 198 | "cg_data_clean = cg_data_clean.replace({'flush': {'1':'Flush toilet', '0':'', '\\\\N':''}})\n", 199 | "cg_data_clean = cg_data_clean.replace({'shower': {'1':'Shower', '0':'', '\\\\N':''}})\n", 200 | "cg_data_clean = cg_data_clean.replace({'vault': {'1':'Vault toilet', '0':'', '\\\\N':''}})" 201 | ] 202 | }, 203 | { 204 | "cell_type": "markdown", 205 | "metadata": {}, 206 | "source": [ 207 | "The title field for the geojson feature will be the campground name. Standardize the lat/long names as well" 208 | ] 209 | }, 210 | { 211 | "cell_type": "code", 212 | "execution_count": 7, 213 | "metadata": { 214 | "collapsed": false 215 | }, 216 | "outputs": [], 217 | "source": [ 218 | "cg_data_clean = cg_data_clean.rename(columns={'facilityname': 'title', \n", 219 | " 'facilitylatitude':'latitude', \n", 220 | " 'facilitylongitude':'longitude'})" 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 8, 226 | "metadata": { 227 | "collapsed": false, 228 | "scrolled": true 229 | }, 230 | "outputs": [ 231 | { 232 | "data": { 233 | "text/html": [ 234 | "
\n", 235 | "\n", 236 | " \n", 237 | " \n", 238 | " \n", 239 | " \n", 240 | " \n", 241 | " \n", 242 | " \n", 243 | " \n", 244 | " \n", 245 | " \n", 246 | " \n", 247 | " \n", 248 | " \n", 249 | " \n", 250 | " \n", 251 | " \n", 252 | " \n", 253 | " \n", 254 | " \n", 255 | " \n", 256 | " \n", 257 | " \n", 258 | " \n", 259 | " \n", 260 | " \n", 261 | " \n", 262 | " \n", 263 | " \n", 264 | " \n", 265 | " \n", 266 | " \n", 267 | " \n", 268 | " \n", 269 | " \n", 270 | " \n", 271 | " \n", 272 | " \n", 273 | " \n", 274 | " \n", 275 | " \n", 276 | " \n", 277 | " \n", 278 | " \n", 279 | " \n", 280 | " \n", 281 | " \n", 282 | " \n", 283 | " \n", 284 | " \n", 285 | " \n", 286 | " \n", 287 | " \n", 288 | " \n", 289 | " \n", 290 | " \n", 291 | " \n", 292 | " \n", 293 | " \n", 294 | " \n", 295 | " \n", 296 | " \n", 297 | " \n", 298 | " \n", 299 | " \n", 300 | " \n", 301 | " \n", 302 | " \n", 303 | " \n", 304 | " \n", 305 | " \n", 306 | " \n", 307 | " \n", 308 | " \n", 309 | " \n", 310 | " \n", 311 | " \n", 312 | " \n", 313 | " \n", 314 | " \n", 315 | " \n", 316 | " \n", 317 | " \n", 318 | " \n", 319 | " \n", 320 | " \n", 321 | " \n", 322 | " \n", 323 | " \n", 324 | " \n", 325 | " \n", 326 | " \n", 327 | " \n", 328 | " \n", 329 | " \n", 330 | " \n", 331 | " \n", 332 | " \n", 333 | " \n", 334 | " \n", 335 | " \n", 336 | " \n", 337 | " \n", 338 | " \n", 339 | " \n", 340 | " \n", 341 | " \n", 342 | " \n", 343 | " \n", 344 | " \n", 345 | " \n", 346 | " \n", 347 | " \n", 348 | "
titlelatitudelongitudeflushshowervault
0Mazama42.865508-122.166149Flush toiletShower
1Claude Lewis Sno-Park-USFS43.063217-122.342876Vault toilet
2Lost Creek42.879145-122.037881Flush toilet
3Hamaker43.056641-122.330322Vault toilet
4Huckleberry Mountain42.877807-122.337174Vault toilet
5Natural Bridge -USFS42.889648-122.463867Vault toilet
6Farewell Bend42.919678-122.433105
7Scott Creek42.884588-121.924772Vault toilet
8Thousand Springs Sno-Park-USFS42.913045-122.324644Vault toilet
9Union Creek42.910278-122.450000Vault toilet
10Farewell Bend Campground42.916239-122.435331
\n", 349 | "
" 350 | ], 351 | "text/plain": [ 352 | " title latitude longitude flush \\\n", 353 | "0 Mazama 42.865508 -122.166149 Flush toilet \n", 354 | "1 Claude Lewis Sno-Park-USFS 43.063217 -122.342876 \n", 355 | "2 Lost Creek 42.879145 -122.037881 Flush toilet \n", 356 | "3 Hamaker 43.056641 -122.330322 \n", 357 | "4 Huckleberry Mountain 42.877807 -122.337174 \n", 358 | "5 Natural Bridge -USFS 42.889648 -122.463867 \n", 359 | "6 Farewell Bend 42.919678 -122.433105 \n", 360 | "7 Scott Creek 42.884588 -121.924772 \n", 361 | "8 Thousand Springs Sno-Park-USFS 42.913045 -122.324644 \n", 362 | "9 Union Creek 42.910278 -122.450000 \n", 363 | "10 Farewell Bend Campground 42.916239 -122.435331 \n", 364 | "\n", 365 | " shower vault \n", 366 | "0 Shower \n", 367 | "1 Vault toilet \n", 368 | "2 \n", 369 | "3 Vault toilet \n", 370 | "4 Vault toilet \n", 371 | "5 Vault toilet \n", 372 | "6 \n", 373 | "7 Vault toilet \n", 374 | "8 Vault toilet \n", 375 | "9 Vault toilet \n", 376 | "10 " 377 | ] 378 | }, 379 | "execution_count": 8, 380 | "metadata": {}, 381 | "output_type": "execute_result" 382 | } 383 | ], 384 | "source": [ 385 | "cg_data_clean" 386 | ] 387 | }, 388 | { 389 | "cell_type": "markdown", 390 | "metadata": {}, 391 | "source": [ 392 | "Create a description field that combines our amenities into a single string" 393 | ] 394 | }, 395 | { 396 | "cell_type": "code", 397 | "execution_count": 9, 398 | "metadata": { 399 | "collapsed": false 400 | }, 401 | "outputs": [], 402 | "source": [ 403 | "cg_data_clean['description'] = cg_data_clean[['flush','shower','vault']].apply(lambda x: ', '.join(x), axis=1)" 404 | ] 405 | }, 406 | { 407 | "cell_type": "markdown", 408 | "metadata": {}, 409 | "source": [ 410 | "Clean the extraneous commas from the start and end of the description. Note that this will not strip extra commas in the middle of the description!" 411 | ] 412 | }, 413 | { 414 | "cell_type": "code", 415 | "execution_count": 10, 416 | "metadata": { 417 | "collapsed": true 418 | }, 419 | "outputs": [], 420 | "source": [ 421 | "def clean_description(description):\n", 422 | " description = description.strip()\n", 423 | " while((description.startswith(',') or description.endswith(',')) and len(description) > -1):\n", 424 | " if description.endswith(',') :\n", 425 | " description = description[0:len(description)-1]\n", 426 | " if description.startswith(',') :\n", 427 | " description = description[1:len(description)] \n", 428 | " description = description.strip()\n", 429 | " return description" 430 | ] 431 | }, 432 | { 433 | "cell_type": "code", 434 | "execution_count": 11, 435 | "metadata": { 436 | "collapsed": false 437 | }, 438 | "outputs": [], 439 | "source": [ 440 | "cg_data_clean['description'] = cg_data_clean.description.apply(lambda x: clean_description(x))" 441 | ] 442 | }, 443 | { 444 | "cell_type": "code", 445 | "execution_count": 12, 446 | "metadata": { 447 | "collapsed": false 448 | }, 449 | "outputs": [ 450 | { 451 | "data": { 452 | "text/html": [ 453 | "
\n", 454 | "\n", 455 | " \n", 456 | " \n", 457 | " \n", 458 | " \n", 459 | " \n", 460 | " \n", 461 | " \n", 462 | " \n", 463 | " \n", 464 | " \n", 465 | " \n", 466 | " \n", 467 | " \n", 468 | " \n", 469 | " \n", 470 | " \n", 471 | " \n", 472 | " \n", 473 | " \n", 474 | " \n", 475 | " \n", 476 | " \n", 477 | " \n", 478 | " \n", 479 | " \n", 480 | " \n", 481 | " \n", 482 | " \n", 483 | " \n", 484 | " \n", 485 | " \n", 486 | " \n", 487 | " \n", 488 | " \n", 489 | " \n", 490 | " \n", 491 | " \n", 492 | " \n", 493 | " \n", 494 | " \n", 495 | " \n", 496 | " \n", 497 | " \n", 498 | " \n", 499 | " \n", 500 | " \n", 501 | " \n", 502 | " \n", 503 | " \n", 504 | " \n", 505 | " \n", 506 | " \n", 507 | " \n", 508 | " \n", 509 | " \n", 510 | " \n", 511 | " \n", 512 | " \n", 513 | " \n", 514 | " \n", 515 | " \n", 516 | " \n", 517 | " \n", 518 | " \n", 519 | " \n", 520 | " \n", 521 | " \n", 522 | " \n", 523 | " \n", 524 | " \n", 525 | " \n", 526 | " \n", 527 | " \n", 528 | " \n", 529 | " \n", 530 | " \n", 531 | " \n", 532 | " \n", 533 | " \n", 534 | " \n", 535 | " \n", 536 | " \n", 537 | " \n", 538 | " \n", 539 | " \n", 540 | " \n", 541 | " \n", 542 | " \n", 543 | " \n", 544 | " \n", 545 | " \n", 546 | " \n", 547 | " \n", 548 | " \n", 549 | " \n", 550 | " \n", 551 | " \n", 552 | " \n", 553 | " \n", 554 | " \n", 555 | " \n", 556 | " \n", 557 | " \n", 558 | " \n", 559 | " \n", 560 | " \n", 561 | " \n", 562 | " \n", 563 | " \n", 564 | " \n", 565 | " \n", 566 | " \n", 567 | " \n", 568 | " \n", 569 | " \n", 570 | " \n", 571 | " \n", 572 | " \n", 573 | " \n", 574 | " \n", 575 | " \n", 576 | " \n", 577 | " \n", 578 | " \n", 579 | "
titlelatitudelongitudeflushshowervaultdescription
0Mazama42.865508-122.166149Flush toiletShowerFlush toilet, Shower
1Claude Lewis Sno-Park-USFS43.063217-122.342876Vault toiletVault toilet
2Lost Creek42.879145-122.037881Flush toiletFlush toilet
3Hamaker43.056641-122.330322Vault toiletVault toilet
4Huckleberry Mountain42.877807-122.337174Vault toiletVault toilet
5Natural Bridge -USFS42.889648-122.463867Vault toiletVault toilet
6Farewell Bend42.919678-122.433105
7Scott Creek42.884588-121.924772Vault toiletVault toilet
8Thousand Springs Sno-Park-USFS42.913045-122.324644Vault toiletVault toilet
9Union Creek42.910278-122.450000Vault toiletVault toilet
10Farewell Bend Campground42.916239-122.435331
\n", 580 | "
" 581 | ], 582 | "text/plain": [ 583 | " title latitude longitude flush \\\n", 584 | "0 Mazama 42.865508 -122.166149 Flush toilet \n", 585 | "1 Claude Lewis Sno-Park-USFS 43.063217 -122.342876 \n", 586 | "2 Lost Creek 42.879145 -122.037881 Flush toilet \n", 587 | "3 Hamaker 43.056641 -122.330322 \n", 588 | "4 Huckleberry Mountain 42.877807 -122.337174 \n", 589 | "5 Natural Bridge -USFS 42.889648 -122.463867 \n", 590 | "6 Farewell Bend 42.919678 -122.433105 \n", 591 | "7 Scott Creek 42.884588 -121.924772 \n", 592 | "8 Thousand Springs Sno-Park-USFS 42.913045 -122.324644 \n", 593 | "9 Union Creek 42.910278 -122.450000 \n", 594 | "10 Farewell Bend Campground 42.916239 -122.435331 \n", 595 | "\n", 596 | " shower vault description \n", 597 | "0 Shower Flush toilet, Shower \n", 598 | "1 Vault toilet Vault toilet \n", 599 | "2 Flush toilet \n", 600 | "3 Vault toilet Vault toilet \n", 601 | "4 Vault toilet Vault toilet \n", 602 | "5 Vault toilet Vault toilet \n", 603 | "6 \n", 604 | "7 Vault toilet Vault toilet \n", 605 | "8 Vault toilet Vault toilet \n", 606 | "9 Vault toilet Vault toilet \n", 607 | "10 " 608 | ] 609 | }, 610 | "execution_count": 12, 611 | "metadata": {}, 612 | "output_type": "execute_result" 613 | } 614 | ], 615 | "source": [ 616 | "cg_data_clean" 617 | ] 618 | }, 619 | { 620 | "cell_type": "code", 621 | "execution_count": 13, 622 | "metadata": { 623 | "collapsed": false 624 | }, 625 | "outputs": [], 626 | "source": [ 627 | "geojson_df = cg_data_clean[['title','latitude','longitude','description']]" 628 | ] 629 | }, 630 | { 631 | "cell_type": "code", 632 | "execution_count": 14, 633 | "metadata": { 634 | "collapsed": false 635 | }, 636 | "outputs": [ 637 | { 638 | "data": { 639 | "text/html": [ 640 | "
\n", 641 | "\n", 642 | " \n", 643 | " \n", 644 | " \n", 645 | " \n", 646 | " \n", 647 | " \n", 648 | " \n", 649 | " \n", 650 | " \n", 651 | " \n", 652 | " \n", 653 | " \n", 654 | " \n", 655 | " \n", 656 | " \n", 657 | " \n", 658 | " \n", 659 | " \n", 660 | " \n", 661 | " \n", 662 | " \n", 663 | " \n", 664 | " \n", 665 | " \n", 666 | " \n", 667 | " \n", 668 | " \n", 669 | " \n", 670 | " \n", 671 | " \n", 672 | " \n", 673 | " \n", 674 | " \n", 675 | " \n", 676 | " \n", 677 | " \n", 678 | " \n", 679 | " \n", 680 | " \n", 681 | " \n", 682 | " \n", 683 | " \n", 684 | " \n", 685 | " \n", 686 | " \n", 687 | " \n", 688 | " \n", 689 | " \n", 690 | " \n", 691 | " \n", 692 | " \n", 693 | " \n", 694 | " \n", 695 | " \n", 696 | " \n", 697 | " \n", 698 | " \n", 699 | " \n", 700 | " \n", 701 | " \n", 702 | " \n", 703 | " \n", 704 | " \n", 705 | " \n", 706 | " \n", 707 | " \n", 708 | " \n", 709 | " \n", 710 | " \n", 711 | " \n", 712 | " \n", 713 | " \n", 714 | " \n", 715 | " \n", 716 | " \n", 717 | " \n", 718 | " \n", 719 | " \n", 720 | " \n", 721 | " \n", 722 | " \n", 723 | " \n", 724 | " \n", 725 | " \n", 726 | " \n", 727 | " \n", 728 | " \n", 729 | " \n", 730 | "
titlelatitudelongitudedescription
0Mazama42.865508-122.166149Flush toilet, Shower
1Claude Lewis Sno-Park-USFS43.063217-122.342876Vault toilet
2Lost Creek42.879145-122.037881Flush toilet
3Hamaker43.056641-122.330322Vault toilet
4Huckleberry Mountain42.877807-122.337174Vault toilet
5Natural Bridge -USFS42.889648-122.463867Vault toilet
6Farewell Bend42.919678-122.433105
7Scott Creek42.884588-121.924772Vault toilet
8Thousand Springs Sno-Park-USFS42.913045-122.324644Vault toilet
9Union Creek42.910278-122.450000Vault toilet
10Farewell Bend Campground42.916239-122.435331
\n", 731 | "
" 732 | ], 733 | "text/plain": [ 734 | " title latitude longitude \\\n", 735 | "0 Mazama 42.865508 -122.166149 \n", 736 | "1 Claude Lewis Sno-Park-USFS 43.063217 -122.342876 \n", 737 | "2 Lost Creek 42.879145 -122.037881 \n", 738 | "3 Hamaker 43.056641 -122.330322 \n", 739 | "4 Huckleberry Mountain 42.877807 -122.337174 \n", 740 | "5 Natural Bridge -USFS 42.889648 -122.463867 \n", 741 | "6 Farewell Bend 42.919678 -122.433105 \n", 742 | "7 Scott Creek 42.884588 -121.924772 \n", 743 | "8 Thousand Springs Sno-Park-USFS 42.913045 -122.324644 \n", 744 | "9 Union Creek 42.910278 -122.450000 \n", 745 | "10 Farewell Bend Campground 42.916239 -122.435331 \n", 746 | "\n", 747 | " description \n", 748 | "0 Flush toilet, Shower \n", 749 | "1 Vault toilet \n", 750 | "2 Flush toilet \n", 751 | "3 Vault toilet \n", 752 | "4 Vault toilet \n", 753 | "5 Vault toilet \n", 754 | "6 \n", 755 | "7 Vault toilet \n", 756 | "8 Vault toilet \n", 757 | "9 Vault toilet \n", 758 | "10 " 759 | ] 760 | }, 761 | "execution_count": 14, 762 | "metadata": {}, 763 | "output_type": "execute_result" 764 | } 765 | ], 766 | "source": [ 767 | "geojson_df" 768 | ] 769 | }, 770 | { 771 | "cell_type": "markdown", 772 | "metadata": {}, 773 | "source": [ 774 | "Creating the geojson from the dataframe. To use the apply function over each row of the dataframe, we will create a feature_from_row function that will be used as the lambda function. \n", 775 | "\n", 776 | "Each campground is a feature and will be added to the 'features' array in the FeatureCollection" 777 | ] 778 | }, 779 | { 780 | "cell_type": "code", 781 | "execution_count": 15, 782 | "metadata": { 783 | "collapsed": true 784 | }, 785 | "outputs": [], 786 | "source": [ 787 | "collection = {'type':'FeatureCollection', 'features':[]}" 788 | ] 789 | }, 790 | { 791 | "cell_type": "code", 792 | "execution_count": 16, 793 | "metadata": { 794 | "collapsed": true 795 | }, 796 | "outputs": [], 797 | "source": [ 798 | "def feature_from_row(title, latitude, longitude, description):\n", 799 | " feature = { 'type': 'Feature', \n", 800 | " 'properties': { 'title': '', 'description': ''},\n", 801 | " 'geometry': { 'type': 'Point', 'coordinates': []}\n", 802 | " }\n", 803 | " feature['geometry']['coordinates'] = [longitude, latitude]\n", 804 | " feature['properties']['title'] = title\n", 805 | " feature['properties']['description'] = description\n", 806 | " collection['features'].append(feature)\n", 807 | " return feature" 808 | ] 809 | }, 810 | { 811 | "cell_type": "code", 812 | "execution_count": 17, 813 | "metadata": { 814 | "collapsed": false 815 | }, 816 | "outputs": [], 817 | "source": [ 818 | "geojson_series = geojson_df.apply(lambda x: feature_from_row(x['title'],x['latitude'],x['longitude'],x['description']),\n", 819 | " axis=1)" 820 | ] 821 | }, 822 | { 823 | "cell_type": "code", 824 | "execution_count": 18, 825 | "metadata": { 826 | "collapsed": false 827 | }, 828 | "outputs": [ 829 | { 830 | "data": { 831 | "text/plain": [ 832 | "{'features': [{'geometry': {'coordinates': [-122.166149, 42.865508],\n", 833 | " 'type': 'Point'},\n", 834 | " 'properties': {'description': 'Flush toilet, Shower', 'title': 'Mazama'},\n", 835 | " 'type': 'Feature'},\n", 836 | " {'geometry': {'coordinates': [-122.342876, 43.063217], 'type': 'Point'},\n", 837 | " 'properties': {'description': 'Vault toilet',\n", 838 | " 'title': 'Claude Lewis Sno-Park-USFS'},\n", 839 | " 'type': 'Feature'},\n", 840 | " {'geometry': {'coordinates': [-122.037881, 42.879145], 'type': 'Point'},\n", 841 | " 'properties': {'description': 'Flush toilet', 'title': 'Lost Creek'},\n", 842 | " 'type': 'Feature'},\n", 843 | " {'geometry': {'coordinates': [-122.330322, 43.056641], 'type': 'Point'},\n", 844 | " 'properties': {'description': 'Vault toilet', 'title': 'Hamaker'},\n", 845 | " 'type': 'Feature'},\n", 846 | " {'geometry': {'coordinates': [-122.337174, 42.877807], 'type': 'Point'},\n", 847 | " 'properties': {'description': 'Vault toilet',\n", 848 | " 'title': 'Huckleberry Mountain'},\n", 849 | " 'type': 'Feature'},\n", 850 | " {'geometry': {'coordinates': [-122.463867, 42.889648], 'type': 'Point'},\n", 851 | " 'properties': {'description': 'Vault toilet',\n", 852 | " 'title': 'Natural Bridge -USFS'},\n", 853 | " 'type': 'Feature'},\n", 854 | " {'geometry': {'coordinates': [-122.433105, 42.91967800000001],\n", 855 | " 'type': 'Point'},\n", 856 | " 'properties': {'description': '', 'title': 'Farewell Bend'},\n", 857 | " 'type': 'Feature'},\n", 858 | " {'geometry': {'coordinates': [-121.924772, 42.884588], 'type': 'Point'},\n", 859 | " 'properties': {'description': 'Vault toilet', 'title': 'Scott Creek'},\n", 860 | " 'type': 'Feature'},\n", 861 | " {'geometry': {'coordinates': [-122.324644, 42.913045], 'type': 'Point'},\n", 862 | " 'properties': {'description': 'Vault toilet',\n", 863 | " 'title': 'Thousand Springs Sno-Park-USFS'},\n", 864 | " 'type': 'Feature'},\n", 865 | " {'geometry': {'coordinates': [-122.45, 42.910277777800005], 'type': 'Point'},\n", 866 | " 'properties': {'description': 'Vault toilet', 'title': 'Union Creek'},\n", 867 | " 'type': 'Feature'},\n", 868 | " {'geometry': {'coordinates': [-122.43533055555599, 42.9162388889],\n", 869 | " 'type': 'Point'},\n", 870 | " 'properties': {'description': '', 'title': 'Farewell Bend Campground'},\n", 871 | " 'type': 'Feature'}],\n", 872 | " 'type': 'FeatureCollection'}" 873 | ] 874 | }, 875 | "execution_count": 18, 876 | "metadata": {}, 877 | "output_type": "execute_result" 878 | } 879 | ], 880 | "source": [ 881 | "collection" 882 | ] 883 | }, 884 | { 885 | "cell_type": "code", 886 | "execution_count": 19, 887 | "metadata": { 888 | "collapsed": false 889 | }, 890 | "outputs": [], 891 | "source": [ 892 | "with open('collection.geojson', 'w') as outfile:\n", 893 | " \n", 894 | " json.dump(collection, outfile)" 895 | ] 896 | }, 897 | { 898 | "cell_type": "code", 899 | "execution_count": 20, 900 | "metadata": { 901 | "collapsed": true 902 | }, 903 | "outputs": [], 904 | "source": [ 905 | "test = pd.read_json('collection.geojson')" 906 | ] 907 | }, 908 | { 909 | "cell_type": "code", 910 | "execution_count": 21, 911 | "metadata": { 912 | "collapsed": false 913 | }, 914 | "outputs": [ 915 | { 916 | "data": { 917 | "text/html": [ 918 | "
\n", 919 | "\n", 920 | " \n", 921 | " \n", 922 | " \n", 923 | " \n", 924 | " \n", 925 | " \n", 926 | " \n", 927 | " \n", 928 | " \n", 929 | " \n", 930 | " \n", 931 | " \n", 932 | " \n", 933 | " \n", 934 | " \n", 935 | " \n", 936 | " \n", 937 | " \n", 938 | " \n", 939 | " \n", 940 | " \n", 941 | " \n", 942 | " \n", 943 | " \n", 944 | " \n", 945 | " \n", 946 | " \n", 947 | " \n", 948 | " \n", 949 | " \n", 950 | " \n", 951 | " \n", 952 | " \n", 953 | " \n", 954 | " \n", 955 | " \n", 956 | " \n", 957 | " \n", 958 | " \n", 959 | " \n", 960 | " \n", 961 | " \n", 962 | " \n", 963 | " \n", 964 | " \n", 965 | " \n", 966 | " \n", 967 | " \n", 968 | " \n", 969 | " \n", 970 | " \n", 971 | " \n", 972 | " \n", 973 | " \n", 974 | " \n", 975 | " \n", 976 | " \n", 977 | " \n", 978 | " \n", 979 | " \n", 980 | " \n", 981 | " \n", 982 | " \n", 983 | " \n", 984 | "
featurestype
0{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
1{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
2{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
3{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
4{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
5{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
6{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
7{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
8{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
9{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
10{'type': 'Feature', 'properties': {'descriptio...FeatureCollection
\n", 985 | "
" 986 | ], 987 | "text/plain": [ 988 | " features type\n", 989 | "0 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 990 | "1 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 991 | "2 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 992 | "3 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 993 | "4 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 994 | "5 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 995 | "6 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 996 | "7 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 997 | "8 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 998 | "9 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection\n", 999 | "10 {'type': 'Feature', 'properties': {'descriptio... FeatureCollection" 1000 | ] 1001 | }, 1002 | "execution_count": 21, 1003 | "metadata": {}, 1004 | "output_type": "execute_result" 1005 | } 1006 | ], 1007 | "source": [ 1008 | "test" 1009 | ] 1010 | }, 1011 | { 1012 | "cell_type": "code", 1013 | "execution_count": null, 1014 | "metadata": { 1015 | "collapsed": true 1016 | }, 1017 | "outputs": [], 1018 | "source": [] 1019 | } 1020 | ], 1021 | "metadata": { 1022 | "kernelspec": { 1023 | "display_name": "Python 3", 1024 | "language": "python", 1025 | "name": "python3" 1026 | }, 1027 | "language_info": { 1028 | "codemirror_mode": { 1029 | "name": "ipython", 1030 | "version": 3 1031 | }, 1032 | "file_extension": ".py", 1033 | "mimetype": "text/x-python", 1034 | "name": "python", 1035 | "nbconvert_exporter": "python", 1036 | "pygments_lexer": "ipython3", 1037 | "version": "3.4.3" 1038 | } 1039 | }, 1040 | "nbformat": 4, 1041 | "nbformat_minor": 0 1042 | } 1043 | -------------------------------------------------------------------------------- /appendto/python_maps/campgrounds.csv: -------------------------------------------------------------------------------- 1 | facilityname,facilitylatitude,facilitylongitude,flush,shower,vault 2 | Mazama,42.865508,-122.166149,1,1,\N 3 | Claude Lewis Sno-Park-USFS,43.063217,-122.342876,\N,\N,1 4 | Lost Creek,42.879145,-122.037881,1,\N,\N 5 | Hamaker,43.056641,-122.330322,\N,\N,1 6 | Huckleberry Mountain,42.877807000000004,-122.337174,\N,\N,1 7 | Natural Bridge -USFS,42.889648,-122.463867,\N,\N,1 8 | Farewell Bend,42.91967800000001,-122.433105,\N,\N,\N 9 | Scott Creek,42.884588,-121.92477199999999,\N,\N,1 10 | Thousand Springs Sno-Park-USFS,42.913045000000004,-122.32464399999999,\N,\N,1 11 | Union Creek,42.910277777800005,-122.45,\N,\N,1 12 | Farewell Bend Campground,42.9162388889,-122.43533055555599,\N,\N,0 13 | -------------------------------------------------------------------------------- /appendto/python_maps/collection.geojson: -------------------------------------------------------------------------------- 1 | {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.166149,42.865508]},"properties":{"description":"Flush toilet, Shower","title":"Mazama","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.342876,43.063217]},"properties":{"description":"Vault toilet","title":"Claude Lewis Sno-Park-USFS","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.037881,42.879145]},"properties":{"description":"Flush toilet","title":"Lost Creek","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.330322,43.056641]},"properties":{"description":"Vault toilet","title":"Hamaker","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.337174,42.877807]},"properties":{"description":"Vault toilet","title":"Huckleberry Mountain","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.463867,42.889648]},"properties":{"description":"Vault toilet","title":"Natural Bridge -USFS","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.433105,42.919678]},"properties":{"description":"","title":"Farewell Bend","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-121.924772,42.884588]},"properties":{"description":"Vault toilet","title":"Scott Creek","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.324644,42.913045]},"properties":{"description":"Vault toilet","title":"Thousand Springs Sno-Park-USFS","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.45,42.9102777778]},"properties":{"description":"Vault toilet","title":"Union Creek","marker-size":"small"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.4353305556,42.9162388889]},"properties":{"description":"","title":"Farewell Bend Campground","marker-size":"small"}}]} -------------------------------------------------------------------------------- /appendto/python_maps_2/collection.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "features": [{ 4 | "type": "Feature", 5 | "geometry": { 6 | "type": "Point", 7 | "coordinates": [-122.166149, 42.865508] 8 | }, 9 | "properties": { 10 | "flush": true, 11 | "shower": true, 12 | "vault": false, 13 | "description": "Flush toilet, Shower", 14 | "title": "Mazama", 15 | "marker-size": "small" 16 | } 17 | }, { 18 | "type": "Feature", 19 | "geometry": { 20 | "type": "Point", 21 | "coordinates": [-122.342876, 43.063217] 22 | }, 23 | "properties": { 24 | "flush": false, 25 | "shower": false, 26 | "vault": true, 27 | "description": "Vault toilet", 28 | "title": "Claude Lewis Sno-Park-USFS", 29 | "marker-size": "small" 30 | } 31 | }, { 32 | "type": "Feature", 33 | "geometry": { 34 | "type": "Point", 35 | "coordinates": [-122.037881, 42.879145] 36 | }, 37 | "properties": { 38 | "flush": true, 39 | "shower": false, 40 | "vault": false, 41 | "description": "Flush toilet", 42 | "title": "Lost Creek", 43 | "marker-size": "small" 44 | } 45 | }, { 46 | "type": "Feature", 47 | "geometry": { 48 | "type": "Point", 49 | "coordinates": [-122.330322, 43.056641] 50 | }, 51 | "properties": { 52 | "flush": false, 53 | "shower": false, 54 | "vault": true, 55 | "description": "Vault toilet", 56 | "title": "Hamaker", 57 | "marker-size": "small" 58 | } 59 | }, { 60 | "type": "Feature", 61 | "geometry": { 62 | "type": "Point", 63 | "coordinates": [-122.337174, 42.877807] 64 | }, 65 | "properties": { 66 | "flush": false, 67 | "shower": false, 68 | "vault": true, 69 | "description": "Vault toilet", 70 | "title": "Huckleberry Mountain", 71 | "marker-size": "small" 72 | } 73 | }, { 74 | "type": "Feature", 75 | "geometry": { 76 | "type": "Point", 77 | "coordinates": [-122.463867, 42.889648] 78 | }, 79 | "properties": { 80 | "flush": false, 81 | "shower": false, 82 | "vault": true, 83 | "description": "Vault toilet", 84 | "title": "Natural Bridge -USFS", 85 | "marker-size": "small" 86 | } 87 | }, { 88 | "type": "Feature", 89 | "geometry": { 90 | "type": "Point", 91 | "coordinates": [-122.433105, 42.919678] 92 | }, 93 | "properties": { 94 | "flush": false, 95 | "shower": false, 96 | "vault": false, 97 | "description": "", 98 | "title": "Farewell Bend", 99 | "marker-size": "small" 100 | } 101 | }, { 102 | "type": "Feature", 103 | "geometry": { 104 | "type": "Point", 105 | "coordinates": [-121.924772, 42.884588] 106 | }, 107 | "properties": { 108 | "flush": false, 109 | "shower": false, 110 | "vault": true, 111 | "description": "Vault toilet", 112 | "title": "Scott Creek", 113 | "marker-size": "small" 114 | } 115 | }, { 116 | "type": "Feature", 117 | "geometry": { 118 | "type": "Point", 119 | "coordinates": [-122.324644, 42.913045] 120 | }, 121 | "properties": { 122 | "flush": false, 123 | "shower": false, 124 | "vault": true, 125 | "description": "Vault toilet", 126 | "title": "Thousand Springs Sno-Park-USFS", 127 | "marker-size": "small" 128 | } 129 | }, { 130 | "type": "Feature", 131 | "geometry": { 132 | "type": "Point", 133 | "coordinates": [-122.45, 42.9102777778] 134 | }, 135 | "properties": { 136 | "flush": false, 137 | "shower": false, 138 | "vault": true, 139 | "description": "Vault toilet", 140 | "title": "Union Creek", 141 | "marker-size": "small" 142 | } 143 | }, { 144 | "type": "Feature", 145 | "geometry": { 146 | "type": "Point", 147 | "coordinates": [-122.4353305556, 42.9162388889] 148 | }, 149 | "properties": { 150 | "flush": false, 151 | "shower": false, 152 | "vault": false, 153 | "description": "", 154 | "title": "Farewell Bend Campground", 155 | "marker-size": "small" 156 | } 157 | }] 158 | } -------------------------------------------------------------------------------- /appendto/react_nps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_nps/__init__.py -------------------------------------------------------------------------------- /appendto/react_nps/missing_lat_longs.csv: -------------------------------------------------------------------------------- 1 | RecAreaName,RecAreaLatitude,RecAreaLongitude 2 | "Arches National Park",38.7331,-109.5925 3 | "Black Canyon Of The Gunnison National Park",38.5754,-107.7416 4 | "Carlsbad Caverns National Park",32.1479,-104.5567 5 | "Denali National Park & Preserve",63.1148,-151.1926 6 | "Gates Of The Arctic National Park & Preserve",67.9204,-153.2753 7 | "Glacier National Park",48.7596,-113.7870 8 | "Guadalupe Mountains National Park",31.9452,-104.8725 9 | "Haleakalā National Park",20.7204,-156.1552 10 | "Katmai National Park & Preserve",58.5975,-154.6937 11 | "Lassen Volcanic National Park",40.4977,-121.4207 12 | 13 | -------------------------------------------------------------------------------- /appendto/react_nps/np.geojson: -------------------------------------------------------------------------------- 1 | {"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-68.2598657906, 44.374358654]}, "properties": {"title": "Acadia National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-109.5925, 38.7331]}, "properties": {"title": "Arches National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-101.942207739, 43.7489325553]}, "properties": {"title": "Badlands National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-103.207245469, 29.3290000409]}, "properties": {"title": "Big Bend National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-80.2179336548, 25.4829769135]}, "properties": {"title": "Biscayne National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-107.7416, 38.5754]}, "properties": {"title": "Black Canyon Of The Gunnison National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-112.169951499, 37.6392057538]}, "properties": {"title": "Bryce Canyon National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-109.856624603, 38.3121026863]}, "properties": {"title": "Canyonlands National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-111.261219024, 38.2906477893]}, "properties": {"title": "Capitol Reef National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-104.5567, 32.1479]}, "properties": {"title": "Carlsbad Caverns National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-119.26687, 34.2480594]}, "properties": {"title": "Channel Islands National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-80.7971115112, 33.9066505432]}, "properties": {"title": "Congaree National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-122.13429451, 42.8966964816]}, "properties": {"title": "Crater Lake National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-81.558754, 41.263092]}, "properties": {"title": "Cuyahoga Valley National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-151.1926, 63.1148]}, "properties": {"title": "Denali National Park & Preserve"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-116.866666667, 36.4616666667]}, "properties": {"title": "Death Valley National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-82.9223480225, 24.6295833588]}, "properties": {"title": "Dry Tortugas National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-80.9548873901, 25.3716144562]}, "properties": {"title": "Everglades National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-153.2753, 67.9204]}, "properties": {"title": "Gates Of The Arctic National Park & Preserve"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-113.787, 48.7596]}, "properties": {"title": "Glacier National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-136.967208862, 58.819519043]}, "properties": {"title": "Glacier Bay National Park & Preserve"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-114.218688965, 39.004588404]}, "properties": {"title": "Great Basin National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-112.137232572, 36.0567889363]}, "properties": {"title": "Grand Canyon National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-105.512001038, 37.7328987122]}, "properties": {"title": "Great Sand Dunes National Park & Preserve"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-83.5369169712, 35.6852775067]}, "properties": {"title": "Great Smoky Mountains National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-104.8725, 31.9452]}, "properties": {"title": "Guadalupe Mountains National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-156.1552, 20.7204]}, "properties": {"title": "Haleakal\u0101 National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-155.327972412, 19.3577289581]}, "properties": {"title": "Hawai'i Volcanoes National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-93.0522232056, 34.5094413757]}, "properties": {"title": "Hot Springs National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-88.7701721191, 48.030620575]}, "properties": {"title": "Isle Royale National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-116.019618, 34.020558]}, "properties": {"title": "Joshua Tree National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-154.6937, 58.5975]}, "properties": {"title": "Katmai National Park & Preserve"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-150.246566772, 59.7971000671]}, "properties": {"title": "Kenai Fjords National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-159.060638428, 67.3913726807]}, "properties": {"title": "Kobuk Valley National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-154.315093994, 60.1826068796]}, "properties": {"title": "Lake Clark National Park & Preserve"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-121.4207, 40.4977]}, "properties": {"title": "Lassen Volcanic National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-86.0993814468, 37.1871730685]}, "properties": {"title": "Mammoth Cave National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-108.410971642, 37.3389974426]}, "properties": {"title": "Mesa Verde National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-121.915874481, 46.7407574422]}, "properties": {"title": "Mount Rainier National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-121.467964172, 48.8211250305]}, "properties": {"title": "North Cascades National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-109.7818412, 35.0657043]}, "properties": {"title": "Petrified Forest National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-123.425014168, 48.0999013782]}, "properties": {"title": "Olympic National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-121.155279949, 36.484516114]}, "properties": {"title": "Pinnacles National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-105.562038422, 40.3663213198]}, "properties": {"title": "Rocky Mountain National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-110.7363889, 32.1802778]}, "properties": {"title": "Saguaro National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-118.825595677, 36.4909251522]}, "properties": {"title": "Sequoia & Kings Canyon National Parks"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-78.4510114789, 38.4900674969]}, "properties": {"title": "Shenandoah National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-103.449996948, 46.9666671753]}, "properties": {"title": "Theodore Roosevelt National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-64.7557621002, 18.351905146]}, "properties": {"title": "Virgin Islands National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-93.1617055088, 48.5843199822]}, "properties": {"title": "Voyageurs National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-103.478250504, 43.5557484627]}, "properties": {"title": "Wind Cave National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-142.242660522, 61.2079391479]}, "properties": {"title": "Wrangell - St Elias National Park & Preserve"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-110.691947937, 44.9912101476]}, "properties": {"title": "Yellowstone National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-119.540840149, 37.8391265869]}, "properties": {"title": "Yosemite National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-112.988339067, 37.2020727396]}, "properties": {"title": "Zion National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-77.2665939331, 38.9378089905]}, "properties": {"title": "Wolf Trap National Park for the Performing Arts"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-110.714820862, 43.658708029]}, "properties": {"title": "Grand Teton National Park"}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-121.155279949, 36.484516114]}, "properties": {"title": "Pinnacles National Park"}}]} -------------------------------------------------------------------------------- /appendto/react_nps/np_info.csv: -------------------------------------------------------------------------------- 1 | RecAreaName,GEOJSON,GEOJSON.COORDINATES,GEOJSON.TYPE,Keywords,LastUpdatedDate,OrgRecAreaID,RecAreaDescription,RecAreaDirections,RecAreaEmail,RecAreaFeeDescription,RecAreaID,RecAreaLatitude,RecAreaLongitude,RecAreaMapURL,RecAreaPhone,RecAreaReservationURL,StayLimit,RecAreaName 2 | Acadia National Park,"{'TYPE': 'Point', 'COORDINATES': [-68.2598657906, 44.374358654]}",,,,2016-10-11,,"People have been drawn to the rugged coast of Maine throughout history. Awed by its beauty and diversity, early 20th-century visionaries donated the land that became Acadia National Park. The park is home to many plants and animals, and the tallest mountain on the U.S. Atlantic coast. Today visitors come to Acadia to hike granite peaks, bike historic carriage roads, or relax and enjoy the scenery.","From Boston take I-95 north to Augusta, Maine, then Route 3 east to Ellsworth, and on to Mount Desert Island. For an alternate route, continue on I-95 north to Bangor, Maine, then take Route 1A east to Ellsworth. In Ellsworth, take Route 3 to Mount Desert Island. 3 | 4 | http://www.nps.gov/acad/planyourvisit/directions.htm",acadia_information@nps.gov,,2554,44.374358654,-68.2598657906,http://www.nps.gov/acad/planyourvisit/maps.htm,(207) 288 3338,,,Acadia National Park 5 | Arches National Park,,,,,2016-10-11,,"Visit Arches and discover a landscape of contrasting colors, landforms and textures unlike any other in the world. The park has over 2,000 natural stone arches, in addition to hundreds of soaring pinnacles, massive fins and giant balanced rocks. This red rock wonderland will amaze you with its formations, refresh you with its trails, and inspire you with its sunsets.","Arches National Park is located in southeast Utah: 6 | 5 miles north of Moab, Utah 7 | 110 miles southwest of Grand Junction, Colorado 8 | 160 miles northwest of Durango, Colorado 9 | 236 miles south of Salt Lake City, Utah 10 | 360 miles southwest of Denver, Colorado 11 | 12 | Travel by Plane 13 | Commercial airlines serve Grand Junction, Durango, Moab and Salt Lake City. 14 | 15 | Travel by Bus 16 | Nationwide bus service is available to Green River, Utah (50 miles from Moab) and Grand Junction. 17 | 18 | Travel by Train 19 | Amtrak stops at Grand Junction and Green River. 20 | 21 | Shuttles & Taxis 22 | Commercial van services and taxis operate between Grand Junction, Moab and other destinations.For additional information on transportation options in and around Moab, contact the Grand County Travel Council. 23 | 24 | Getting Around the Park 25 | Most visits to Arches involve traveling by personal vehicle along the scenic drive, which provides access to many viewpoints and trailheads. The park does not provide a shuttle bus service.",archinfo@nps.gov,,2573,38.7331,-109.5925,http://www.nps.gov,,,,Arches National Park 26 | Badlands National Park,"{'TYPE': 'Point', 'COORDINATES': [-101.942207739, 43.7489325553]}",,,,2016-10-11,,"The rugged beauty of the Badlands draws visitors from around the world. These striking geologic deposits contain one of the world's richest fossil beds. Ancient mammals such as the rhino, horse, and saber-toothed cat once roamed here. The park's 244,000 acres protect an expanse of mixed-grass prairie where bison, bighorn sheep, prairie dogs, and black-footed ferrets live today.",,badl_information@nps.gov,,2578,43.7489325553,-101.942207739,http://www.nps.gov/badl/planyourvisit/maps.htm,,,,Badlands National Park 27 | Big Bend National Park,"{'TYPE': 'Point', 'COORDINATES': [-103.207245469, 29.3290000409]}",,,,2016-10-11,,"There is a place in Far West Texas where night skies are dark as coal and rivers carve temple-like canyons in ancient limestone. Here, at the end of the road, hundreds of bird species take refuge in a solitary mountain range surrounded by weather-beaten desert. Tenacious cactus bloom in sublime southwestern sun, and diversity of species is the best in the country. This magical place is Big Bend.","Several Texas highways lead to Big Bend National Park: If traveling south from Alpine, TX, follow TX 118 through Study Butte, TX where the highway enters the park through Maverick Entrance Station. Park headquarters is 23 miles from this west entrance. If traveling from the west, follow Texas FM 170 from Presidio, TX to Study Butte, TX, then turn right on TX 118 to enter the park through the west entrance. If traveling from the east, take US 385 south from Marathon, TX which enters the park through the north entrance at Persimmon Gap. Persimmon Gap is 26 miles from park headquarters.",bibe_info@nps.gov,,2584,29.3290000409,-103.207245469,http://www.nps.gov/bibe/planyourvisit/maps.htm,(432) 477 2251,,,Big Bend National Park 28 | Biscayne National Park,"{'TYPE': 'Point', 'COORDINATES': [-80.2179336548, 25.4829769135]}",,,,2016-10-11,,"Within sight of downtown Miami, yet worlds away, Biscayne protects a rare combination of aquamarine waters, emerald islands, and fish-bejeweled coral reefs. Here too is evidence of 10,000 years of human history, from pirates and shipwrecks to pineapple farmers and presidents. Outdoors enthusiasts can boat, snorkel, camp, watch wildlife...or simply relax in a rocking chair gazing out over the bay.","

Physical Address
29 | 9700 SW 328 Street
30 | Homestead, Florida 33033

31 |

From the North
32 | Convoy Point can be reached from either the Florida Turnpike or from US-1.
33 | • From the Florida Turnpike: Take the Florida Turnpike south, to Exit 6 (Speedway Blvd.). Turn left from exit ramp and continue south to S.W. 328th Street (North Canal Drive). Turn left and continue to the end of the road. It is approximately five miles, and the entrance is on the left.
34 | • From US-1: Drive south to Homestead. Turn left on SW 328th Street (North Canal Drive), and continue to the end of the road. It is approximately nine miles, and the entrance is on the left.
35 | From the South
36 | Traveling on US-1 (Overseas Highway), drive north to Homestead. Turn right on SW 328th Street (North Canal Drive — first light after Florida Turnpike entrance), and continue to the end of the road. The entrance is approximately nine miles on the left.
37 |  

",bisc_information@nps.gov,,2588,25.4829769135,-80.2179336548,http://www.nps.gov/bisc/planyourvisit/maps.htm,,,,Biscayne National Park 38 | Black Canyon Of The Gunnison National Park,,,,,2016-10-11,,"Big enough to be overwhelming, still intimate enough to feel the pulse of time, Black Canyon of the Gunnison exposes you to some of the steepest cliffs, oldest rock, and craggiest spires in North America. With two million years to work, the Gunnison River, along with the forces of weathering, has sculpted this vertical wilderness of rock, water, and sky.","

Black Canyon of the Gunnison National Park is located approximately 250 miles southwest of Denver.

39 |

South Rim: 15 miles east of Montrose, via U.S. Highway 50 and CO Highway 347
40 | North Rim: 11 miles south of Crawford, via CO Highway 92 and North Rim Road (unpaved)

41 |

There is no bridge between the north and south rims of the canyon. Allow two to three hours to drive from one side to the other.

42 |

PUBLIC TRANSPORTATION
43 | By bus: To Montrose or Grand Junction
44 | By train: To Grand Junction
45 | There is no public transportation within the park.

46 |

PLANE
47 | Commercial airline service is available to Montrose, Gunnison and Grand Junction.

48 |

 

",CURE_Info@nps.gov,,2592,38.5754,-107.7416,http://www.nps.gov/blca/planyourvisit/maps.htm,(970) 641 2337,,,Black Canyon Of The Gunnison National Park 49 | Bryce Canyon National Park,"{'TYPE': 'Point', 'COORDINATES': [-112.169951499, 37.6392057538]}",,,,2016-10-11,,"There is no place like Bryce Canyon. Hoodoos (odd-shaped pillars of rock left standing from the forces of erosion) can be found on every continent, but here is the largest collection of hoodoos in the world! Descriptions fail. Cave without a roof? Forest of stone? Photographs do not do it justice. An imagination of wonder will serve you when visiting Bryce Canyon National Park.",http://www.nps.gov/brca/planyourvisit/directions.htm,brca_information@nps.gov,,2599,37.6392057538,-112.169951499,http://www.nps.gov/brca/planyourvisit/maps.htm,,,,Bryce Canyon National Park 50 | Canyonlands National Park,,"[-109.856624603, 38.3121026863]",Point,,2016-10-11,,"Canyonlands invites you to explore a wilderness of countless canyons and fantastically formed buttes carved by the Colorado River and its tributaries. Rivers divide the park into four districts: the Island in the Sky, the Needles, the Maze, and the rivers themselves. These areas share a primitive desert atmosphere, but each offers different opportunities for sightseeing and adventure.","Car 51 | There are two paved entrances into Canyonlands: Highway 313 leads to the Island in the Sky, while Highway 211 leads to the Needles. Roads to the Maze are a mixture of graded dirt and 4WD and may become impassable when wet. 52 | 53 | Plane 54 | Commercial airlines serve Grand Junction, CO and Salt Lake City, UT. By car, these cities are at least 2 and 4 hours (respectively) away from the closest park entrance (Island in the Sky). Commercial air service is also available between Denver and Moab. 55 | 56 | Bus 57 | Greyhound travels along Interstate 70, making stops at Grand Junction, CO and Green River, UT. Commercial vans/shuttles operate between Moab and Salt Lake City as well as Grand Junction. 58 | 59 | Train 60 | Amtrak stops at Grand Junction, CO and Green River, UT. Commercial van services operate between Grand Junction and Moab. 61 | 62 | Public Transportation 63 | There is no public transportation to Canyonlands.",canyinfo@nps.gov,,2616,38.3121026863,-109.856624603,http://www.nps.gov/cany/planyourvisit/maps.htm,,,,Canyonlands National Park 64 | Capitol Reef National Park,,"[-111.261219024, 38.2906477893]",Point,,2016-10-11,,"Located in south-central Utah in the heart of red rock country, Capitol Reef National Park is a hidden treasure filled with cliffs, canyons, domes and bridges in the Waterpocket Fold, a geologic monocline (a wrinkle on the earth) extending almost 100 miles.","

Directions to Capitol Reef National Park

65 |

Traveling westbound on Interstate 70: Take Utah State Highway 24 west towards Hanksville (exit 149). Stay on Highway 24 for 95 miles to reach the park Visitor Center.

66 |

Traveling on Interstate 15: Take US Highway 50 east at Scipio (exit 188) towards Salina for 30 miles. At the junction with Utah State Highway 89/259, turn right (south) and travel 8 miles. Turn left (east) onto Utah State Highway 24 towards Sigurd. Continue on Highway 24 for 82 miles to reach the park Visitor Center.
67 |  

",CARE_Interpretation@nps.gov,,2617,38.2906477893,-111.261219024,http://www.nps.gov,(435) 425 3791,,,Capitol Reef National Park 68 | Carlsbad Caverns National Park,,,,,2016-10-11,,"High ancient sea ledges, deep rocky canyons, flowering cactus and desert wildlife - treasures above the ground in the Chihuahuan Desert. Hidden beneath the surface are more than 119 known caves - all formed when sulfuric acid dissolved the surrounding limestone leaving behind caverns of all sizes. 69 | 70 | 71 | **Check out our new ""Park Ranger Blog"" feature! Learn all about the park from a ranger's viewpoint.",,cave_park_information@nps.gov,,2622,32.1479,-104.5567,http://www.nps.gov/cave/planyourvisit/maps.htm,(575) 785 2232,,,Carlsbad Caverns National Park 72 | Channel Islands National Park,,"[-119.26687, 34.2480594]",Point,,2016-10-11,,"Channel Islands National Park encompasses five remarkable islands and their ocean environment, preserving and protecting a wealth of natural and cultural resources. Isolation over thousands of years has created unique animals, plants, and archeological resources found nowhere else on Earth and helped preserve a place where visitors can experience coastal southern California as it once was.","Directions 73 | http://www.nps.gov/chis/planyourvisit/directions.htm 74 | While the mainland visitor centers in Ventura and Santa Barbara are readily accessible by car or public transportation, the islands are only accessible by park concessionaire boats and planes or private boat. Advanced planning is highly recommended. 75 | The Robert J. Lagomarsino Visitor Center at Channel Islands National Park 76 | 1901 Spinnaker Drive 77 | Ventura, CA 93001 78 | (805) 658-5730 79 | The visitor center is located in the Ventura Harbor in Ventura, California. Ventura is located 70 miles north of Los Angeles and 30 miles south of Santa Barbara. Plane, train, and bus service are all available to Los Angeles and Santa Barbara. Only train, bus, and private car transportation are available from Los Angeles and Santa Barbara to Ventura. 80 | Fees 81 | http://www.nps.gov/chis/planyourvisit/feesandreservations.htm 82 | There are no entrance fees to visit the park.",chis_information@nps.gov,,2631,34.2480594,-119.26687,http://www.nps.gov/chis/planyourvisit/maps.htm,(805) 658 5730,,,Channel Islands National Park 83 | Congaree National Park,,"[-80.7971115112, 33.9066505432]",Point,,2016-10-11,,"Astonishing biodiversity exists in Congaree National Park, the largest intact expanse of old growth bottomland hardwood forest remaining in the southeastern United States. Waters from the Congaree and Wateree Rivers sweep through the floodplain, carrying nutrients and sediments that nourish and rejuvenate this ecosystem and support the growth of national and state champion trees.",,cong_information@nps.gov,,2644,33.9066505432,-80.7971115112,http://www.nps.gov/cong/planyourvisit/maps.htm,,,,Congaree National Park 84 | Crater Lake National Park,,"[-122.13429451, 42.8966964816]",Point,,2016-10-11,,"Crater Lake inspires awe. Native Americans witnessed it form 7,700 years ago, when a violent eruption triggered the collapse of a towering volcano. Scientists marvel at its purity: fed by rain and snow, it's the deepest lake in the USA and perhaps the most pristine on earth. Artists, photographers, and sightseers stand in wonder at its blue water and stunning setting. Come visit, and be amazed!",,craterlake@nps.gov,,2647,42.8966964816,-122.13429451,http://www.nps.gov/crla/planyourvisit/maps.htm,(541) 594 3000,,,Crater Lake National Park 85 | Cuyahoga Valley National Park,,"[-81.558754, 41.263092]",Point,,2016-10-11,,"Though a short distance from the urban areas of Cleveland and Akron, Cuyahoga Valley National Park seems worlds away. The park is a refuge for native plants and wildlife, and provides routes of discovery for visitors. The winding Cuyahoga River gives way to deep forests, rolling hills, and open farmlands. Walk or ride the Towpath Trail to follow the historic route of the Ohio & Erie Canal.","

The park is located in northeastern Ohio between the cities of Cleveland and Akron.

86 |

By Plane:
87 | Cleveland Hopkins International Airport (15 miles) and Akron-Canton Regional Airport (20 miles) offer many daily flights to the area.

88 |

By Car:
89 | Cuyahoga Valley National Park can be accessed by many different highways, including I-77, I-271, I-80 (Ohio Turnpike), and State Route 8. Park signs are visible from each of these freeways as you get close to the valley. For more details, call (330) 657-2752.

90 |

By Bus:
91 | Bus stations are located in downtown Cleveland and Akron.
92 |  

",cuva_info@nps.gov,,2652,41.263092,-81.558754,http://www.nps.gov/cuva/planyourvisit/maps.htm,,,,Cuyahoga Valley National Park 93 | Denali National Park & Preserve,,,,,2016-10-11,,"Denali is six million acres of wild land, bisected by one ribbon of road. Travelers along it see the relatively low-elevation taiga forest give way to high alpine tundra and snowy mountains, culminating in North America's tallest peak, 20,310' Denali. Wild animals large and small roam un-fenced lands, living as they have for ages. Solitude, tranquility and wilderness await.",You can reach Denali from Anchorage or Fairbanks via Alaska State Highway 3. Visit http://www.nps.gov/dena/planyourvisit/directions.htm for more details.,denali_info@nps.gov,,2658,63.1148,-151.1926,http://www.nps.gov/dena/planyourvisit/maps.htm,(907) 683 2294,,,Denali National Park & Preserve 94 | Death Valley National Park,"{'TYPE': 'Point', 'COORDINATES': [-116.866666667, 36.4616666667]}",,,,2016-10-11,,"In this below-sea-level basin, steady drought and record summer heat make Death Valley a land of extremes. Yet, each extreme has a striking contrast. Towering peaks are frosted with winter snow. Rare rainstorms bring vast fields of wildflowers. Lush oases harbor tiny fish and refuge for wildlife and humans. Despite its morbid name, a great diversity of life survives in Death Valley.",http://www.nps.gov/deva/planyourvisit/directions.htm,deva_information@nps.gov,,2662,36.4616666667,-116.866666667,http://www.nps.gov/deva/planyourvisit/maps.htm,(760) 786 3200,,,Death Valley National Park 95 | Dry Tortugas National Park,"{'TYPE': 'Point', 'COORDINATES': [-82.9223480225, 24.6295833588]}",,,,2016-10-11,,"Almost 70 miles (113 km) west of Key West lies the remote Dry Tortugas National Park. The 100-square mile park is mostly open water with seven small islands. Accessible only by boat or seaplane, the park is known the world over as the home of magnificent Fort Jefferson, picturesque blue waters, superlative coral reefs and marine life, and the vast assortment of bird life that frequent the area.",,DRTO_Information@nps.gov,,2665,24.6295833588,-82.9223480225,http://www.nps.gov/drto/planyourvisit/maps.htm,,,,Dry Tortugas National Park 96 | Everglades National Park,"{'TYPE': 'Point', 'COORDINATES': [-80.9548873901, 25.3716144562]}",,,,2016-10-11,,"Everglades National Park protects an unparalleled landscape that provides important habitat for numerous rare and endangered species like the manatee, American crocodile, and the elusive Florida panther. 97 | 98 | An international treasure as well - a World Heritage Site, International Biosphere Reserve, a Wetland of International Importance, and a specially protected areas under the Cartagena Treaty.",http://www.nps.gov/ever/planyourvisit/index.htm,EVER_Information@nps.gov,,2677,25.3716144562,-80.9548873901,http://www.nps.gov/ever/planyourvisit/maps.htm,,,,Everglades National Park 99 | Gates Of The Arctic National Park & Preserve,,,,,2016-10-11,,"This vast landscape does not contain any roads or trails. Visitors discover intact ecosystems where people have lived with the land for thousands of years. Wild rivers meander through glacier-carved valleys, caribou migrate along age-old trails, endless summer light fades into aurora-lit night skies of winter. It remains virtually unchanged except by the forces of nature.",,GAAR_Visitor_Information@nps.gov,,2716,67.9204,-153.2753,http://www.nps.gov/gaar/planyourvisit/maps.htm,(907) 692 5494,,,Gates Of The Arctic National Park & Preserve 100 | Glacier National Park,,,,,2016-10-11,,"Come and experience Glacier's pristine forests, alpine meadows, rugged mountains, and spectacular lakes. With over 700 miles of trails, Glacier is a hiker's paradise for adventurous visitors seeking wilderness and solitude. Relive the days of old through historic chalets, lodges, and transportation. Hear the stories of Native Americans. Explore Glacier National Park and discover what awaits you.","

Glacier National Park is located in the northwest corner of Montana along the spine of the Rocky Mountains.

101 |

By Car
102 | The West Glacier Entrance is accessible from U.S. Highway 2. All three east side entrances (St. Mary, Two Medicine, or Many Glacier) can be reached from Highway 89, then following signage to the respective entrance.

103 |

By Plane
104 | Glacier Park International Airport in Kalispell, Montana is 25 miles west of park headquarters in West Glacier, Montana. There are also airports in Great Falls, Montana (between 130 miles to 165 miles east of East Glacier Park, St Mary, Two Medicine and Many Glacier Entrances) and Missoula, Montana (156 miles south of West Glacier).

105 |

Car rentals are available at airports. Shuttles are available at the Kalispell airport.

106 |

By Train
107 | Amtrak services both East Glacier and West Glacier. Glacier Park Inc., provides a shuttle service at these locations. Please call them at 406-892-2525 for more information.
108 |  

",glac_questions@nps.gov,,2725,48.7596,-113.787,http://www.nps.gov/glac/planyourvisit/maps.htm,,,,Glacier National Park 109 | Glacier Bay National Park & Preserve,,"[-136.967208862, 58.819519043]",Point,,2016-10-11,,"Covering 3.3 million acres of rugged mountains, dynamic glaciers, temperate rainforest, wild coastlines and deep sheltered fjords, Glacier Bay National Park is a highlight of Alaska's Inside Passage and part of a 25-million acre World Heritage Site—one of the world's largest international protected areas. From sea to summit, Glacier Bay offers limitless opportunities for adventure and inspiration.","Glacier Bay National Park and Preserve lies west of Juneau, AK and can only be reached by plane or boat. The only road merely connects the small town of Gustavus and its airfield to park headquarters at Bartlett Cove (10 miles). 110 | 111 | Alaska Airlines provides daily jet service from Juneau to Gustavus (about 30 minutes) in the summer season. Year-round scheduled air service to Gustavus is also provided by a variety of small air taxis and charters. 112 | 113 | Many visitors arrive in Glacier Bay as passengers on board cruise ships, tour boats, charter boats, and their own private vessels. 114 | 115 | The Alaska Marine Highway system now provides regular ferry service to Gustavus. The ferry dock is located in Gustavus, 9 miles from Glacier Bay park headquarters in Bartlett Cove. Check the AMHS website for schedules, times, and rates. If you are planning on bringing a vehicle, please be aware that vehicle based activities may be limited. 116 | 117 | For more information, please visit: 118 | http://www.nps.gov/glba/planyourvisit/directions.htm",glba_administration@nps.gov,,2726,58.819519043,-136.967208862,http://www.nps.gov/glba/planyourvisit/maps.htm,,,,Glacier Bay National Park & Preserve 119 | Great Basin National Park,,"[-114.218688965, 39.004588404]",Point,,2016-10-11,,"From the 13,000-foot summit of Wheeler Peak, to the sage-covered foothills, Great Basin National Park is a place to sample the stunning diversity of the larger Great Basin region. Come and partake of the solitude of the wilderness, walk among ancient bristlecone pines, bask in the darkest of night skies, and explore mysterious subterranean passages. There's a whole lot more than just desert here!",http://www.nps.gov/grba/planyourvisit/directions.htm,grba_interpretation@nps.gov,,2732,39.004588404,-114.218688965,http://www.nps.gov/grba/planyourvisit/maps.htm,,,,Great Basin National Park 120 | Grand Canyon National Park,,"[-112.137232572, 36.0567889363]",Point,,2016-10-11,,"Unique combinations of geologic color and erosional forms decorate a canyon that is 277 river miles (446km) long, up to 18 miles (29km) wide, and a mile (1.6km) deep. Grand Canyon overwhelms our senses through its immense size 121 | 122 | All South Rim roads are open. The North Rim is open for the season.",http://www.nps.gov/grca/planyourvisit/directions.htm,grca_information@nps.gov,,2733,36.0567889363,-112.137232572,http://www.nps.gov/grca/planyourvisit/maps.htm,(928) 638 7888,,,Grand Canyon National Park 123 | Great Sand Dunes National Park & Preserve,,"[-105.512001038, 37.7328987122]",Point,,2016-10-11,,"The tallest dunes in North America are the centerpiece in a diverse landscape of grasslands, wetlands, conifer and aspen forests, alpine lakes, and tundra. Experience this diversity through hiking, sand sledding, splashing in Medano Creek, wildlife watching, and more!","http://www.nps.gov/grsa/planyourvisit/directions.htm 124 | To access the main park area, including the Dunes Parking Lot, Visitor Center, and Pinyon Flats Campground, take Highway 150 from the south or County Road 6 from the west. Both are paved highways. DO NOT USE COMPUTER MAPPING PROGRAMS IN THE ROCKY MOUNTAINS FOR HIGHWAY TRAVEL. The most commonly used web and dashboard mapping programs have directed visitors to drive over hiking trails or primitive 4WD roads to reach the park. Numerous visitors have become stranded in snow or stuck at a remote trailhead trying to use GPS to reach the main park area. Use the map shown, or any Colorado highway map.",grsa_interpretation@nps.gov,,2738,37.7328987122,-105.512001038,http://www.nps.gov/grsa/planyourvisit/maps.htm,719-378-6399,,,Great Sand Dunes National Park & Preserve 125 | Great Smoky Mountains National Park,,"[-83.5369169712, 35.6852775067]",Point,,2016-10-11,,"Ridge upon ridge of forest straddles the border between North Carolina and Tennessee in Great Smoky Mountains National Park. World renowned for its diversity of plant and animal life, the beauty of its ancient mountains, and the quality of its remnants of Southern Appalachian mountain culture, this is America's most visited national park.","The park has three main entrances: Cherokee in North Carolina, and Gatlinburg and Townsend in Tennessee. Please visit the park's website at http://www.nps.gov/grsm/planyourvisit/directions.htm for directions to these entrances.",,,2739,35.6852775067,-83.5369169712,http://www.nps.gov/grsm/planyourvisit/maps.htm,,,,Great Smoky Mountains National Park 126 | Guadalupe Mountains National Park,,,,,2016-10-11,,"Guadalupe Mountains National Park is the world's premier example of a fossil reef from the Permian Era. The park is known for its extensive hiking and backpacking opportunities in one of the nation's most pristine wilderness areas. Birding, history, and many other opportunities to learn and have fun await visitors in this hidden gem of West Texas.","

By Car
127 |
Guadalupe Mountains National Park is located in far West Texas on U.S. Highway 62/180. The driving distance is 110 miles east of El Paso, Texas, or 56 miles southwest of Carlsbad, New Mexico.

128 |

Visitors traveling to Dog Canyon, on the park's north side, can access the area via New Mexico State Road 137.

129 |

By Plane
130 |
The closest large commercial airline service is El Paso, Texas. Other airlines serve Albuquerque, New Mexico, Lubbock and Midland, Texas and Mesa Airlines offers passenger service between Albuquerque and Carlsbad, New Mexico.

131 |

Public Transportation
132 |
There is no public transportation or shuttle service available in the park.

",gumo_superintendent@nps.gov,,2744,31.9452,-104.8725,http://www.nps.gov/gumo/planyourvisit/maps.htm,(915) 828 3251,,,Guadalupe Mountains National Park 133 | Haleakalā National Park,,,,,2016-10-11,,"This special place vibrates with stories of ancient and modern Hawaiian culture and protects the bond between the land and its people. The park also cares for endangered species, some of which exist nowhere else. Come visit this special place - renew your spirit amid stark volcanic landscapes and sub-tropical rain forest with an unforgettable hike through the backcountry.",,,,2751,20.7204,-156.1552,http://www.nps.gov/hale/planyourvisit/maps.htm,(808) 572 4400,,,Haleakalā National Park 134 | Hawai'i Volcanoes National Park,,"[-155.327972412, 19.3577289581]",Point,,2016-10-11,,"Volcanoes are monuments to Earth's origin, evidence that its primordial forces are still at work. During a volcanic eruption, we are reminded that our planet is an ever-changing environment whose basic processes are beyond human control. As much as we have altered the face of the Earth to suit our needs, we can only stand in awe before the power of an eruption.",http://www.nps.gov/havo/planyourvisit/directions.htm,HAVO_interpretation@nps.gov,,2753,19.3577289581,-155.327972412,http://www.nps.gov/havo/planyourvisit/maps.htm,(808) 985 6000,,,Hawai'i Volcanoes National Park 135 | Hot Springs National Park,,"[-93.0522232056, 34.5094413757]",Point,,2016-10-11,,"Water. That's what first attracted people, and they have been coming here ever since to use these soothing thermal waters to heal and relax. Rich and poor alike came for the baths, and a thriving city built up around the hot springs. Together nicknamed ""The American Spa,"" Hot Springs National Park today surrounds the north end of the city of Hot Springs, Arkansas. Come discover it for yourself.","http://www.nps.gov/hosp/planyourvisit/directions.htm 136 | 137 | Driving Directions 138 | 139 | Hot Springs National Park is in downtown Hot Springs; Bathhouse Row is on Central Avenue with the mountains of the park flanking the street. Visitors traveling north-south on I-30 take the Hot Springs US 70 West exit south of Benton, the Hot Springs US 270 West exit at Malvern, or the Hot Springs Ark. 7 North exit near Arkadelphia. Visitors traveling south on Ark. 7 will come through downtown Hot Springs where the visitor center is located. Visitors traveling south on US 71 from Fort Smith, or north on US 71 from Texarkana, take the US 270 East exit and take 270B through town. Visitors coming from Oklahoma on US 70 would take US 70B into Hot Springs. When you get into the city you will see signs for the National Park. The Visitor Center is located downtown on Highway 7 North or Central Avenue.",HOSP_Interpretation@nps.gov,,2760,34.5094413757,-93.0522232056,http://www.nps.gov/hosp/planyourvisit/maps.htm,(501) 624 2701,,,Hot Springs National Park 140 | Isle Royale National Park,,"[-88.7701721191, 48.030620575]",Point,,2016-10-11,,"Explore a rugged, isolated island, far from the sights and sounds of civilization. Surrounded by Lake Superior, Isle Royale offers unparalleled solitude and adventures for backpackers, hikers, boaters, kayakers, canoeists and scuba divers. Here, amid stunning scenic beauty, you'll find opportunities for reflection and discovery, and make memories that last a lifetime.",,ISRO_ParkInfo@nps.gov,,2769,48.030620575,-88.7701721191,http://www.nps.gov/isro/planyourvisit/maps.htm,,,,Isle Royale National Park 141 | Joshua Tree National Park,,"[-116.019618, 34.020558]",Point,,2016-10-11,,"Two distinct desert ecosystems, the Mojave and the Colorado, come together in Joshua Tree National Park. A fascinating variety of plants and animals make their homes in a land sculpted by strong winds and occasional torrents of rain. Dark night skies, a rich cultural history, and surreal geologic features add to the wonder of this vast wilderness in southern California. Come explore for yourself.","Joshua Tree National Park is located about 140 miles east of Los Angeles, 175 miles northeast of San Diego, 215 miles southwest of Las Vegas, Nevada, and 222 miles west of Phoenix, Arizona. You can approach Joshua Tree from Interstate 10 or California Highway 62 (the Twentynine Palms Highway). See http://www.nps.gov/jotr/planyourvisit/directions.htm for more information. 142 | 143 | Do not rely on GPS directions to navigate to or within Joshua Tree National Park! Vehicle navigation systems sometimes try to route you onto backcountry roads with ruts or soft sand that may be impassable to your vehicle.",jotr_info@nps.gov,,2782,34.020558,-116.019618,http://www.nps.gov/jotr/planyourvisit/maps.htm,(760) 367 5500,,,Joshua Tree National Park 144 | Katmai National Park & Preserve,,,,,2014-01-27,,"Katmai National Monument was established in 1918 to protect the volcanically devastated region surrounding Mount Katmai and the Valley of Ten Thousand Smokes. Today, Katmai National Park and Preserve remains an active volcanic landscape, but it also protects 9,000 years of human history as well as important habitat for salmon and the thousands of brown bears that feed on them.","Katmai National Park & Preserve is located on the Alaska Peninsula, across the Shelikof Strait from Kodiak Island. Park Headquarters is in King Salmon, about 290 air miles southwest of Anchorage. Several commercial airlines provide daily flights into King Salmon as there is no road access. Brooks Camp, approximately 30 air miles from King Salmon, is a common destination for visitors to the Park. Brooks Camp can only be reached via small float plane or boat.",KATM_Visitor_Information@nps.gov,,2786,58.5975,-154.6937,http://www.nps.gov/katm/planyourvisit/maps.htm,,,,Katmai National Park & Preserve 145 | Kenai Fjords National Park,,"[-150.246566772, 59.7971000671]",Point,,2016-10-11,,"At the edge of the Kenai Peninsula lies a land where the ice age lingers. Nearly 40 glaciers flow from the Harding Icefield, Kenai Fjords' crowning feature. Wildlife thrives in icy waters and lush forests around this vast expanse of ice. Native Alutiiq relied on these resources to nurture a life entwined with the sea. Today, shrinking glaciers bear witness to the effects of our changing climate.","Kenai Fjords National Park is located just outside the town of Seward in south-central Alaska, 126 miles south of Anchorage. Seward is accessible year-round via the Seward Highway, a National Scenic Byway. 146 | 147 | Follow the Seward Highway (AK-1) south from Anchorage. It will become AK-9 around mile 35 (87 miles from Anchorage) with AK-1 heading to Homer and Kenai. Continue on AK-9 to Seward. 148 | 149 | - Information Center (summer only): Turn left on S. Harbor Street (mile post 1). Go one block, and turn right on Fourth Street. It will be the second building on the left. 150 | 151 | - Exit Glacier Area / Nature Center / trails / campground (summer only): Turn right on to Herman Leirer Road (mile 3), and proceed 8 miles. The road will end at the parking lot for the nature center. 152 | 153 | - Administrative Offices (contact station for winter): Turn left on Washington Street (mile post 0). Continue across Fourth Street, and building will be on right.",kefj_information@nps.gov,,2787,59.7971000671,-150.246566772,http://www.nps.gov/kefj/planyourvisit/maps.htm,(907) 422 0500,,,Kenai Fjords National Park 154 | Kobuk Valley National Park,,"[-159.060638428, 67.3913726807]",Point,,2016-10-11,,"Caribou, sand dunes, the Kobuk River, Onion Portage - just some of the facets of Kobuk Valley National Park. Half a million caribou migrate through, their tracks crisscrossing sculpted dunes. The Kobuk River is an ancient and current path for people and wildlife. For 9000 years, people came to Onion Portage to harvest caribou as they swam the river. Even today, that rich tradition continues.","

Kobuk Valley National Park is a remote area. There are no roads that provide access.

155 |

Commercial airlines provide service from Anchorage to Kotzebue or Fairbanks to Bettles. Once in Kotzebue or Bettles, you must fly to the park with various air taxi operators. There are scheduled flights to villages and chartered flights to remote park areas. Summer access may include motorized/non-motorized watercraft, aircraft, or by foot. (Note: Traveling by foot in the summer would be an arduous, roundabout journey.) Winter access may include snowmobiles, aircraft or by foot.

156 |

 

",WEAR_webmail@nps.gov,,2795,67.3913726807,-159.060638428,http://www.nps.gov,,,,Kobuk Valley National Park 157 | Lake Clark National Park & Preserve,,"[-154.315093994, 60.1826068796]",Point,,2016-10-11,,"Lake Clark National Park is a land of stunning beauty where volcanoes steam, salmon run, bears forage, craggy mountains reflect in shimmering turquoise lakes, and local people and culture still depend on the land and water of their home. Solitude is found around every bend in the river and shoulder of a mountain. Venture into the park to become part of the wilderness.","

Air Charter Services
158 | Access to the Lake Clark region is by small aircraft and many air taxi services provide transportation to the park. Float planes may land on the many lakes throughout the area. Wheeled planes land on open beaches, gravel bars, or private airstrips in or near the park. A one to two-hour flight from Anchorage, Kenai or Homer will provide access to most points within the park and preserve.

159 |

Car
160 | There is no highway access to the park and preserve.

161 | Visit http://www.nps.gov/lacl/planyourvisit/directions.htm",LACL_visitor_information@nps.gov,,2799,60.1826068796,-154.315093994,http://www.nps.gov/lacl/planyourvisit/maps.htm,(806) 814 9894,,,Lake Clark National Park & Preserve 162 | Lassen Volcanic National Park,,,,,2016-10-11,,"Lassen Volcanic National Park is home to steaming fumaroles, meadows freckled with wildflowers, clear mountain lakes, and numerous volcanoes. Jagged peaks tell the story of its eruptive past while hot water continues to shape the land. Lassen Volcanic offers opportunities to discover the wonder and mysteries of volcanoes and hot water for visitors willing to explore the undiscovered.",,LAVO_information@nps.gov,,2803,40.4977,-121.4207,http://www.nps.gov/lavo/planyourvisit/maps.htm,,,,Lassen Volcanic National Park 163 | Mammoth Cave National Park,,"[-86.0993814468, 37.1871730685]",Point,,2016-10-11,,"Mammoth Cave National Park preserves the cave system and a part of the Green River valley and hilly country of south central Kentucky. This is the world's longest known cave system, with more than 400 miles explored. Early guide Stephen Bishop called the cave a ""grand, gloomy and peculiar place,"" but its vast chambers and complex labyrinths have earned its name - Mammoth.","

From the North: Take Interstate 65 to Exit 53 (Cave City Exit). Turn right onto KY-70. Follow 70/255 as it becomes the Mammoth Cave Parkway in the park. Follow the Mammoth Cave Parkway to the Visitor Center.

164 | 165 |

From the South: Take Interstate 65 to Exit 48 (Park City Exit). Turn left onto KY-255 and follow 255 as it becomes the Park City Road into the park. Follow Park City Road until it joins the Mammoth Cave Parkway; turn left. Follow the Mammoth Cave Parkway to the Visitor Center.

166 | 167 |

Physical Address: 168 | Mammoth Cave National Park 169 | 1 Mammoth Cave Parkway 170 | Mammoth Cave, KY 42259

171 | 172 |

GPS Coordinates: 173 | Lat/Long: N 37° 11' 13.115'' ¦ W 86° 06' 05.197'' 174 | Decimal Degrees: +37.186976 ¦ -86.101444 175 | UTM (Zone 16N, NAD83): 579779.491 ¦ 4115977.605 m

176 | 177 |

NOTE: Commercial vehicles are prohibited on the park's roads.

",MACA_Information@nps.gov,,2818,37.1871730685,-86.0993814468,http://www.nps.gov/maca/planyourvisit/maps.htm,(270) 758 2180,,,Mammoth Cave National Park 178 | Mesa Verde National Park,,"[-108.410971642, 37.3389974426]",Point,,2016-10-11,,"Mesa Verde, Spanish for green table, offers a spectacular look into the lives of the Ancestral Pueblo people who made it their home for over 700 years, from AD 600 to 1300. Today the park protects nearly 5,000 known archeological sites, including 600 cliff dwellings. These sites are some of the most notable and best preserved in the United States.","Mesa Verde National Park is in Southwestern Colorado. The park entrance and Mesa Verde Visitor and Research Center is on Highway 160 between the towns of Cortez (9 miles) and Mancos (7 miles), Colorado. The first view of a cliff dwelling is 21 miles (about 45 minutes) past the park entrance along a steep, narrow, winding road. 179 | 180 | The nearest airports are Cortez, Colorado; Durango, Colorado; and Farmington, New Mexico. The closest bus station is in Durango, Colorado.",meve_general_information@nps.gov,,2824,37.3389974426,-108.410971642,http://www.nps.gov/meve/planyourvisit/maps.htm,970-529-4465,,,Mesa Verde National Park 181 | Mount Rainier National Park,,"[-121.915874481, 46.7407574422]",Point,,2016-10-11,,"Ascending to 14,410 feet above sea level, Mount Rainier stands as an icon in the Washington landscape. An active volcano, Mount Rainier is the most glaciated peak in the contiguous U.S.A., spawning six major rivers. Subalpine wildflower meadows ring the icy volcano while ancient forest cloaks Mount Rainier's lower slopes. Wildlife abounds in the park's ecosystems. A lifetime of discovery awaits.",For detailed directions to Mount Rainier National Park please visit our website at http://www.nps.gov/mora/planyourvisit/directions.htm.,morainfo@nps.gov,,2835,46.7407574422,-121.915874481,http://www.nps.gov/mora/planyourvisit/maps.htm,(360) 569 2211,,,Mount Rainier National Park 182 | North Cascades National Park,,"[-121.467964172, 48.8211250305]",Point,,2016-10-11,,"Less than three hours from Seattle, an alpine landscape beckons. Discover communities of life adapted to moisture in the west and recurring fire in the east. Explore jagged peaks crowned by more than 300 glaciers. Listen to cascading waters in forested valleys. Witness a landscape sensitive to the Earth's changing climate. Help steward the ecological heart of the Cascades.","Primary access to North Cascades National Park and Ross Lake National Recreation Area is from the State Route 20 (SR 20) corridor. Due to avalanche danger, the Washington State Department of Transportation typically closes the roadway between Ross Dam Trailhead and Lone Fir Campground from November to April. 183 | 184 | The Silver-Skagit Road to Hozomeen provides the only road access to the Ross Lake shoreline. This 37 mile (60 km) gravel road connects with B.C. Highway 1 (Exit 168) near Hope, British Columbia. 185 | 186 | Hiker and climber access to the northern Picket Range and Mount Shuksan is available from State Route 542 (SR 542) east of Bellingham and the Baker Lake Road northwest of Concrete. 187 | 188 | Passenger ferry and plane access to Stehekin is available from Chelan on U.S. Route 97. 189 | 190 | Hiker access to Stehekin begins at the Cascade Pass trailhead on the gravel Cascade River Road, the southbound Pacific Crest Trail from State Route 20 near the Rainy Pass picnic area, and from trailheads on the Twisp River Road.",noca_interpretation@nps.gov,,2845,48.8211250305,-121.467964172,http://www.nps.gov/noca/planyourvisit/maps.htm,(360) 854 7200,,,North Cascades National Park 191 | Petrified Forest National Park,,"[-109.7818412, 35.0657043]",Point,,2016-10-11,,"Did you know that Petrified Forest is more spectacular than ever? While the park has all the wonders known for a century, there are many new adventures and discoveries to share. There are backcountry hikes into areas never open before such as Red Basin and little known areas like the Martha's Butte. There are new exhibits that bring the stories to life. Come rediscover Petrified Forest!","

Coming from the west, take Highway 180 from Holbrook to the South entrance of the park; follow the road through the park and exit on Interstate 40 through the North entrance of the park.

192 |

From the east, take exit #311 off Interstate 40 and follow the road through the North entrance, continue south to Highway U.S. 180. Make a right and return to I-40 at Holbrook.

",PEFO_Superintendent@nps.gov,,2856,35.0657043,-109.7818412,http://www.nps.gov/pefo/planyourvisit/maps.htm,(928) 524 6228,,,Petrified Forest National Park 193 | Olympic National Park,,"[-123.425014168, 48.0999013782]",Point,,2016-10-11,,"With its incredible range in precipitation and elevation, diversity is the hallmark of Olympic National Park. Encompassing nearly a million acres, the park protects a vast wilderness, thousands of years of human history, and several distinctly different ecosystems, including glacier-capped mountains, old-growth temperate rain forests, and over 70 miles of wild coastline. Come explore!","Traveling by Car 194 | 195 | From the greater Seattle area and I-5 corridor, you can reach the park by several different routes: 196 | 197 | > Cross Puget Sound on one of the Washington State Ferries. Access U.S. 101 from Port Townsend (State Route 20), Kingston (State Route 104), or Bainbridge Island (State Routes 305 & 104). Be aware that State Route 104 crosses the Hood Canal Bridge which closes periodically for boat traffic. 198 | 199 | > From Tacoma (I-5), take State Route 16 to Bremerton; take State Route 3 north from Bremerton to State Route 104; be aware that State Route 104 crosses the Hood Canal Bridge which closes periodically for boat traffic. 200 | 201 | > Access U.S. 101 at Olympia (via I-5) 202 | 203 | > You may also access the park by following U.S. 101 north from Aberdeen, via the Washington/Oregon coast or U.S. 12 west from I-5. 204 | 205 | Public Transit 206 | 207 | > Clallam Transit System provides service within Port Angeles and commuter services to locations around the northern Olympic Peninsula.",olym_visitor_center@nps.gov,,2881,48.0999013782,-123.425014168,http://www.nps.gov/olym/planyourvisit/maps.htm,,,,Olympic National Park 208 | Pinnacles National Park,,"[-121.155279949, 36.484516114]",Point,,2016-10-11,,"Some 23 million years ago multiple volcanoes erupted, flowed, and slid to form what would become Pinnacles National Park. What remains is a unique landscape. Travelers journey through chaparral, oak woodlands, and canyon bottoms. Hikers enter rare talus caves and emerge to towering rock spires teeming with life: prairie and peregrine falcons, golden eagles, and the inspiring California condor.","No Through Road 209 | 210 | When driving to Pinnacles National Park, please keep in mind that there is no road that connects the east and west entrances of the park. 211 | 212 | Getting to the EAST SIDE: 213 | Take Hwy 101 to Hwy 25 south into Hollister, CA. On Hwy 25, go through the town of Hollister and continue about 30 miles to Hwy 146. Turn right on Hwy 146, into Pinnacles National Park. Turn left into the Pinnacles Campground to check in at Pinnacles Visitor Center. From the campground, the Bear Gulch Area, and most trail heads are 3.5 miles further into the park along Hwy 146. 214 | 215 | 216 | Getting to the WEST SIDE 217 | Take Hwy 101 to the town of Soledad, CA. Turn left onto Front Street and then take a right onto Hwy 146 east. Take care as you're driving through town; the highway takes a few turns. Follow Hwy 146 for 14 miles into Pinnacles National Park.",pinn_visitor_information@nps.gov,,2893,36.484516114,-121.155279949,,(831) 389 4486,,,Pinnacles National Park 218 | Rocky Mountain National Park,,"[-105.562038422, 40.3663213198]",Point,,2016-10-11,,"Rocky Mountain National Park's 415 square miles encompass and protect spectacular mountain environments. Enjoy Trail Ridge Road – which crests over 12,000 feet including many overlooks to experience the subalpine and alpine worlds – along with over 300 miles of hiking trails, wildflowers, wildlife, starry nights, and fun times. In a world of superlatives, Rocky is on top!",For directions to the park visit http://www.nps.gov/romo/planyourvisit/directions.htm,romo_information@nps.gov,,2907,40.3663213198,-105.562038422,http://www.nps.gov/romo/planyourvisit/maps.htm,(970) 586 1206,,,Rocky Mountain National Park 219 | Saguaro National Park,"{'TYPE': 'Point', 'COORDINATES': [-110.7363889, 32.1802778]}",,,,2016-10-11,,"Tucson, Arizona is home to the nation's largest cacti. The giant saguaro is the universal symbol of the American west. These majestic plants, found only in a small portion of the United States, are protected by Saguaro National Park, to the east and west of the modern city of Tucson. Here you have a chance to see these enormous cacti, silhouetted by the beauty of a magnificent desert sunset.","Rincon Mountain District (EAST): 3693 S. Old Spanish Trail, Tucson, Arizona 85730 220 | From Interstate 10 (Primary Route from I-10) 221 | Exit I-10 at exit # 275 (Houghton Road) and drive 9.5 miles (15 kilometers) north to Old Spanish Trail and turn right. Drive 3 miles (5 kilometers) southeast on Old Spanish Trail and the park entrance, which will be on the left side of the road. 222 | 223 | Tucson Mountain District (WEST): 2700 N. Kinney Road, Tucson, Arizona 85743 224 | From Interstate 10 (Primary Route from I-10) 225 | If you are traveling eastbound, there is one direction sign at Exit # 242, which is called the Avra Valley Road. Drive 5 miles (8 kilometers) west on Avra Valley Road to Sandario Road (turn left on Sandario Road). Drive 9 miles (14.5 kilometers) south on Sandario Road to Kinney Road (turn left on Kinney Road). The visitor center is 2 miles (3 kilometers) down Kinney Road on the left side of the road. 226 | 227 | For more alternative routes please go to: http://www.nps.gov/sagu/planyourvisit/directions.htm",sagu_information@nps.gov,,2917,32.1802778,-110.7363889,http://www.nps.gov/sagu/planyourvisit/maps.htm,(520) 733 5153,,,Saguaro National Park 228 | Sequoia & Kings Canyon National Parks,"{'TYPE': 'Point', 'COORDINATES': [-118.825595677, 36.4909251522]}",,,,2016-10-11,,"This dramatic landscape testifies to nature's size, beauty, and diversity--huge mountains, rugged foothills, deep canyons, vast caverns, and the world's largest trees. These two parks lie side by side in the southern Sierra Nevada east of the San Joaquin Valley. Weather varies a lot by season and elevation, which ranges from 1,370' to 14,494'. Sequoias grow at 5,000 - 7,000', above usual snowline.","Sequoia and Kings Canyon National Parks are open all year. Enter Sequoia National Park via Hwy. 198 near Three Rivers, CA. Enter Kings Canyon National Park via Hwy. 180 east from Fresno in Grant Grove. The main road between the parks is called the Generals Highway. 229 | 230 | Length Advisory for Vehicles Entering/Exiting Sequoia National Park via Generals Highway and Hwy. 198: Follow the recommendations below for your safety and the safety of others. 231 | 232 | -Vehicles longer than 22 ft. are not advised between Potwisha Campground and the Giant Forest Museum in Sequoia National Park. 233 | -Vehicles longer than 24 ft. are not advised between the Foothills Visitor Center and Potwisha Campground in Sequoia National Park. 234 | 235 | The roads leading to the Giant Forest Sequoia Grove were built in the early 1920s and cannot accommodate longer vehicles. 236 | 237 | For more information, visit www.nps.gov/seki or call (24-hours) 559-565-3341.",SEKI_Interpretation@nps.gov,,2931,36.4909251522,-118.825595677,http://www.nps.gov/seki/planyourvisit/maps.htm,,,,Sequoia & Kings Canyon National Parks 238 | Shenandoah National Park,"{'TYPE': 'Point', 'COORDINATES': [-78.4510114789, 38.4900674969]}",,,,2016-10-11,,"Just 75 miles from the bustle of Washington, D.C., Shenandoah National Park is your escape to recreation and re-creation. Cascading waterfalls, spectacular vistas, quiet wooded hollows—take a hike, meander along Skyline Drive, or picnic with the family. 200,000 acres of protected lands are haven to deer, songbirds, the night sky...and you. Plan a Shenandoah escape today!","GPS devices and online mapping services are not reliable in directing you to the park.Shenandoah is 105 miles long with four entrances: Front Royal, Virginia off Route 340; Route 211 east of Luray and west of Sperryville, Virginia; Route 33 east of Elkton and west of Stanardsville, Virginia; and Routes 64 and 250 east of Waynesboro and west of Charlottesville, Virginia.",SHEN_Superintendent@NPS.gov,,2933,38.4900674969,-78.4510114789,http://www.nps.gov/shen/planyourvisit/maps.htm,(540) 999-3500 ,,,Shenandoah National Park 239 | Theodore Roosevelt National Park,"{'TYPE': 'Point', 'COORDINATES': [-103.449996948, 46.9666671753]}",,,,2016-10-11,,"When Theodore Roosevelt came to Dakota Territory to hunt bison in 1883, he was a skinny, young, spectacled dude from New York. He could not have imagined how his adventure in this remote and unfamiliar place would forever alter the course of the nation. The rugged landscape and strenuous life that TR experienced here would help shape a conservation policy that we still benefit from today.","South Unit 240 | The South Unit entrance is in Medora, ND. Medora is accessible via Interstate 94 Exits 24 and 27 in North Dakota. Medora is 133 miles west of Bismarck, ND and 27 miles east of the Montana state line. 241 | 242 | The Painted Canyon Visitor Center is located 7 miles east of Medora on I-94 at Exit 32. 243 | 244 | North Unit 245 | The North Unit entrance is along U.S. Highway 85, approximately 14 miles south of Watford City, ND and 50 miles north of Belfield, ND. The distance by road from Medora to the North Unit is approximately 70 miles. I-94 travelers can access U.S. Highway 85 at Exit 42 in Belfield, ND. 246 | 247 | Elkhorn Ranch Unit 248 | The Elkhorn Ranch Unit is located 35 miles north of Medora. Access to the site is via gravel roads. Approaching the site from the east requires fording the Little Missouri River. Ask a ranger at one of the park visitor centers for information on traveling to the Elkhorn Ranch Site before you attempt the journey. For a map visit http://www.nps.gov/thro/planyourvisit/directions.htm",thro_interpretation@nps.gov,,2949,46.9666671753,-103.449996948,http://www.nps.gov/thro/planyourvisit/maps.htm,(701) 623 4730,,,Theodore Roosevelt National Park 249 | Virgin Islands National Park,"{'TYPE': 'Point', 'COORDINATES': [-64.7557621002, 18.351905146]}",,,,2016-10-11,,"Virgin Islands National Park's hills, valleys and beaches are breathtaking. However, within its 7,000 plus acres on the island of St. John is the complex history of civilizations - both free and enslaved - dating back more than a thousand years, all who utilized the land and the sea for survival.","Ferry service for passengers and vehicles is the only means of getting to and from St. John. 250 | Once on St. John there are no designated entrances to Virgin Islands National Park, although two main routes will provide access to many areas. Route 20 (North Shore Road) runs from the ferry dock past the Visitors Center to the most contiguous part of the Park, including most beaches and the campgrounds as well. Large and small tracts of private lands are found within the authorized boundary of the Park.",VIIS_Superintendent@nps.gov,,2967,18.351905146,-64.7557621002,http://www.nps.gov/viis/planyourvisit/maps.htm,,,,Virgin Islands National Park 251 | Voyageurs National Park,"{'TYPE': 'Point', 'COORDINATES': [-93.1617055088, 48.5843199822]}",,,,2016-10-11,,"Voyageurs National Park lies within the heart of the North American Continent. Here you can see and touch rocks half as old as the world, experience the life of a voyageur, immerse yourself in the sights and sounds of a boreal forest, view the dark skies, or ply the interconnected water routes. 252 | 253 | Leave your car behind and set out on the water highways of the North Woods.","

Plane
254 | A small airport is located in International Falls, Minnesota. Taxi service and rental cars are available here.
255 |
256 | Most flights entering the area will pass through the larger Minneapolis-St. Paul airport located around 5 hours south of Voyageurs National Park.
257 |
258 | Car
259 | Voyageurs National Park is approximately 5 hours north of Minneapolis-St. Paul on I-35 and Hwy 53, 3 hours north of Duluth on Hwy 53, and 4 hours south from Winnipeg, Manitoba.
260 |
261 | Public Transportation
262 |
There is no public transportation to Voyageurs National Park. No bus lines or passenger trains serve this area.
263 |
264 | Boat

265 | Many visitors enter the park by water. There are public launch ramps available at the three park visitor centers on Rainy Lake, Kabetogama Lake, and at the Ash River Visitor Center. Numerous resorts also offer boat access into the park.
266 |  

",voya_superintendent@nps.gov,,2970,48.5843199822,-93.1617055088,http://www.nps.gov/voya/planyourvisit/maps.htm,(218) 283 6600,,,Voyageurs National Park 267 | Wind Cave National Park,"{'TYPE': 'Point', 'COORDINATES': [-103.478250504, 43.5557484627]}",,,,2016-10-11,,"Bison, elk, and other wildlife roam the rolling prairie grasslands and forested hillsides of one of America's oldest national parks. Below the remnant island of intact prairie sits Wind Cave, one of the longest and most complex caves in the world. Named for barometric winds at its entrance, this maze of passages is home to boxwork, a unique formation rarely found elsewhere.",,ted_firkins@nps.gov,,2980,43.5557484627,-103.478250504,http://www.nps.gov/wica/planyourvisit/maps.htm,(605) 745 4600,,,Wind Cave National Park 268 | Wrangell - St Elias National Park & Preserve,"{'TYPE': 'Point', 'COORDINATES': [-142.242660522, 61.2079391479]}",,,,2016-10-11,,"Wrangell St. Elias is a vast national park that rises from the ocean all the way up to 18,008 ft. Mount St. Elias. At 13.2 million acres, it's the same size as Yellowstone Nat. Park, Yosemite Nat. Park, and Switzerland combined! Within this wild landscape, people continue to live off the land as they have done for centuries. This is a rugged, beautiful area filled with opportunities for adventure.","From Anchorage: follow Alaska Highway 1 (Glenn Highway) towards Palmer, AK, continue past Palmer to Glennallen, AK about 190 miles. At the intersection of the Glenn Highway and Alaska Highway 4 (Richardson Highway) turn right (south) and continue for 10 miles. The park headquarters and visitor center are on the left. 269 | 270 | Kennecott/McCarthy - To reach this area from the headquarters area, turn left or south on the Richardson Highway (AK Hwy 4) and travel about 25 miles to the junction of the Edgerton Highway (AK Hwy 10) and turn left. Travel 33 miles to Chitina. Go through the community of Chitina and cross the Copper River. The road turns to gravel and travel 59 miles to the footbridge across the Kennicott River. 271 | 272 | Slana/Nabesna - To reach this area from the headquarters area, turn right or north on the Richardson Highway (AK Hwy 4) and travel about 35 miles to the junction of the Glenn Highway (AK Hwy 1) also known as the Tok Cutoff and turn right. Travel 75 miles to the turnoff for Slana and turn right.",wrst_tweet@nps.gov,,2986,61.2079391479,-142.242660522,http://www.nps.gov,,,,Wrangell - St Elias National Park & Preserve 273 | Yellowstone National Park,"{'TYPE': 'Point', 'COORDINATES': [-110.691947937, 44.9912101476]}",,,,2016-10-11,,"Visit Yellowstone and experience the world's first national park. Marvel at a volcano's hidden power rising up in colorful hot springs, mudpots, and geysers. Explore mountains, forests, and lakes to watch wildlife and witness the drama of the natural world unfold. Discover the history that led to the conservation of our national treasures ""for the benefit and enjoyment of the people.""","For a location map and detailed directions to Yellowstone's five entrances into the park, please stop by our official website @ http://www.nps.gov/yell/planyourvisit/directions.htm. 274 | The road from the park's North Entrance at Gardiner, MT, through Mammoth Hot Springs and on to Cooke City, MT, outside the park's Northeast Entrance is the only road open all year to automobile traffic. 275 | A map of park destinations is available at http://www.nps.gov/yell/planyourvisit/mapslist.htm.",yell_visitor_services@nps.gov,,2988,44.9912101476,-110.691947937,http://www.nps.gov,(307) 344 2117,,,Yellowstone National Park 276 | Yosemite National Park,"{'TYPE': 'Point', 'COORDINATES': [-119.540840149, 37.8391265869]}",,,,2016-10-11,,"Not just a great valley, but a shrine to human foresight, the strength of granite, the power of glaciers, the persistence of life, and the tranquility of the High Sierra. 277 | 278 | First protected in 1864, Yosemite National Park is best known for its waterfalls, but within its nearly 1,200 square miles, you can find deep valleys, grand meadows, ancient giant sequoias, a vast wilderness area, and much more.","How to get to Yosemite.",,,2991,37.8391265869,-119.540840149,http://www.nps.gov/yose/planyourvisit/maps.htm,(209) 372 0200,,,Yosemite National Park 279 | Zion National Park,"{'TYPE': 'Point', 'COORDINATES': [-112.988339067, 37.2020727396]}",,,,2016-10-11,,"Follow the paths where ancient native people and pioneers walked. Gaze up at massive sandstone cliffs of cream, pink, and red that soar into a brilliant blue sky. Experience wilderness in a narrow slot canyon. Zion's unique array of plants and animals will enchant you as you absorb the rich history of the past and enjoy the excitement of present day adventures.","By Car 280 | Zion National Park is located on State Route 9 in Springdale, Utah. 281 | 282 | From Las Vegas, Nevada (163 miles), Mesquite, Nevada (80 miles), and Saint George, Utah (40 miles): 283 | 284 | Interstate 15 North 285 | Exit 16 - Right on State Route 9 East (33 miles) 286 | Right to stay on State Route 9 East in La Verkin, Utah (20 miles) 287 | Stay on State Route 9 East into Zion National Park, the Zion Canyon Visitor Center is ahead on the right.",ZION_park_information@nps.gov,,2994,37.2020727396,-112.988339067,http://www.nps.gov/zion/planyourvisit/maps.htm,435-772-3426,,,Zion National Park 288 | Wolf Trap National Park for the Performing Arts,"{'TYPE': 'Point', 'COORDINATES': [-77.2665939331, 38.9378089905]}",,,,2016-10-11,,"No matter what your age or taste in shows, you'll find something you like onstage at Wolf Trap. From May through September, multiple amphitheaters in the park present performances such as musicals, dance, opera, jazz, and popular and country music. 289 | 290 | A good time to explore the beauty and history of the park without the crowds is October - April.","From the Capital Beltway I-495: Take exit 45 to Rt 267 West (Dulles Toll Rd), follow signs to local exits, pay a $2.50 toll, and exit at the Wolf Trap ramp. 291 | 292 | From I-66 Westbound: Take exit 67 to Rt 267 (Dulles Toll Rd), follow signs for local exits, pay a $2.50 toll, and exit at the Wolf Trap ramp. 293 | 294 | From I-66 Eastbound: Take I-495 North to exit 45 onto Rt 267 (Dulles Toll Rd). Follow signs for local exits, pay a $2.50 toll, and exit at the Wolf Trap ramp. 295 | 296 | From Rt 7 Westbound (toward Leesburg): Turn left on Towlston Rd and the park will be on the left in 1 mile. 297 | 298 | From Rt 267 Eastbound: Take exit 16 onto Rt 7 West. Turn left on Towlston Rd and continue 1 mile and the park will be on the left. 299 | 300 | From Rt 123 in Vienna: Take Rt 123 North towards Tysons Corner. Turn left onto Old Courthouse Rd then turn left to stay on Old Courthouse Rd. Follow Old Courthouse Rd and turn right onto Trap Road. Turn left at the stop sign to stay on Trap Rd. Drive past the Dulles Toll Rd and the park will be on the right.",will_rifenbark@nps.gov,,3134,38.9378089905,-77.2665939331,http://www.nps.gov/wotr/planyourvisit/maps.htm,703-255-1800,,,Wolf Trap National Park for the Performing Arts 301 | Grand Teton National Park,"{'TYPE': 'Point', 'COORDINATES': [-110.714820862, 43.658708029]}",,,,2016-10-11,,"Rising above a scene rich with extraordinary wildlife, pristine lakes, and alpine terrain, the Teton Range stands monument to the people who fought to protect it. These are mountains of the imagination. Mountains that led to the creation of Grand Teton National Park where you can explore over two hundred miles of trails, float the Snake River or enjoy the serenity of this remarkable place.",,grte_info@nps.gov,,13525,43.658708029,-110.714820862,http://www.nps.gov/grte/planyourvisit/maps.htm,(307) 739-3300,,,Grand Teton National Park 302 | Pinnacles National Park,,"[-121.155279949, 36.484516114]",Point,,2013-09-09,,"Rising out of the chaparral-covered Gabilan Mountains, east of central California's Salinas Valley, are the spectacular remains of an ancient volcanic field. Massive monoliths, spires, sheer-walled canyons and talus passages define millions of years of erosion, faulting and tectonic plate movement.",http://www.nps.gov/pinn/planyourvisit/directions.htm,pinn_visitor_information@nps.gov,,13973,36.484516114,-121.155279949,http://www.nps.gov/pinn/planyourvisit/maps.htm,,,,Pinnacles National Park 303 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | 6 | # testing 7 | coverage 8 | 9 | # production 10 | build 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | npm-debug.log 16 | *.out 17 | 18 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/README.md: -------------------------------------------------------------------------------- 1 | Repo for appendto.com React/Redux Google Maps article 2 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/collection.geojson: -------------------------------------------------------------------------------- 1 | { 2 | "type": "FeatureCollection", 3 | "features": [{ 4 | "type": "Feature", 5 | "geometry": { 6 | "type": "Point", 7 | "coordinates": [-122.166149, 42.865508] 8 | }, 9 | "properties": { 10 | "flush": true, 11 | "shower": true, 12 | "vault": false, 13 | "description": "Flush toilet, Shower", 14 | "title": "Mazama", 15 | "marker-size": "small" 16 | } 17 | }, { 18 | "type": "Feature", 19 | "geometry": { 20 | "type": "Point", 21 | "coordinates": [-122.342876, 43.063217] 22 | }, 23 | "properties": { 24 | "flush": false, 25 | "shower": false, 26 | "vault": true, 27 | "description": "Vault toilet", 28 | "title": "Claude Lewis Sno-Park-USFS", 29 | "marker-size": "small" 30 | } 31 | }, { 32 | "type": "Feature", 33 | "geometry": { 34 | "type": "Point", 35 | "coordinates": [-122.037881, 42.879145] 36 | }, 37 | "properties": { 38 | "flush": true, 39 | "shower": false, 40 | "vault": false, 41 | "description": "Flush toilet", 42 | "title": "Lost Creek", 43 | "marker-size": "small" 44 | } 45 | }, { 46 | "type": "Feature", 47 | "geometry": { 48 | "type": "Point", 49 | "coordinates": [-122.330322, 43.056641] 50 | }, 51 | "properties": { 52 | "flush": false, 53 | "shower": false, 54 | "vault": true, 55 | "description": "Vault toilet", 56 | "title": "Hamaker", 57 | "marker-size": "small" 58 | } 59 | }, { 60 | "type": "Feature", 61 | "geometry": { 62 | "type": "Point", 63 | "coordinates": [-122.337174, 42.877807] 64 | }, 65 | "properties": { 66 | "flush": false, 67 | "shower": false, 68 | "vault": true, 69 | "description": "Vault toilet", 70 | "title": "Huckleberry Mountain", 71 | "marker-size": "small" 72 | } 73 | }, { 74 | "type": "Feature", 75 | "geometry": { 76 | "type": "Point", 77 | "coordinates": [-122.463867, 42.889648] 78 | }, 79 | "properties": { 80 | "flush": false, 81 | "shower": false, 82 | "vault": true, 83 | "description": "Vault toilet", 84 | "title": "Natural Bridge -USFS", 85 | "marker-size": "small" 86 | } 87 | }, { 88 | "type": "Feature", 89 | "geometry": { 90 | "type": "Point", 91 | "coordinates": [-122.433105, 42.919678] 92 | }, 93 | "properties": { 94 | "flush": false, 95 | "shower": false, 96 | "vault": false, 97 | "description": "", 98 | "title": "Farewell Bend", 99 | "marker-size": "small" 100 | } 101 | }, { 102 | "type": "Feature", 103 | "geometry": { 104 | "type": "Point", 105 | "coordinates": [-121.924772, 42.884588] 106 | }, 107 | "properties": { 108 | "flush": false, 109 | "shower": false, 110 | "vault": true, 111 | "description": "Vault toilet", 112 | "title": "Scott Creek", 113 | "marker-size": "small" 114 | } 115 | }, { 116 | "type": "Feature", 117 | "geometry": { 118 | "type": "Point", 119 | "coordinates": [-122.324644, 42.913045] 120 | }, 121 | "properties": { 122 | "flush": false, 123 | "shower": false, 124 | "vault": true, 125 | "description": "Vault toilet", 126 | "title": "Thousand Springs Sno-Park-USFS", 127 | "marker-size": "small" 128 | } 129 | }, { 130 | "type": "Feature", 131 | "geometry": { 132 | "type": "Point", 133 | "coordinates": [-122.45, 42.9102777778] 134 | }, 135 | "properties": { 136 | "flush": false, 137 | "shower": false, 138 | "vault": true, 139 | "description": "Vault toilet", 140 | "title": "Union Creek", 141 | "marker-size": "small" 142 | } 143 | }, { 144 | "type": "Feature", 145 | "geometry": { 146 | "type": "Point", 147 | "coordinates": [-122.4353305556, 42.9162388889] 148 | }, 149 | "properties": { 150 | "flush": false, 151 | "shower": false, 152 | "vault": false, 153 | "description": "", 154 | "title": "Farewell Bend Campground", 155 | "marker-size": "small" 156 | } 157 | }] 158 | } -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/Crater_Lake_Mazama_Campground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/Crater_Lake_Mazama_Campground.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/craterlake_smaller.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/craterlake_smaller.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/farewellbend.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/farewellbend.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/hamaker.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/hamaker.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/huckleberry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/huckleberry.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/lost creek cg nps.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/lostcreek.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/lostcreek.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/mazama.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/mazama.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/naturalbridge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/naturalbridge.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/scottcreek.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/scottcreek.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/screenshot.png -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/images/unioncreek.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/images/unioncreek.jpg -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react_redux_camping_filters", 3 | "version": "0.1.0", 4 | "private": true, 5 | "devDependencies": { 6 | "babel-core": "^6.5.2", 7 | "babel-loader": "^6.2.4", 8 | "babel-polyfill": "^6.22.0", 9 | "babel-preset-es2015": "^6.5.0", 10 | "babel-preset-react": "^6.5.0", 11 | "chai": "^3.5.0", 12 | "chai-immutable": "^1.6.0", 13 | "import": "0.0.6", 14 | "isomorphic-fetch": "^2.2.1", 15 | "mocha": "^3.2.0", 16 | "react-datepicker": "^0.40.0", 17 | "react-redux": "^5.0.1", 18 | "react-scripts": "0.8.4", 19 | "redux": "^3.6.0", 20 | "redux-thunk": "^2.2.0", 21 | "underscore": "^1.8.3", 22 | "webpack": "^1.12.14", 23 | "webpack-dev-server": "^1.14.1" 24 | }, 25 | "babel": { 26 | "presets": [ 27 | "es2015", 28 | "react" 29 | ] 30 | }, 31 | "dependencies": { 32 | "google-maps-react": "^1.0.19", 33 | "immutable": "^3.8.1", 34 | "moment": "^2.17.1", 35 | "react": "^15.4.1", 36 | "react-bootstrap": "^0.30.7", 37 | "react-dom": "^15.4.1" 38 | }, 39 | "scripts": { 40 | "start": "react-scripts start", 41 | "build": "react-scripts build", 42 | "test": "react-scripts test --env=jsdom", 43 | "eject": "react-scripts eject" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/appendto/react_redux_camping_filters/public/favicon.ico -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Campground Filtering with React and Redux 5 | 6 | 7 | 8 | 9 | 10 | React App 11 | 12 | 13 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 80px; 8 | } 9 | 10 | .App-header { 11 | background-color: #222; 12 | height: 150px; 13 | padding: 20px; 14 | color: white; 15 | } 16 | 17 | .App-intro { 18 | font-size: large; 19 | } 20 | 21 | @keyframes App-logo-spin { 22 | from { transform: rotate(0deg); } 23 | to { transform: rotate(360deg); } 24 | } 25 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | }); 9 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/CampFilter.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default class CampFilter extends React.Component { 4 | render() { 5 | return ( 6 |
7 | this.props.changeFilter(this.props.id)}/> 12 |   13 | 14 |
15 | ) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/CampFilterApp.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {connect} from 'react-redux'; 3 | import ReactDOM from 'react-dom' 4 | import {Jumbotron} from 'react-bootstrap'; 5 | import * as actionCreators from './action_creators'; 6 | import './App.css'; 7 | import CampFilterList from './CampFilterList'; 8 | import CampList from './CampList'; 9 | import CampMapContainer from './CampMapContainer'; 10 | import _ from 'underscore' 11 | import * as config from './config' 12 | import GoogleApiComponent from './GoogleApiComponent' 13 | import WeatherDatePicker from './WeatherDatePicker' 14 | 15 | export class CampFilterApp extends React.Component { 16 | 17 | render() { 18 | return ( 19 |
20 |
21 | 22 |

Crater Lake Camping

23 |
24 | 25 |

26 | 27 |

28 | 29 |

30 | 31 | 32 | 33 |
34 | )}; 35 | } 36 | 37 | function getIndex(state, objName, field, itemId) { 38 | return state.get(objName).findIndex( 39 | (item) => item.get(field) === itemId 40 | ); 41 | } 42 | 43 | 44 | function mapStateToProps(state) { 45 | return { 46 | filters: state.get('filters'), 47 | markers: state.get('markers'), 48 | showingInfoWindow: state.get('showingInfoWindow'), 49 | activeMarker: state.get('activeMarker'), 50 | selectedTitle: state.get('selectedTitle'), 51 | weatherSummary: state.get('weatherSummary'), 52 | currentDate: state.get('currentDate'), 53 | currentLat: state.get('currentLat'), 54 | currentLong: state.get('currentLong'), 55 | gmapMarkers: state.get('gmapMarkers'), 56 | isFetching: state.get('isFetching'), 57 | selectedDate: state.get('selectedDate') 58 | }; 59 | } 60 | 61 | 62 | export const CampFilterAppContainer = connect(mapStateToProps,actionCreators)(CampFilterApp); 63 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/CampFilterList.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {ButtonGroup} from 'react-bootstrap'; 3 | import CampFilter from './CampFilter' 4 | 5 | export default class CampFilterList extends React.Component { 6 | 7 | render() { 8 | return ( 9 |
10 |
Campground Filters:
11 | {this.props.filters.map(item => 12 | 16 | )} 17 |
18 | )} 19 | } 20 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/CampList.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CampListItem from './CampListItem' 3 | 4 | export default class CampList extends React.Component { 5 | getCampgrounds() { 6 | return this.props.markers.filter( 7 | cg => cg.get('mapOn') === true 8 | ) 9 | } 10 | render() { 11 | return ( 12 |
13 | {this.getCampgrounds().map(item => 14 | 22 | )} 23 |
24 | )} 25 | } 26 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/CampListItem.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default class CampListItem extends React.Component { 4 | componentDidUpdate(prevProps, prevState) { 5 | if (this.props.activeMarker !== prevProps.activeMarker) { 6 | let img_ref = this.refs.cg_image 7 | if (this.props.showingInfoWindow && (this.props.selectedTitle === this.props.title)) { 8 | img_ref.style.border = "1px solid black" 9 | } 10 | else { 11 | img_ref.style.border = null 12 | } 13 | } 14 | } 15 | 16 | getMarker(title_match) { 17 | let match_list = this.props.markers.filter(item => 18 | item.get('title') === title_match 19 | ) 20 | if (match_list) { 21 | return match_list.first() 22 | } 23 | else { 24 | return null; 25 | } 26 | } 27 | 28 | render() { 29 | let latlng_str = parseFloat(this.props.position.first()).toFixed(3) + "," + parseFloat(this.props.position.last()).toFixed(3) 30 | let maps_url = "http://www.google.com/maps?q=" + latlng_str 31 | let img_url = "http://campnear.me/react_app_images/" + this.props.image 32 | let marker_match = this.getMarker(this.props.title) 33 | return ( 34 |
35 |
36 |
37 | this.props.onMarkerClick(this.getMarker(this.props.title))}> 38 |
39 |
40 | {this.props.title}

41 | {latlng_str} 42 |
43 |
44 |
45 | ) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/CampMap.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | 4 | export default class CampMap extends React.Component { 5 | 6 | renderChildren() { 7 | const {children} = this.props; 8 | if (!children) return; 9 | return React.Children.map(children, c => { 10 | return React.cloneElement(c, { 11 | map: this.map, 12 | google: this.props.google 13 | }); 14 | }) 15 | } 16 | 17 | componentDidMount() { 18 | this.loadMap(); 19 | } 20 | 21 | componentDidUpdate(prevProps, prevState) { 22 | if (prevProps.google !== this.props.google) { 23 | this.loadMap(); 24 | this.forceUpdate() 25 | } 26 | } 27 | 28 | // called after the component renders 29 | loadMap() { 30 | if (this.props && this.props.google) { 31 | // google is available 32 | console.log('prepping map') 33 | const {google} = this.props; 34 | const maps = google.maps; 35 | 36 | // since the component has already rendered we can grab 37 | // a ref to the map div so we can properly load the map 38 | // this is not super react-ish, since ideally React alone 39 | // touches the DOM 40 | const mapRef = this.refs.map; 41 | const node = ReactDOM.findDOMNode(mapRef); 42 | let zoom = 10; 43 | let lat = 42.9456; 44 | let lng = -122.2; 45 | const center = new maps.LatLng(lat, lng); 46 | const mapConfig = Object.assign({}, { 47 | center: center, 48 | zoom: zoom 49 | }) 50 | 51 | this.map = new maps.Map(node, mapConfig); 52 | console.log("Setting map on " + this.map) 53 | } 54 | 55 | // 56 | } 57 | 58 | render() { 59 | const style = { 60 | minWidth: '400px', 61 | minHeight: '400px' 62 | } 63 | return ( 64 |
65 |
66 | {this.renderChildren()} 67 | Loading map... 68 |
69 |
70 | ) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/CampMapContainer.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import * as config from './config' 3 | import GoogleApiComponent from './GoogleApiComponent' 4 | import CampMap from './CampMap' 5 | import {Marker} from './Marker' 6 | import {InfoWindow} from './InfoWindow' 7 | import CampList from './CampList' 8 | 9 | export class CampMapContainer extends React.Component { 10 | render() { 11 | return ( 12 |
13 | 14 | {this.props.markers.map(marker => 15 | 24 | 25 | )} 26 | 29 |
30 |

{this.props.selectedTitle}

31 |
32 |
33 |
34 |

35 | 36 |
37 | )} 38 | } 39 | 40 | let key = config.getGoogleKey() 41 | export default GoogleApiComponent({ 42 | apiKey: key 43 | })(CampMapContainer) 44 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/GoogleApiComponent.js: -------------------------------------------------------------------------------- 1 | import React, { PropTypes as T } from 'react' 2 | import ReactDOM from 'react-dom' 3 | 4 | import cache from './utils/ScriptCache' 5 | import GoogleApi from './utils/GoogleApi' 6 | 7 | const defaultMapConfig = {} 8 | export const wrapper = (options) => (WrappedComponent) => { 9 | const apiKey = options.apiKey; 10 | const libraries = options.libraries || ['places']; 11 | 12 | class Wrapper extends React.Component { 13 | constructor(props, context) { 14 | super(props, context); 15 | 16 | this.state = { 17 | loaded: false, 18 | map: null, 19 | google: null 20 | } 21 | } 22 | 23 | componentDidMount() { 24 | const refs = this.refs; 25 | this.scriptCache.google.onLoad((err, tag) => { 26 | const maps = window.google.maps; 27 | const props = Object.assign({}, this.props, { 28 | loaded: this.state.loaded 29 | }); 30 | 31 | const mapRef = refs.map; 32 | 33 | const node = ReactDOM.findDOMNode(mapRef); 34 | let center = new maps.LatLng(this.props.lat, this.props.lng) 35 | 36 | let mapConfig = Object.assign({}, defaultMapConfig, { 37 | center, zoom: this.props.zoom 38 | }) 39 | 40 | this.map = new maps.Map(node, mapConfig); 41 | 42 | this.setState({ 43 | loaded: true, 44 | map: this.map, 45 | google: window.google 46 | }) 47 | }); 48 | } 49 | 50 | componentWillMount() { 51 | this.scriptCache = cache({ 52 | google: GoogleApi({ 53 | apiKey: apiKey, 54 | libraries: libraries 55 | }) 56 | }); 57 | } 58 | 59 | render() { 60 | const props = Object.assign({}, this.props, { 61 | loaded: this.state.loaded, 62 | map: this.state.map, 63 | google: this.state.google, 64 | mapComponent: this.refs.map 65 | }) 66 | return ( 67 |
68 | 69 |
70 |
71 | ) 72 | } 73 | } 74 | 75 | return Wrapper; 76 | } 77 | 78 | export default wrapper; 79 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/InfoWindow.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOMServer from 'react-dom/server' 3 | 4 | export class InfoWindow extends React.Component { 5 | 6 | createMarkerObject(marker) { 7 | // create a google maps marker object to pass to the reducer 8 | let { 9 | map, google, title, properties, description 10 | } = this.props; 11 | 12 | let lat = marker.get('position').first() 13 | let long = marker.get('position').last() 14 | let position = new google.maps.LatLng(lat,long); 15 | 16 | const pref = { 17 | map: map, 18 | position: position, 19 | title:title 20 | }; 21 | 22 | let new_marker = new google.maps.Marker(pref); 23 | if (!marker.get('mapOn')) { 24 | new_marker.setMap(null); 25 | } 26 | else { 27 | new_marker.setMap(map) 28 | } 29 | 30 | return new_marker; 31 | } 32 | 33 | openWindow() { 34 | let marker = this.props.marker 35 | if (!this.props.marker.position) { 36 | // need to convert marker into google maps marker object 37 | marker = this.props.gmapMarkers.filter(marker => 38 | marker.title == this.props.marker.get('title')) 39 | marker = marker.first() 40 | } 41 | this.infowindow 42 | .open(this.props.map, marker); 43 | } 44 | closeWindow() { 45 | this.infowindow.close(); 46 | } 47 | 48 | renderChildren() { 49 | const {children} = this.props; 50 | return ReactDOMServer.renderToString(children); 51 | } 52 | 53 | updateContent() { 54 | if (this.props.map) { 55 | const content = this.renderChildren(); 56 | this.infowindow 57 | .setContent(content); 58 | } 59 | } 60 | 61 | componentDidUpdate(prevProps, prevState) { 62 | 63 | 64 | if (this.props.map !== prevProps.map) { 65 | this.renderInfoWindow(); 66 | } 67 | 68 | if ((this.props.visible !== prevProps.visible) || 69 | (this.props.marker !== prevProps.marker)) { 70 | this.props.visible ? 71 | this.openWindow() : 72 | this.closeWindow(); 73 | } 74 | 75 | if (this.props.children !== prevProps.children) { 76 | this.updateContent(); 77 | } 78 | } 79 | 80 | 81 | renderInfoWindow() { 82 | let {map, google} = this.props; 83 | 84 | const iw = this.infowindow = new google.maps.InfoWindow({ 85 | content: '' 86 | }); 87 | } 88 | 89 | render() { 90 | return null; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/Marker.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export class Marker extends React.Component { 4 | 5 | componentDidUpdate(prevProps) { 6 | if ((this.props.map !== prevProps.map) || 7 | (this.props.properties !== prevProps.properties) || 8 | (this.props.mapOn !== prevProps.mapOn)) { 9 | this.renderMarker() 10 | } 11 | } 12 | 13 | renderMarker() { 14 | let { 15 | map, google, title, properties, description 16 | } = this.props; 17 | 18 | // if the marker has already been drawn, set map on or null 19 | if (this.marker) { 20 | if (!this.props.mapOn) { 21 | this.marker.setMap(null); 22 | } 23 | else { 24 | this.marker.setMap(map) 25 | } 26 | return 27 | } 28 | 29 | let lat = this.props.position.first() 30 | let long = this.props.position.last() 31 | let position = new google.maps.LatLng(lat,long); 32 | 33 | // if marker does not have mapOn, set visibility to none via 34 | // setting the map to null 35 | const pref = { 36 | map: map, 37 | position: position, 38 | title:title 39 | }; 40 | 41 | this.marker = new google.maps.Marker(pref); 42 | this.marker.addListener('click', (e) => { 43 | this.props.onMarkerClick(this.marker) 44 | }) 45 | 46 | this.props.addMarker(this.marker) 47 | } 48 | 49 | render() { 50 | return null; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/WeatherDatePicker.jsx: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var DatePicker = require('react-datepicker'); 3 | var moment = require('moment'); 4 | //require('react-datepicker/dist/react-datepicker.css'); 5 | require('react-datepicker/dist/react-datepicker-cssmodules.css'); 6 | 7 | 8 | export default class WeatherDatePicker extends React.Component { 9 | 10 | checkDate(selectedDate) { 11 | if (selectedDate.isBefore(this.props.currentDate)) { 12 | alert("Please pick a date in the future.") 13 | return null 14 | } 15 | else { 16 | return selectedDate.format("YYYY-MM-DD") 17 | } 18 | } 19 | 20 | render() { 21 | return ( 22 |
23 | Travel Date:{'\u00a0\u00a0'} 24 | { 29 | let newDate = this.checkDate(selectedDate) 30 | if (newDate) { 31 | this.props.fetchWeather(this.checkDate(selectedDate), this.props.currentLat,this.props.currentLong) 32 | } 33 | }}/> 34 | {'\u00a0\u00a0\u00a0\u00a0'}Forecast:{'\u00a0\u00a0'}{this.props.weatherSummary} 35 |
36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/action_creators.js: -------------------------------------------------------------------------------- 1 | import fetch from 'isomorphic-fetch' 2 | 3 | 4 | export function changeFilter(filter) { 5 | return { 6 | type: 'CHANGE_FILTER', 7 | filter 8 | } 9 | } 10 | 11 | export function onMarkerClick(marker) { 12 | return { 13 | type: 'MARKER_CLICK', 14 | marker 15 | } 16 | } 17 | 18 | export function addMarker(marker) { 19 | return { 20 | type: 'ADD_MARKER', 21 | marker 22 | } 23 | } 24 | 25 | export function reqWeather(weatherDate) { 26 | return { 27 | type: 'REQ_WEATHER', 28 | weatherDate 29 | } 30 | } 31 | 32 | export function recvWeather(weatherDate, result) { 33 | return { 34 | type: 'RECV_WEATHER', 35 | weatherDate, 36 | response: result 37 | } 38 | } 39 | 40 | export function fetchWeather(weatherDate, currentLat, currentLong) { 41 | let request_url="https://crossorigin.me/https://api.darksky.net/forecast/8266ff95ef9bbfccf0ea24c325818f31/" 42 | let weather_str = weatherDate + "T00:00:00" 43 | console.log(weatherDate) 44 | request_url = request_url + currentLat + "," + currentLong + "," + weather_str 45 | 46 | return function (dispatch) { 47 | dispatch(reqWeather(weatherDate)) 48 | return fetch(request_url) 49 | .then(response => response.json()) 50 | .catch(error => { 51 | console.log("unable to get weather " + error) 52 | }) 53 | .then(respData => { 54 | console.log(respData) 55 | dispatch(recvWeather(weatherDate, respData)) 56 | }) 57 | .catch(error => { 58 | console.log("unable to parse weather result " + error) 59 | }) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/config.js: -------------------------------------------------------------------------------- 1 | export function getGoogleKey() { 2 | return "AIzaSyCd5GSrdhkRjDu53HCBVL7fh5QXa1-gIBE" 3 | //return "AIzaSyAReBJ8T7eBmBEuHaVv50ME6MBnO98kePw" 4 | } 5 | 6 | export function getDarkSkyKey() { 7 | return "f497c43097476c79bd09d4798aaffc56" 8 | } 9 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | font-size: 16px; 6 | } 7 | 8 | .jumbotron { 9 | margin-bottom: 5px; 10 | 11 | margin-top:0px; 12 | /*margin-left:-50px;*/ 13 | background-image: url(../images/craterlake_smaller.jpg); 14 | background: contain; 15 | background-size: cover; 16 | background-repeat: no-repeat; 17 | color: white; 18 | text-align: center; 19 | /*height:70%*/ 20 | 21 | } 22 | 23 | .jumbotron-text { 24 | position: relative; 25 | top: 50%; 26 | -webkit-transform: translateY(-50%); 27 | transform: translateY(-50%); 28 | background-color:rgba(124,124,124,0.8); 29 | width:auto; 30 | } 31 | 32 | input[type=checkbox] { 33 | transform: scale(1.5); 34 | } 35 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import {Provider} from 'react-redux'; 4 | import {createStore, applyMiddleware} from 'redux'; 5 | import reducer from './reducer' 6 | import {CampFilterAppContainer} from './CampFilterApp'; 7 | import './index.css'; 8 | var moment = require('moment'); 9 | import 'babel-polyfill' 10 | import thunkMiddleware from 'redux-thunk' 11 | import {fetchWeather} from './action_creators' 12 | 13 | const store = createStore(reducer, applyMiddleware( 14 | thunkMiddleware 15 | )) 16 | 17 | 18 | // convert json into dict for use by the React components 19 | // add mapOn variable to indicate if the marker should be visible 20 | // by default, set mapOn to false, filtering will indicate if it should be true 21 | function get_campgrounds(features) { 22 | let campgrounds = [] 23 | features.forEach(feature => { 24 | campgrounds.push({ 25 | 'title' : feature['properties']['title'], 26 | 'description' : feature['properties']['description'], 27 | 'position' : [feature['geometry']['coordinates'][1], 28 | feature['geometry']['coordinates'][0]], 29 | 'properties': feature['properties'], 30 | 'image': feature['properties']['image'], 31 | 'url': feature['properties']['url'], 32 | 'mapOn': true 33 | 34 | }) 35 | }); 36 | return campgrounds 37 | } 38 | 39 | 40 | let features = [{ 41 | "type": "Feature", 42 | "geometry": { 43 | "type": "Point", 44 | "coordinates": [-122.166149, 42.865508] 45 | }, 46 | "properties": { 47 | "flush": true, 48 | "shower": true, 49 | "pets": true, 50 | "water": true, 51 | "description": "Flush toilet, Shower", 52 | "title": "Mazama", 53 | "image": "mazama.jpg", 54 | "url": "http://www.craterlakelodges.com/lodging/mazama-village-campground/", 55 | "marker-size": "small" 56 | } 57 | }, { 58 | "type": "Feature", 59 | "geometry": { 60 | "type": "Point", 61 | "coordinates": [-122.037881, 42.879145] 62 | }, 63 | "properties": { 64 | "flush": true, 65 | "shower": false, 66 | "pets": false, 67 | "water":true, 68 | "description": "Flush toilet", 69 | "title": "Lost Creek", 70 | "url": "http://www.nps.gov/crla/planyourvisit/campgrounds.htm", 71 | "image": "lostcreek.jpg", 72 | "marker-size": "small" 73 | } 74 | }, { 75 | "type": "Feature", 76 | "geometry": { 77 | "type": "Point", 78 | "coordinates": [-122.337174, 42.877807] 79 | }, 80 | "properties": { 81 | "flush": false, 82 | "shower": false, 83 | "pets": true, 84 | "water": false, 85 | "description": "Vault toilet", 86 | "title": "Huckleberry Mountain", 87 | "url": "https://www.fs.usda.gov/recarea/rogue-siskiyou/recreation/ohv/recarea/?recid=69764&actid=29", 88 | "image": "huckleberry.jpg", 89 | "marker-size": "small" 90 | } 91 | }, { 92 | "type": "Feature", 93 | "geometry": { 94 | "type": "Point", 95 | "coordinates": [-122.463867, 42.889648] 96 | }, 97 | "properties": { 98 | "flush": false, 99 | "shower": false, 100 | "pets": true, 101 | "water": false, 102 | "description": "Vault toilet", 103 | "title": "Natural Bridge -USFS", 104 | "url": "https://www.fs.usda.gov/recarea/rogue-siskiyou/null/recarea/?recid=69828&actid=29", 105 | "image": "naturalbridge.jpg", 106 | "marker-size": "small" 107 | } 108 | }, { 109 | "type": "Feature", 110 | "geometry": { 111 | "type": "Point", 112 | "coordinates": [-121.924772, 42.884588] 113 | }, 114 | "properties": { 115 | "flush": false, 116 | "shower": false, 117 | "pets": true, 118 | "water": true, 119 | "description": "Vault toilet", 120 | "title": "Scott Creek", 121 | "url": "https://www.fs.usda.gov/recarea/fremont-winema/recreation/recarea/?recid=59719&actid=31", 122 | "image": "scottcreek.jpg", 123 | "marker-size": "small" 124 | } 125 | }, { 126 | "type": "Feature", 127 | "geometry": { 128 | "type": "Point", 129 | "coordinates": [-122.45, 42.9102777778] 130 | }, 131 | "properties": { 132 | "flush": false, 133 | "shower": false, 134 | "pets": true, 135 | "water": true, 136 | "description": "Vault toilet", 137 | "title": "Union Creek", 138 | "url": "https://www.fs.usda.gov/recarea/rogue-siskiyou/recarea/?recid=69922", 139 | "image": "unioncreek.jpg", 140 | "marker-size": "small" 141 | } 142 | }, { 143 | "type": "Feature", 144 | "geometry": { 145 | "type": "Point", 146 | "coordinates": [-122.4353305556, 42.9162388889] 147 | }, 148 | "properties": { 149 | "flush": false, 150 | "shower": false, 151 | "pets": false, 152 | "water": true, 153 | "description": "", 154 | "title": "Farewell Bend Campground", 155 | "url": "https://www.fs.usda.gov/recarea/rogue-siskiyou/null/recarea/?recid=69720&actid=29", 156 | "image": "farewellbend.jpg", 157 | "marker-size": "small" 158 | } 159 | }] 160 | 161 | set_state(get_campgrounds(features)) 162 | 163 | function set_state(campgrounds) { 164 | let today = moment() 165 | console.log(today) 166 | 167 | store.dispatch ({ 168 | type: 'SET_STATE', 169 | state: { 170 | filters: [ 171 | {id: 'shower', inuse: false }, 172 | {id: 'pets', inuse: false }, 173 | {id: 'flush', inuse: false }, 174 | {id: 'water', inuse: false } 175 | ], 176 | markers: campgrounds, 177 | gmapMarkers: [], 178 | showingInfoWindow: false, 179 | activeMarker: null, 180 | selectedTitle: "", 181 | currentDate: today, 182 | weatherSummary: "", 183 | currentLat: 42.9456, 184 | currentLong: -122.2, 185 | selectedDate: undefined 186 | } 187 | }) 188 | } 189 | 190 | ReactDOM.render( 191 | 192 | 193 | , 194 | document.getElementById('root') 195 | ); 196 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/reducer.js: -------------------------------------------------------------------------------- 1 | import {Map} from 'immutable'; 2 | import axios from 'axios'; 3 | var moment = require('moment'); 4 | 5 | function getFilterIndex(state, itemId) { 6 | return state.get('filters').findIndex( 7 | (item) => item.get('id') === itemId 8 | ); 9 | } 10 | 11 | function getMarkerIndex(state, itemId) { 12 | return state.get('markers').findIndex( 13 | (item) => item.get('title') === itemId 14 | ); 15 | } 16 | 17 | function getFilters(state, filterIndex) { 18 | return state.get('filters') 19 | .get(filterIndex) 20 | .update('inuse', inuse => inuse === false ? true : false); 21 | } 22 | 23 | function updateMarker(state, markerIndex, mapOnVal) { 24 | return state.get('markers') 25 | .get(markerIndex) 26 | .update('mapOn', mapOn => mapOnVal); 27 | } 28 | 29 | function setState(state, newState) { 30 | return state.merge(newState); 31 | } 32 | 33 | function onMarkerClick(state, marker) { 34 | 35 | console.log('markerClick in reducer') 36 | return state.merge(Map({ 37 | 'activeMarker': marker, 38 | 'selectedTitle': marker.get('title'), 39 | 'showingInfoWindow': true 40 | })) 41 | } 42 | 43 | function addMarker(state, marker) { 44 | let markers = state.get('gmapMarkers') 45 | let newMarkers = markers.push(marker) 46 | return state.update('gmapMarkers', oldmarkers => newMarkers) 47 | } 48 | 49 | function changeFilter(state, filter) { 50 | let filterIndex = getFilterIndex(state,filter) 51 | const updatedFilter = getFilters(state, filterIndex) 52 | let updatedFilters = state.get('filters') 53 | updatedFilters = updatedFilters.set(filterIndex, updatedFilter) 54 | 55 | let active_filters = updatedFilters.filter( 56 | item => item.get('inuse') === true 57 | ) 58 | 59 | let markers = state.get('markers') 60 | let updatedMarkers = markers 61 | markers.forEach(marker => { 62 | let markerIndex = getMarkerIndex(state, marker.get('title')) 63 | let mapOn = true 64 | active_filters.forEach(item => { 65 | if (marker.get('properties').get(item.get('id')) !== true) { 66 | mapOn = false 67 | } 68 | }) 69 | const updatedMarker = updateMarker(state, markerIndex, mapOn) 70 | updatedMarkers = updatedMarkers.set(markerIndex, updatedMarker) 71 | }) 72 | 73 | return state.merge(Map({ 74 | 'filters': updatedFilters, 75 | 'markers': updatedMarkers 76 | })) 77 | } 78 | 79 | function recvWeather(state, weatherDate, result) { 80 | let content = "" 81 | try { 82 | let tempMax = result.daily.data[0].temperatureMax 83 | let tempMin = result.daily.data[0].temperatureMin 84 | let summary = result.daily.data[0].summary 85 | content = summary + " High: " + Math.ceil(tempMax) + " Low: " + Math.ceil(tempMin) 86 | } 87 | catch(err) { 88 | console.log("couldnt get weather summary: " + err) 89 | } 90 | 91 | return state.merge(Map({ 92 | 'weatherSummary': content 93 | })) 94 | 95 | } 96 | 97 | function reqWeather(state, weatherDate) { 98 | return state.merge(Map({ 99 | 'weatherSummary': "Loading...", 100 | 'selectedDate': moment(weatherDate) 101 | })) 102 | } 103 | 104 | export default function(state = Map(), action) { 105 | switch (action.type) { 106 | case 'SET_STATE': 107 | return setState(state, action.state); 108 | case 'CHANGE_FILTER': 109 | return changeFilter(state, action.filter); 110 | case 'MARKER_CLICK': 111 | return onMarkerClick(state, action.marker) 112 | case 'ADD_MARKER': 113 | return addMarker(state, action.marker) 114 | case 'RECV_WEATHER': 115 | return recvWeather(state, action.weatherDate, action.response) 116 | case 'REQ_WEATHER': 117 | return reqWeather(state, action.weatherDate) 118 | default: 119 | return state 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/utils/GoogleApi.js: -------------------------------------------------------------------------------- 1 | export const GoogleApi = function(opts) { 2 | opts = opts || {} 3 | 4 | const apiKey = opts.apiKey; 5 | const libraries = opts.libraries || []; 6 | const client = opts.client; 7 | const URL = 'https://maps.googleapis.com/maps/api/js'; 8 | 9 | const googleVersion = '3.22'; 10 | let script = null; 11 | let google = window.google = null; 12 | let loading = false; 13 | let channel = null; 14 | let language = null; 15 | let region = null; 16 | 17 | let onLoadEvents = []; 18 | 19 | const url = () => { 20 | let url = URL; 21 | let params = { 22 | key: apiKey, 23 | callback: 'CALLBACK_NAME', 24 | libraries: libraries.join(','), 25 | client: client, 26 | v: googleVersion, 27 | channel: channel, 28 | language: language, 29 | region: region 30 | } 31 | 32 | let paramStr = Object.keys(params) 33 | .filter(k => !!params[k]) 34 | .map(k => `${k}=${params[k]}`).join('&'); 35 | 36 | return `${url}?${paramStr}`; 37 | } 38 | 39 | return url(); 40 | } 41 | 42 | export default GoogleApi 43 | -------------------------------------------------------------------------------- /appendto/react_redux_camping_filters/src/utils/ScriptCache.js: -------------------------------------------------------------------------------- 1 | let counter = 0; 2 | let scriptMap = new Map(); 3 | 4 | export const ScriptCache = (function(global) { 5 | return function ScriptCache (scripts) { 6 | const Cache = {} 7 | 8 | Cache._onLoad = function (key) { 9 | return (cb) => { 10 | let stored = scriptMap.get(key); 11 | if (stored) { 12 | stored.promise.then(() => { 13 | stored.error ? cb(stored.error) : cb(null, stored) 14 | }) 15 | } else { 16 | // TODO: 17 | } 18 | } 19 | } 20 | 21 | Cache._scriptTag = (key, src) => { 22 | if (!scriptMap.has(key)) { 23 | let tag = document.createElement('script'); 24 | let promise = new Promise((resolve, reject) => { 25 | let resolved = false, 26 | errored = false, 27 | body = document.getElementsByTagName('body')[0]; 28 | 29 | tag.type = 'text/javascript'; 30 | tag.async = false; // Load in order 31 | 32 | const cbName = `loaderCB${counter++}${Date.now()}`; 33 | let cb; 34 | 35 | let handleResult = (state) => { 36 | return (evt) => { 37 | let stored = scriptMap.get(key); 38 | if (state === 'loaded') { 39 | stored.resolved = true; 40 | resolve(src); 41 | // stored.handlers.forEach(h => h.call(null, stored)) 42 | // stored.handlers = [] 43 | } else if (state === 'error') { 44 | stored.errored = true; 45 | // stored.handlers.forEach(h => h.call(null, stored)) 46 | // stored.handlers = []; 47 | reject(evt) 48 | } 49 | 50 | cleanup(); 51 | } 52 | } 53 | 54 | const cleanup = () => { 55 | if (global[cbName] && typeof global[cbName] === 'function') { 56 | global[cbName] = null; 57 | } 58 | } 59 | 60 | tag.onload = handleResult('loaded'); 61 | tag.onerror = handleResult('error') 62 | tag.onreadystatechange = () => { 63 | handleResult(tag.readyState) 64 | } 65 | 66 | // Pick off callback, if there is one 67 | if (src.match(/callback=CALLBACK_NAME/)) { 68 | src = src.replace(/(callback=)[^\&]+/, `$1${cbName}`) 69 | cb = window[cbName] = tag.onload; 70 | } else { 71 | tag.addEventListener('load', tag.onload) 72 | } 73 | tag.addEventListener('error', tag.onerror); 74 | 75 | tag.src = src; 76 | body.appendChild(tag); 77 | return tag; 78 | }); 79 | let initialState = { 80 | loaded: false, 81 | error: false, 82 | promise: promise, 83 | tag 84 | } 85 | scriptMap.set(key, initialState); 86 | } 87 | return scriptMap.get(key); 88 | } 89 | 90 | Object.keys(scripts).forEach(function(key) { 91 | const script = scripts[key]; 92 | Cache[key] = { 93 | tag: Cache._scriptTag(key, script), 94 | onLoad: Cache._onLoad(key) 95 | } 96 | }) 97 | 98 | return Cache; 99 | } 100 | })(window) 101 | 102 | export default ScriptCache; 103 | -------------------------------------------------------------------------------- /distance_calc/Untitled.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 9, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import pandas as pd\n", 12 | "import numpy as np" 13 | ] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": 2, 18 | "metadata": { 19 | "collapsed": true 20 | }, 21 | "outputs": [], 22 | "source": [ 23 | "df = pd.read_csv('cl.csv')" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 3, 29 | "metadata": { 30 | "collapsed": false 31 | }, 32 | "outputs": [ 33 | { 34 | "data": { 35 | "text/plain": [ 36 | "(69, 8)" 37 | ] 38 | }, 39 | "execution_count": 3, 40 | "metadata": {}, 41 | "output_type": "execute_result" 42 | } 43 | ], 44 | "source": [ 45 | "df.shape" 46 | ] 47 | }, 48 | { 49 | "cell_type": "code", 50 | "execution_count": 4, 51 | "metadata": { 52 | "collapsed": false 53 | }, 54 | "outputs": [ 55 | { 56 | "data": { 57 | "text/plain": [ 58 | "Index(['facilityname', 'facilitylatitude', 'facilitylongitude',\n", 59 | " 'sites_available', 'cg_fcfs', 'cg_flush', 'cg_shower', 'cg_vault'],\n", 60 | " dtype='object')" 61 | ] 62 | }, 63 | "execution_count": 4, 64 | "metadata": {}, 65 | "output_type": "execute_result" 66 | } 67 | ], 68 | "source": [ 69 | "df.columns" 70 | ] 71 | }, 72 | { 73 | "cell_type": "code", 74 | "execution_count": 12, 75 | "metadata": { 76 | "collapsed": false 77 | }, 78 | "outputs": [], 79 | "source": [ 80 | "df_clean = df.replace('\\\\N', np.nan)" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": 16, 86 | "metadata": { 87 | "collapsed": false 88 | }, 89 | "outputs": [ 90 | { 91 | "data": { 92 | "text/html": [ 93 | "
\n", 94 | "\n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | " \n", 120 | " \n", 121 | " \n", 122 | " \n", 123 | " \n", 124 | " \n", 125 | " \n", 126 | " \n", 127 | " \n", 128 | " \n", 129 | " \n", 130 | " \n", 131 | " \n", 132 | " \n", 133 | " \n", 134 | " \n", 135 | " \n", 136 | " \n", 137 | " \n", 138 | " \n", 139 | "
facilitynamefacilitylatitudefacilitylongitudesites_availablecg_fcfscg_flushcg_shower
cg_vault
0131313131342
138383812421
\n", 140 | "
" 141 | ], 142 | "text/plain": [ 143 | " facilityname facilitylatitude facilitylongitude sites_available \\\n", 144 | "cg_vault \n", 145 | "0 13 13 13 13 \n", 146 | "1 38 38 38 1 \n", 147 | "\n", 148 | " cg_fcfs cg_flush cg_shower \n", 149 | "cg_vault \n", 150 | "0 13 4 2 \n", 151 | "1 24 2 1 " 152 | ] 153 | }, 154 | "execution_count": 16, 155 | "metadata": {}, 156 | "output_type": "execute_result" 157 | } 158 | ], 159 | "source": [ 160 | "df_clean.groupby('cg_vault').count()" 161 | ] 162 | }, 163 | { 164 | "cell_type": "code", 165 | "execution_count": null, 166 | "metadata": { 167 | "collapsed": true 168 | }, 169 | "outputs": [], 170 | "source": [] 171 | } 172 | ], 173 | "metadata": { 174 | "kernelspec": { 175 | "display_name": "Python 3", 176 | "language": "python", 177 | "name": "python3" 178 | }, 179 | "language_info": { 180 | "codemirror_mode": { 181 | "name": "ipython", 182 | "version": 3 183 | }, 184 | "file_extension": ".py", 185 | "mimetype": "text/x-python", 186 | "name": "python", 187 | "nbconvert_exporter": "python", 188 | "pygments_lexer": "ipython3", 189 | "version": "3.4.3" 190 | } 191 | }, 192 | "nbformat": 4, 193 | "nbformat_minor": 0 194 | } 195 | -------------------------------------------------------------------------------- /distance_calc/__pycache__/config.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/distance_calc/__pycache__/config.cpython-34.pyc -------------------------------------------------------------------------------- /distance_calc/cl3.csv: -------------------------------------------------------------------------------- 1 | facilityname,facilitylatitude,facilitylongitude,sites_available,firstcome,flush,shower,vault 2 | Dead Soldier Camp,42.824181,-122.349985,\N,\N,\N,\N,\N 3 | Mazama,42.865508,-122.166149,\N,\N,1,1,\N 4 | Claude Lewis Sno-Park-USFS,43.063217,-122.342876,\N,\N,\N,\N,1 5 | Lost Creek,42.879145,-122.037881,\N,1,1,\N,\N 6 | Hamaker,43.056641,-122.330322,\N,\N,\N,\N,1 7 | Huckleberry Mountain,42.877807000000004,-122.337174,\N,\N,\N,\N,1 8 | Natural Bridge -USFS,42.889648,-122.463867,\N,1,\N,\N,1 9 | Farewell Bend,42.919678000000005,-122.433105,\N,\N,\N,\N,\N 10 | Scott Creek,42.884588,-121.92477199999999,\N,1,\N,\N,1 11 | Thousand Springs Sno-Park-USFS,42.913045000000004,-122.32464399999999,\N,\N,\N,\N,1 12 | Union Creek,42.910277777800005,-122.45,0,0,\N,\N,1 13 | Farewell Bend Campground,42.9162388889,-122.43533055555599,0,0,\N,\N,0 14 | -------------------------------------------------------------------------------- /distance_calc/distance box.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "A module for calculating the bounding box around a given origin and radius" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 34, 13 | "metadata": { 14 | "collapsed": false 15 | }, 16 | "outputs": [], 17 | "source": [ 18 | "import math\n" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": 45, 24 | "metadata": { 25 | "collapsed": true 26 | }, 27 | "outputs": [], 28 | "source": [ 29 | "origin = (42.9446,-122.1090)\n", 30 | "radius = 10 # miles" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 46, 36 | "metadata": { 37 | "collapsed": false 38 | }, 39 | "outputs": [], 40 | "source": [ 41 | "latitude = origin[0]\n", 42 | "longitude = origin[1]" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 47, 48 | "metadata": { 49 | "collapsed": false 50 | }, 51 | "outputs": [], 52 | "source": [ 53 | "lat_plus = latitude + radius/69 #69 miles / 1deg latitude\n", 54 | "lat_minus = latitude - radius/69\n", 55 | "long_plus = longitude + radius/(69.17 * math.cos(lat_plus))\n", 56 | "long_minus = longitude - radius/(69.17 * math.cos(lat_minus))" 57 | ] 58 | }, 59 | { 60 | "cell_type": "markdown", 61 | "metadata": {}, 62 | "source": [ 63 | "Depending on your origin point, you may need to check which longitude value is lower for creating the SQL query; the BETWEEN directive expects \"a between b and c\", where b < c" 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": 48, 69 | "metadata": { 70 | "collapsed": false 71 | }, 72 | "outputs": [ 73 | { 74 | "data": { 75 | "text/plain": [ 76 | "[43.089527536231884,\n", 77 | " 42.79967246376812,\n", 78 | " -121.87851831918479,\n", 79 | " -122.49096195780027]" 80 | ] 81 | }, 82 | "execution_count": 48, 83 | "metadata": {}, 84 | "output_type": "execute_result" 85 | } 86 | ], 87 | "source": [ 88 | "[lat_plus, lat_minus, long_plus, long_minus]" 89 | ] 90 | }, 91 | { 92 | "cell_type": "markdown", 93 | "metadata": {}, 94 | "source": [ 95 | "Create a query based on the lat/long boundaries. " 96 | ] 97 | }, 98 | { 99 | "cell_type": "code", 100 | "execution_count": 49, 101 | "metadata": { 102 | "collapsed": false 103 | }, 104 | "outputs": [], 105 | "source": [ 106 | "query = \"select facilityname, facilitylatitude, facilitylongitude, sites_available, cg_fcfs, cg_flush, cg_shower, cg_vault \\\n", 107 | "from daily \\\n", 108 | "where facilitylatitude between \" + str(lat_minus) + \" and \" + str(lat_plus) + \" and \\\n", 109 | "facilitylongitude between \" + str(long_minus) + \" and \" + str(long_plus) + \";\"" 110 | ] 111 | }, 112 | { 113 | "cell_type": "code", 114 | "execution_count": 50, 115 | "metadata": { 116 | "collapsed": false 117 | }, 118 | "outputs": [ 119 | { 120 | "data": { 121 | "text/plain": [ 122 | "'select facilityname, facilitylatitude, facilitylongitude, sites_available, cg_fcfs, cg_flush, cg_shower, cg_vault from daily where facilitylatitude between 42.79967246376812 and 43.089527536231884 and facilitylongitude between -122.49096195780027 and -121.87851831918479;'" 123 | ] 124 | }, 125 | "execution_count": 50, 126 | "metadata": {}, 127 | "output_type": "execute_result" 128 | } 129 | ], 130 | "source": [ 131 | "query" 132 | ] 133 | }, 134 | { 135 | "cell_type": "code", 136 | "execution_count": null, 137 | "metadata": { 138 | "collapsed": true 139 | }, 140 | "outputs": [], 141 | "source": [] 142 | } 143 | ], 144 | "metadata": { 145 | "kernelspec": { 146 | "display_name": "Python 3", 147 | "language": "python", 148 | "name": "python3" 149 | }, 150 | "language_info": { 151 | "codemirror_mode": { 152 | "name": "ipython", 153 | "version": 3 154 | }, 155 | "file_extension": ".py", 156 | "mimetype": "text/x-python", 157 | "name": "python", 158 | "nbconvert_exporter": "python", 159 | "pygments_lexer": "ipython3", 160 | "version": "3.4.3" 161 | } 162 | }, 163 | "nbformat": 4, 164 | "nbformat_minor": 0 165 | } 166 | -------------------------------------------------------------------------------- /distance_calc/distance.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": false 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "from vincenty import vincenty" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "metadata": {}, 17 | "source": [ 18 | "Create some lat long points. We'll set the origin at Portland, OR and create a list of campgrounds to check the distance to" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": null, 24 | "metadata": { 25 | "collapsed": true 26 | }, 27 | "outputs": [], 28 | "source": [ 29 | "portland = (45.5231, -122.6765)\n", 30 | "\n", 31 | "lost_lake_campground = (45.50080,-121.81641)\n", 32 | "cultus_creek_campground = (46.0476, -121.7546)\n", 33 | "cape_lookout = (45.3558, -123.9715)\n", 34 | "\n", 35 | "campgrounds = [lost_lake_campground, cultus_creek_campground, cape_lookout]" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "Try out the vincenty calculation to get the distance between Portland and Lost Lake Campground" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 11, 48 | "metadata": { 49 | "collapsed": false 50 | }, 51 | "outputs": [ 52 | { 53 | "data": { 54 | "text/plain": [ 55 | "41.789753" 56 | ] 57 | }, 58 | "execution_count": 11, 59 | "metadata": {}, 60 | "output_type": "execute_result" 61 | } 62 | ], 63 | "source": [ 64 | "vincenty(portland, lost_lake_campground, miles=True)" 65 | ] 66 | }, 67 | { 68 | "cell_type": "markdown", 69 | "metadata": {}, 70 | "source": [ 71 | "Or if you prefer kilometers" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": 12, 77 | "metadata": { 78 | "collapsed": false 79 | }, 80 | "outputs": [ 81 | { 82 | "data": { 83 | "text/plain": [ 84 | "67.254108" 85 | ] 86 | }, 87 | "execution_count": 12, 88 | "metadata": {}, 89 | "output_type": "execute_result" 90 | } 91 | ], 92 | "source": [ 93 | "vincenty(portland, lost_lake_campground)" 94 | ] 95 | }, 96 | { 97 | "cell_type": "markdown", 98 | "metadata": {}, 99 | "source": [ 100 | "Create a custom method we can use in the map() function to calculate distances to a list of points" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": 14, 106 | "metadata": { 107 | "collapsed": true 108 | }, 109 | "outputs": [], 110 | "source": [ 111 | "def vincenty_portland_miles(cg_point):\n", 112 | " return vincenty(portland, cg_point, miles=True)" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 16, 118 | "metadata": { 119 | "collapsed": false 120 | }, 121 | "outputs": [ 122 | { 123 | "data": { 124 | "text/plain": [ 125 | "[41.789753, 57.414194, 64.009816]" 126 | ] 127 | }, 128 | "execution_count": 16, 129 | "metadata": {}, 130 | "output_type": "execute_result" 131 | } 132 | ], 133 | "source": [ 134 | "list(map(vincenty_portland_miles, campgrounds))" 135 | ] 136 | }, 137 | { 138 | "cell_type": "code", 139 | "execution_count": null, 140 | "metadata": { 141 | "collapsed": true 142 | }, 143 | "outputs": [], 144 | "source": [] 145 | } 146 | ], 147 | "metadata": { 148 | "kernelspec": { 149 | "display_name": "Python 3", 150 | "language": "python", 151 | "name": "python3" 152 | }, 153 | "language_info": { 154 | "codemirror_mode": { 155 | "name": "ipython", 156 | "version": 3 157 | }, 158 | "file_extension": ".py", 159 | "mimetype": "text/x-python", 160 | "name": "python", 161 | "nbconvert_exporter": "python", 162 | "pygments_lexer": "ipython3", 163 | "version": "3.4.3" 164 | } 165 | }, 166 | "nbformat": 4, 167 | "nbformat_minor": 0 168 | } 169 | -------------------------------------------------------------------------------- /odsc/intro_oods/.gitignore: -------------------------------------------------------------------------------- 1 | config.py 2 | __pycache__/* 3 | .ipynb_checkpoints/* 4 | -------------------------------------------------------------------------------- /odsc/intro_oods/__pycache__/config.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/odsc/intro_oods/__pycache__/config.cpython-34.pyc -------------------------------------------------------------------------------- /odsc/intro_oods/pdsg_meetup_nov_2016.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gizm00/blog_code/0adc0b7e874dd302a17da596fbac79367c5a3433/odsc/intro_oods/pdsg_meetup_nov_2016.pdf --------------------------------------------------------------------------------