Comments (3)
@skykasko
How are you getting the JSON for the GeoAccessor? df1.spatial.json
?
The compare method uses a panda's merge method so if you are seeing difference in the panda's to_json then that would explain the fact that difference are found when merging.
I would do some data manipulation on the data and make sure they are rounded to the same decimal place. It seems the issue might arise to how the data is stored in Online vs the other source.
@achapkowski do you have any input?
from arcgis-python-api.
How are you getting the JSON for the GeoAccessor?
df1.spatial.json
?
df1[df1.spatial.name][0].JSON
. See the example above, where the expression df1[df1.spatial.name][0].JSON == df2[df2.spatial.name][0].JSON
evaluated to True
.
I would do some data manipulation on the data and make sure they are rounded to the same decimal place.
How would you recommend going about this? Calling df1.round(5)
has no effect on the shape column, and calling df1[df1.spatial.name].round(5)
raises the error AttributeError: 'GeoArray' object has no attribute 'round'
.
I suppose I could apply a custom function to the shape column that iterates over all the coordinate values and rounds them one by one. For my example above, the following works:
def round_shape(shape):
roundedPaths = []
for path in shape["paths"]:
roundedPaths.append([[round(coord, 5) for coord in point] for point in path])
return {"paths": roundedPaths, "spatialReference": shape["spatialReference"]}
df1[df1.spatial.name] = df1[df1.spatial.name].apply(round_shape)
# Manipulating the geometry column appears to make the DataFrame no longer
# recognized as Spatially Enabled, so the geometry column needs to be reassigned.
df1.spatial.set_geometry("SHAPE")
But this could be tricky to get right for every possible geometry type, and at that point using GeoAccessor.compare()
may be more complicated than writing a custom comparison function that uses GeoSeriesAccessor.equals()
to check for geometry differences and Pandas' built-in DataFrame.compare()
to check for other differences.
from arcgis-python-api.
@skykasko
Creating a custom round method is the way to go. Otherwise you can look into other libraries that have some methods such as almost_equals
in the Shapely library or if you have arcpy you can use the generalize operation or boundary.
https://stackoverflow.com/questions/63402333/how-does-almost-equals-function-of-shapely-treat-the-starting-point-and-errors
https://pro.arcgis.com/en/pro-app/latest/tool-reference/editing/generalize.htm
You can also post on the Esri Community forum to see if other users have come across this or have suggestions.
from arcgis-python-api.
Related Issues (20)
- Diacritics in an ArcGIS Survey 123 Form result in a failure during cloning
- WebMap object basemap_title() getter does not do as it says in the documentation for API version 2.2.0.1 HOT 1
- JSON Format Mismatch for NER data export from Doccano Editor vs. ArcGIS Format
- Issues with datetime imports; arcgis python API is overwriting the import causing a runtime exception HOT 1
- GeoSeriesAccessor.equals returns None in version 2.2 HOT 3
- edit_features does not set NaT dates to null in version 2.2 HOT 1
- edit_features sets all dates to the same value in version 2.2 HOT 5
- InsecureRequestWarning when initializing GIS with client_id and client_secret HOT 1
- Need help with Web Maps HOT 2
- Deep Learning essentials are failing to install in Google colab
- clone_items throws "IndexError: list index out of range" when there are nested repeats in the featureservice
- Overwriting Hosted Table in Online Capabilities HOT 4
- Append job gets stuck in pending state indefinitely HOT 2
- Python Bypasses User Credit Allotment in AGOL HOT 2
- Table query fails with "TypeError: Casting to unit-less dtype 'datetime64' is not supported. Pass e.g. 'datetime64[ns]' instead." HOT 6
- clone_items() with item_mapping parameter misses group layers in the web map HOT 1
- Item.share() is not working when the groups parameter is specified HOT 1
- generate_raster fails in local and ArcGIS Online notebooks HOT 3
- Installing into Azure Databricks. Could you document recommended arcgis & databricks runtime versions and prerequisites?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arcgis-python-api.