Giter Club home page Giter Club logo

pygis's Introduction

PyGIS - Open Source Spatial Programming & Remote Sensing

The globe is now digital. Everything from monitoring deforestation, predicting wildfires, to training autonomous vehicles and tracking uprisings on social media requires you to understand how to leverage location data. This class will introduce you to the methods required for spatial programming. We focus on building your core programming techniques while helping you: leverage spatial data from OSM and the US Census, use satellite imagery, track land-use change, and track social distance during a pandemic, amongst others. We will leverage open source Python packages such as GeoPandas, Rasterio, Sklearn, and Geowombat to better understand our world and help predict its future. Some Python programming experience is required, however the material will be presented in a student-friendly manner and will focus on real-world application.

Under Development - Please Contribute See the current book here

Usage

Building the book

If you'd like to develop on and build the PyGIS - Open Source Spatial Programming & Remote Sensing book, you should:

  • Clone this repository and run
  • Run pip install -r requirements.txt (it is recommended you do this within a virtual environment)
  • Navigate to ./pyGIS/
  • (Recommended) Remove the existing /pyGIS/pygis/_build/ directory
  • Run jupyter-book build pygis

A fully-rendered HTML version of the book will be built in /pyGIS/pygis/_build/html/index.html .

Contributors

We welcome and recognize all contributions. You can see a list of current contributors in the contributors tab.

Credits

This project is created using the excellent open source Jupyter Book project and the executablebooks/cookiecutter-jupyter-book template.

Reference & Citation

Michael Mann, Steven Chao, Christophe Van Neste, Roger Lew, & Mark Isken. (2023). mmann1123/pyGIS: Clearer Satellites (v1.2.1). Zenodo. https://doi.org/10.5281/zenodo.8215141

DOI

pygis's People

Contributors

beukueb avatar misken avatar mmann1123 avatar rogerlew avatar schao333 avatar unclearcoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pygis's Issues

Issue on page /docs/d_access_census.html

I am having a problem using "c.acs5.state_county_tract()." I have not had issues using this previously, but just recently I cannot run it. I keep getting this error: "KeyError: 'long'". Is this an issue for other users?

Issue on page /docs/f_rs_band_math.html

I'd recommend subbing out "Learn" in the first learning objective. How basic are these principles? What's the learner's math background, do you think?

Would it be beneficial for the learner to cover the basic principles of band math earlier in the text? Or maybe this learning content needs to be contextualized as a continuation of the prior section and maybe include some more detail in section four on band math. It's not my wheelhouse, but I did find this image (linked below) helpful albeit it may not map entirely to your application here.

bandmath
Band Math Primer

Maybe include more detail on each of the different types. Example resource. Consider including similar pre and post-processing image examples to show the difference or at least some point of visual reference to which the learner can compare their output.

Issue on page /docs/b_about_py.html

Would it be worth showing a code snippet upfront so students get a sense of what the syntax looks like? Maybe a nice example of what you can do with Python (something interactive, embeddable - perhaps from a Geog-adjacent field or something fun like The Zen of Python (poem) i.e., import this into an online Python compiler)?

It also looks like you're missing your suggested Python textbooks. "Popular textbooks on Python programming include [] and []."

Issue on page /docs/e_raster_rasterize.html

As i can see, if all_touched set is true then include any cell that geometry boundary intersects. But in Fig. 58 bottom square under circle is not included. Can you tell what am i misunderstanding?

Issue on page /docs/b_getting_started.html

Just a note to say I really like the Overview section here and this is effectively what I am getting at in terms of Module (level) Learning Objectives.

Re: Jupyter notebook. Have you used GW's Jupyter Hub?. I believe they have a GIS environment specifically for Geography. I also really like Google Colab. as you can leave comments much like a Google document. Another consideration would be whether or not you would want your students to use some kind of version control platform, like GitHub. The reason I bring up the latter two examples is that GitHub Classroom has a nice auto-grader feature that you might be able to leverage. Colab might make collaboration easier, too (not sure what the limitations might be re: external packages, though).

Issue on page /docs/c_features.html

Learning objectives could be rewritten as follows:

  1. Differentiate between raster and vector data.
  2. Create a dictionary data structure to form the basis of a GeoDataFrame.
  3. Identify data measurement level categories.

Consider calling out the data structures you're using and why. Link offsite to the Python docs for each. I'd also recommend some instructive text for each code snippet throughout the book (like you did in Section 0). For example, "Try copying and running this code snippet below to demonstrate...". You could also include comments in the code snippet itself so it will function as a standalone, self-explanatory vignette.

Figure 2 is the first figure as far as I can tell. It may need to be relabeled.

Issue on page /docs/e_extraction.html

Just a note from a learner's perspective:
The "Tip" introduces the idea of using a for loop without demonstrating how to do that. I understand that you might want to use a for loop to iterate over more than one piece of data but I have no idea how to implement that based on the example above.

It would be great to see how that would be implemented underneath the "Tip"!

Issue on page /docs/d_affine.html

Learning outcome suggestions:

  1. Utilize Affine transforms
  2. Differentiate between translate, rotate, skew, and shear transformations.

Issue on page /docs/d_raster_crs_intro.html

Learning objective suggestions:

  1. Describe how rasters are reprojected.
  2. Explain how affine transforms are used.
  3. Utilize rasterio to reproject a raster.
  4. Identify and apply interpolation options when using transforms.

Update figure numbering.

Issue on page /docs/e_attributes.html

Typo in the "Tip": *Because

Consider including a summary for each section in addition to what the learner should expect to learn in the next section and how it relates to what they just learned. Developing more of a narrative across the board would be great, I think.

Issue on page /docs/e_spatial_joins.html

Sub out "Understand" for other verbs in your learning objectives for this section.

I neglected to mention before that you should consider including alternative text for all of your figures for accessibility purposes so vision-impaired folks can use your online textbook with a screen reader. Additionally, for any figures that rely on color to communicate an important concept (say, differentiating between two variables in a visualization) you should consider using a colorblind-friendly profile.

Here are two good resources on that.

One
Two

...and here's a useful color/contrast tool made available by Adobe.

Issue on page /docs/e_vector_merge_dissolve.html

Learning objectives are great. A nice amount of details. Concise!

Again, I think Steven's contributions have the right amount of detail. The introduction provides a good set-up (although an introduction to how data frames are used should come much earlier since you're using them earlier, right?) and there's sufficient instructional text throughout to get through the code examples.

Issue on page /docs/e_new_rasters.html

Revise learning objectives to read:

  • Create raster data with Rasterio.

Delete the duplicate objective and include one more module-level learning objective.

Suggestion: embed an image the result of show(arr) in the rasterio code example.

Write conclusion summarizing book

Consider writing some form of conclusion to the book that outlines what the learner will have achieved by the end of the text, particularly after completing the coding exercises, and include resources for continuing to learn beyond the scope of your text.

Issue on page /docs/d_understand_crs_codes.html

Learn objective suggestions:

  1. Read and apply a PROJ.4.
  2. Obtain EPSG code from a PROJ.4.
  3. Create a custom CRS using PROJ.4.
  4. Modify PROJ.4 string parameters.

Re: By: Steven Chao. Might be nice to link to the personal website(s; if available) for each of your contributors.

Consider giving a PROJ.4. string example with the definition. For example (from their docs): A proj-strings holds the parameters of a given coordinate transformation, e.g. +proj=merc +lat_ts=56.5 +ellps=GRS80.

I really like the way this section is laid out and it has a lot of the instructional text that I think is missing in the previous sections. There's a nice setup for each code snippet. I am able to read and apply what's there while understanding why I would want to do it. I think you ought to adopt the same approach/level of detail across the whole text.

Issue on page /docs/c_new_vectors.html

I like the objectives! CSV should probably be uppercase and I'd recommend spelling out latitude and longitude at least one time before abbreviating each word. Or highlight the fact this is GeoSpat / Pythonic language. Otherwise, it might be confusing to some learners.

Issue on page /docs/e_vector_overlay.html

This is a really nice section. The images are really great at illustrating the Union, Join, concepts. Learning objectives look fine to me (but I'd sub out "understand the difference" for something like "differentiate between the two.")

Just a reminder to update your figure numbering throughout.

Issue on page /docs/b_python_by_example.html

You mention data structures: will students need a refresher on what a data structure actually is? In Python, you're usually talking about data frames but data structures is a broad topic in CS and can mean a whole host of different things, so I'd recommend that you include at least one resource that presents data structures as they relate to your course so the students know what you mean, what they look like, why they matter and how they'll be used. Especially since their prior Python experience may not have included exposure to data structures (although most generally do).

I'd also recommend that you move the comment on indentation to the Getting Started With Python section. What Python looks like and how it operates should probably be clear before students start to work with your code examples.

Issue on page /docs/a_intro.html

Hi Michael,
I've updated our GW shared google drive to include a complete set of remarks and comments for your review from our summer 2023 collaboration. Please let me know as you have questions or interest in clarifications.
-Ann

Issue on page /docs/b_learn_more.html

The sentence "We’re about ready to wrap up this brief course on Python for scientific computing." is confusing since this is the first of seven sections. Consider rephrasing.

Issue on page /docs/c_store_features.html

Learning objective could be:

  1. Categorize data file formats.

I recommend including some instructive text for each of the code snippets and renumbering and labeling all of your figures.

You could also include a summary for each book section to say back to the learner what they should have learned and explicitly call out what they should now be able to do.

Have you considered a "Learn More" for each section? I really liked the inclusion of that for Section 0.

Issue on page /docs/e_raster_reproject.html

Do any of these resampling/interpolation methods need to be explained in more detail?

[‘average’, ‘bilinear’, ‘cubic’, ‘cubic_spline’, ‘gauss’, ‘lanczos’, ‘max’, ‘med’, ‘min’, ‘mode’, ‘nearest’].

For example, will students know the difference between cubic and cubic_spline? Maybe include a resource like this.

Provide more context for the figure (what is it? why does it matter?) and adjust the figure numbering.

Creating DOI for citation

Thanks for making this - it's a very cool resource! I've particularly found some of the hand-drawn illustrations to be really useful.

I was wondering whether you had considered producing a DOI for this (e.g. through Zenodo) to make it easy to cite the book? I had a very quick look and couldn't see anything how to cite it.

Issue on page /docs/e_raster_resample.html

The second learning objective doesn't make sense (to me, at least) and reads somewhat incomplete. What is meant by "match the extent"?

Suggestion: provide a definition of resampling as it pertains to rasters before getting into why it is crucial. Maybe include a few external resources on up and downsampling and how these methods relate to certain scenarios (e.g., downsampling to get rid of redundant records; upsampling to improve model performance).

Issue on page /docs/b_getting_started.html

Just a note to say I really like the Overview section here and this is effectively what I am getting at in terms of Module (level) Learning Objectives.

Re: Jupyter notebook. Have you used GW's Jupyter Hub?. I believe they have a GIS environment specifically for Geography. I also really like Google Colab. as you can leave comments much like a Google document. Another consideration would be whether or not you would want your students to use some kind of version control platform, like GitHub. The reason I bring up the latter two examples is that GitHub Classroom has a nice auto-grader feature that you might be able to leverage. Colab might make collaboration easier, too (not sure what the limitations might be re: external packages, though).

Issue on page /docs/e_raster_math.html

Learning objective suggestions:

  1. Perform mathematical operations on raster bands using rasterio.
  2. Identify the requirements for successful mathematical operations.

Do the learners need a primer on band math?

Issue on page /docs/e_raster_rasterize.html

Sub out "understand" for another action verb for your second learning objective. Have it speak to something actionable/measurable in the body of the text, e.g., running, or modifying code or identifying ideal specifications for some kind of output. Tie the objectives to what you're asking them to do.

Could you do an example of meteo interpolation using external drift like a DEM?

This is the code I am trying to use but is giving me problem for memory allocation
def geodataframe_to_kriging_raster(geodataframe, column_name, pixel_size, area_bounds_gdf, variogram_model="linear"):

# Check if the two GeoDataFrames have the same coordinate reference system (CRS)
if geodataframe.crs != area_bounds_gdf.crs:
    # If the CRS is different, change the CRS of one of the GeoDataFrames to match the other
    area_bounds_gdf = area_bounds_gdf.to_crs(geodataframe.crs)
    print('Coordinate reference system modified')

# Calculate the extent of the GeoDataFrame
file_bounds = box(*area_bounds_gdf.bounds)

# Determine the size of the raster based on the extent of the GeoDataFrame
min_x, min_y, max_x, max_y = file_bounds.bounds
width = int((max_x - min_x) / pixel_size)
height = int((max_y - min_y) / pixel_size)

# Calculate the transformation parameters for the raster
transform = from_origin(min_x, max_y, pixel_size, pixel_size)

# Prepare input data
x = df_hourly['lon'].values
y = df_hourly['lat'].values
z = df_hourly[column_name].values

# Load the DEM (Digital Elevation Model) file
dem_values = dem.read(1)  # Assume that DEM data is in the first channel
# Extract x and y coordinates of the DEM
dem_x, dem_y = dem.bounds.left, dem.bounds.top

# Perform Universal Kriging with specific drift based on DEM
h = dem_values
uk = UniversalKriging(
    x,
    y,
    z,
    variogram_model=variogram_model,
    drift_terms=["external_Z", "specified_drift"],
    external_drift=dem_values,
    external_drift_x=dem_x,
    external_drift_y=dem_y,
    specified_drift=geodataframe['h_sea'],
)
z, _ = uk.execute("grid", np.linspace(min_x, max_x, width), np.linspace(max_y, min_y, height))

return z, transform

Issue on page /docs/b_intro_py.html

You could write a bit about how you use Python in your own research to foster a bit of student buy-in from the outset of the text. Or roll this section into the next section as it is otherwise pretty light on content.

Issue on page /docs/f_rs_io.html

Learning objective suggestions:

  1. Open multiple common remotely sensed image types.
  2. Handle RGB, BGR, LandSat, PlanetScope images, and other sensor types.
  3. Mosaic multiple remotely sensed images.
  4. Create a time series stack.
  5. Write files to disk.

Issue on page /docs/f_rs_config.html

Sub out "understand" in the third learning objective.

Another (debatable) accessibility point for your consideration. You could have your hyperlinked text in your book open in a new window as opposed to updating the current window so learners aren't having to hit the back button to get back to your site. There are varying opinions on this but it's worth considering whether or not you want someone to have your site up 100% of the time when reading other linked/external resources.

Issue on page /docs/c_features.html

I recommend that you relabel the Review section to "Spatial Data" as opposed to "Data Structures" or include more detail about data structures in the former incl., the definition in this section. In fact, it might make more sense to move your Data Structure definition here into the Spatial Data section. It seems a bit odd to define these in a subsequent section after the initial example was given two sections ago.

I recommend that you provide more context around your examples, including why you're showing them naturalearth_lowres, etc.

Issue on page /docs/e_buffer_neighbors.html

Learning objective suggestions:

  1. Conduct distance/proximity-based analysis for points, lines, polygons
  2. Create buffers
  3. Compute nearest neighbors

Typo in "Important": *unprojected. I'd also rephrase the advantage of Cartesian versus polar systems and why Cartesian is superior in your use case. Is it because the units are more granular, scalable, and easier to work with?

Conceptually, it would be great to have more context about what a buffer actually is and how it operates before getting to any code. I'm not entirely clear on that. To me, a buffer is somewhere to store something (like an array) but this may be related to the Pythonic Buffer Protocol..

A graphical illustration of Nearest Neighbor may also be really helpful here. Maybe something simple like this?
knn_concept

Issue on page /docs/d_crs_what_is_it.html

Learning objective suggestions (I'd roll the first two into one):

  1. Identify the properties of a Coordinate Reference System (CRS).
  2. Differentiate between projected and geographic coordinate reference systems.
  3. Identify the impact of a CRS on shape, area, and distance.

Other bits of feedback:

  • I recommend that you update the title to "What is a Coordinate Reference System (CRS)?"
  • Update figure numbering as needed (as per prior section updates).
  • Expand the code snippet under Geographic Coordinate Systems as it's easy to miss and include some instructional text on what it actually does and why it matters.

Issue on page /docs/b_getting_started.html

Just a note to say I really like the Overview section here and this is effectively what I am getting at in terms of Module (level) Learning Objectives.

Re: Jupyter notebook. Have you used GW's Jupyter Hub?. I believe they have a GIS environment specifically for Geography. I also really like Google Colab. as you can leave comments much like a Google document. Another consideration would be whether or not you would want your students to use some kind of version control platform, like GitHub. The reason I bring up the latter two examples is that GitHub Classroom has a nice auto-grader feature that you might be able to leverage. Colab might make collaboration and sharing easier, too (not sure what the limitations might be re: external packages, though).

Issue on page /docs/d_vector_crs_intro.html

Learning objective suggestions:

  1. Assign a projection to vector data.
  2. Reproject vector data.

Update figure numbering.
"The following demonstrates how to" reads like an incomplete sentence.

Issue on page /docs/b_intro_py.html

You could frame your "few basic questions" as Module Learning Objectives that speak to the overarching course-level learning objectives in your syllabus (e.g., one could be as simple as "Utilize and extend the programming language, Python"). This helps to connect what you want learners to do with the overall goals of the course and helps to align the learning materials more broadly, which tends to be pretty critical in self-directed asynchronous learning settings. I'd be happy to meet to discuss further and help you draft these in addition to a redraft of your course learning objectives.

You could write a bit about how you use Python in your own research to foster a bit of student buy-in from the outset of the text. Or roll this section into the next section as it is otherwise pretty light on content.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.