-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add ArcGIS API for Python Geometry Support to Weight Objects #331
base: main
Are you sure you want to change the base?
Conversation
…try objects. - Point Geometry already works :)
I cannot add a person to review or assign labels. |
Thanks for this! I don't actually think I can evaluate this without Arc, and I have no platforms that can run it currently, but this looks pretty straightforward to review just from the stated APIs. I hope other reviewers can evaluate this with the |
Codecov Report
@@ Coverage Diff @@
## master #331 +/- ##
==========================================
- Coverage 81.22% 81.11% -0.12%
==========================================
Files 115 115
Lines 11678 11684 +6
==========================================
- Hits 9485 9477 -8
- Misses 2193 2207 +14
Continue to review full report at Codecov.
|
Super simple sample import pandas as pd
import arcgis
pts = pd.DataFrame.spatial.from_featureclass(r"c:\gis\sample_data\Alaska Data\Trans_AirportPoint.shp")
knn_w = KNN.from_dataframe(df=pts, geom_col='SHAPE') import pandas as pd
import arcgis
polygons = pd.DataFrame.spatial.from_featureclass(r"c:\gis\sample_data\ZipCodes.gdb\zipcodes")
geoms = polygons.SHAPE.values
rook = Rook(polygons=geoms)
queen = Queen(polygons=geoms) Hope this helps! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look straightforward and appear not to introduce any side effects.
The test suite would need to be expanded to cover these enhancements.
@achapkowski It does not appear that |
I also don't have access to |
@jGaboardi, yeah, if I recall correctly back when I was working w/ the pandas.DataFrame.spatial.from_featureclass doesn't exist without the On tests, it should be pretty straightforward to write a single file in the mould of: try:
import pandas as pd
import arcgis
HAS_ARCGIS=True
except ModuleNotFoundError:
HAS_ARCGIS=False
@unittest.skipif(not HAS_ARCGIS, "ArcGIS is not installed.")
def test_arcgis_w():
import pandas as pd
import arcgis
import geopandas
from libpysal.weights import KNN, Rook, Queen
from libpysal import examples
baltim = examples.get_path('baltim.shp')
columbus = examples.get_path('columbus.shp')
pts = pd.DataFrame.spatial.from_featureclass(baltim)
knnw = KNN.from_dataframe(df=pts, geom_col='SHAPE')
knnw_known = KNN.from_dataframe(geopandas.read_file(baltim))
assert (knnw.sparse != knnw_known.sparse).sum() == 0
polygons = pd.DataFrame.spatial.from_featureclass(columbus)
geoms = polygons.SHAPE.values
rook = Rook(polygons=geoms)
rook_known = Rook.from_dataframe(geopandas.read_file(columbus))
assert (rook.sparse != rook_known.sparse).sum() == 0
queen = Queen(polygons=geoms)
queen_known = Rook.from_dataframe(geopandas.read_file(columbus))
assert (queen.sparse != queen_known.sparse).sum() == 0 But, I'm not sure we can run this in CI without an Arc Enterprise license... we need a solution there. In abstract, I'd like this to land
|
@ljwolf you do not need any arc licenses to run the python package. You'll just need to have shapely installed to use as a geometry engine. |
Neat! very different than the last time I used this stuff. Using ArcGIS from |
I'm trying to revisit this issue, what is needed to merge this? |
@achapkowski PR needs to be updated from master to resolve conflicts and we should add tests (based on those @ljwolf posted above). |
adds support for ArcGIS API for Python's Polygon and Polyline Geometry objects.
Point Geometry already works :)
Hello! Please make sure to check all these boxes before submitting a Pull Request
(PR). Once you have checked the boxes, feel free to remove all text except the
justification in point 5.
nosetests
on your changes?pysal/master
branch.docstrings and
unittests?
reviewer and added relevant labels
_get_boundary_points
method without adding any new dependencies or dangerous code. Since the ArcGIS Python API allows for use of both shapely and/or arcpy as geometry engines this will allow users to leverage both OS and Esri technology next topysal