Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start geopandas extension #728

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Conversation

knaaptime
Copy link
Contributor

to begin review. The notebook at examples/explore should run through and demonstrate functionality. I need to take a look at how you prefer to test against Maps

@knaaptime
Copy link
Contributor Author

resolves #136

pyproject.toml Outdated Show resolved Hide resolved
Comment on lines 23 to 42
def explore(
self,
column=None,
cmap=None,
scheme=None,
k=6,
categorical=False,
elevation=None,
extruded=False,
elevation_scale=1,
alpha=1,
layer_kwargs=None,
map_kwargs=None,
classify_kwargs=None,
nan_color=[255, 255, 255, 255],
color=None,
wireframe=False,
tiles="CartoDB Darkmatter",
m=None,
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you expand on what differences (if any) there are with the upstream geopandas.explore method? I think we'd want it to be as similar as possible.

That would be great to include in this docstring.

Additionally, ideally there would be a way to get valid type hinting here, but presumably that won't work if this is added at runtime to the GeoDataFrame instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure happy to add both. In general I tried to keep all possible arguments the same (hence the tiles that uses a str --> class--> str, which isn't ideal but I'm hard conditioned to type tiles='CartoDB Positron') any time I explore.

the one thing I know is different is classification_kwargs used here vs classification_kwds used in geopandas, but I'll switch it to martin's version for compat. Otherwise, any arguments available in explore have the same name. Those that don't map between the two are unique to the backengs, e.g. layer_kwargs here vs style_kwds in vanilla explore

also I generally use numpy docstrings but I think the rest of the packages uses another format, so I should probably update that too

@martinfleis
Copy link

Keep me in the loop. Happy to do a proper review of this from the geopandas perspective once @kylebarron is happy.

lonboard/geopandas.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
lonboard/geopandas.py Outdated Show resolved Hide resolved
lonboard/geopandas.py Outdated Show resolved Hide resolved
@knaaptime
Copy link
Contributor Author

i think this should be ready, though I'm not the best with type hints or google docstrings

@kylebarron
Copy link
Member

Can you check why pre-commit is still failing? You should be able to run it locally with

pip install pre-commit
pre-commit run --all-files

@kylebarron
Copy link
Member

@martinfleis do you have any comments on this PR?

I'd like to get in #753, which in general raises the code quality of the code base, and then ensure that this PR meets that bar as well.

Copy link

@martinfleis martinfleis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few minor notes.

lonboard/geopandas.py Outdated Show resolved Hide resolved
lonboard/geopandas.py Outdated Show resolved Hide resolved
Comment on lines 56 to 58
elevation : Name of column on the dataframe used to extrude each geometry or
an array-like in the same order as observations. Defaults to None.
extruded : Whether to extrude geometries using the z-dimension.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably don't follow here. Shouldn't extruded be automatically True when elevation is provided? Like the two are tied together, no? Or can I use extruded without elevation? What does it extrude on, then, Z coordinate? How?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree this is a little awkward. There's probably no need for the bool, though I was just trying to follow the viz/Layer API which treats them separately. Happy to go with consensus here.

Another small wrinkle is that sometimes in GIS or CAD software (IIRC anyway) 'elevation' sometimes refers to the height beneath the polygon, e.g. so you can drop the extruded poly onto a DEM for things like viewsheds. In that case I want to say this parameter is called 'extrusion_height' or something? No real opinion here, just something to consider in case folks are coming from that world

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i removed the bool so that its turned on automatically if elevation is passed

lonboard/geopandas.py Outdated Show resolved Hide resolved
lonboard/geopandas.py Outdated Show resolved Hide resolved
@kylebarron
Copy link
Member

I merged #753; would you be able to merge in latest main?

@knaaptime
Copy link
Contributor Author

looks like the only remaining failures are from the demo notebook. Could probably fix many of them, but seems a little overkill to add type annotations to some quick functions in an example notebook

@knaaptime
Copy link
Contributor Author

fixed annotations in the notebook so im not sure what the lingering failure is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants