Comments (7)
The geometry is in the first column and the points do not appear explicitly but only says:
Geometry: wkbPoint
This is due to changes in ArchGDAL since the readme what written. The order of the columns has no meaning and the geometry is only a matter of the show
method I believe, not the actual content. Would be great if you could update the readme to what it looks like now though, since it would be less confusing.
The other questions is if I can use GeoDataFrames to merge a shapefile with a data frame when both
objects have a column in common. I want to preserve all the shapefile geometric structure.
See also my link to the DataFrames join method in JuliaGeo/Shapefile.jl#56 (comment). This package directly returns a DataFrame, so you can use this directly. The geometries will stay intact.
from geodataframes.jl.
Thank you very much Martin @visr !
Ok, I will try to update the README file. Should I use the git command for that?
Regarding the other problem, this is what I want to do (GDF=GeoDataFrames):
graph_file="input.shp"
state_data = GDF.read(graph_file)
assignment = DataFrame(CSV.File(assignment_file))
graph_data = outerjoin(state_data,assignment, on = "GEOID20")
graph = BaseGraph(graph_data, population_col)
But the code gives error when reading the input file:
LoadError: MethodError: Cannot convert
an object of type
ArchGDAL.IGeometry{wkbMultiPolygon} to an object of type
ArchGDAL.IGeometry{wkbPolygon}
Closest candidates are:
convert(::Type{var"#s404"} where var"#s404"<:ArchGDAL.AbstractGeometry, ::GeoFormatTypes.AbstractWellKnownText) at /home/mmestre/.julia/packages/ArchGDAL/erkjx/src/convert.jl:36
convert(::Type{var"#s404"} where var"#s404"<:ArchGDAL.AbstractGeometry, ::GeoFormatTypes.WellKnownBinary) at /home/mmestre/.julia/packages/ArchGDAL/erkjx/src/convert.jl:42
convert(::Type{var"#s404"} where var"#s404"<:ArchGDAL.AbstractGeometry, ::GeoFormatTypes.GeoJSON) at /home/mmestre/.julia/packages/ArchGDAL/erkjx/src/convert.jl:45
Do you have any clue of how to solve this problem ?
Best regards,
Martín
from geodataframes.jl.
Nice, thanks! You could use git, but for small changes I often find it more convenient to click the edit (pencil) button on github; https://github.com/evetion/GeoDataFrames.jl/edit/master/README.md.
Your issues actually looks like this one that came up recently on the ArchGDAL repository: yeesian/ArchGDAL.jl#223
Until that issue is fixed, perhaps you could save your data as GeoPackage and use that instead, since the issue is limited to shapefiles.
from geodataframes.jl.
Thanks @visr !
Could you tell me which changes should be done to the following lines in order to save data to GeoPackage (I do not know how and when should that be done):
graph_file="input.shp"
state_data = GDF.read(graph_file)
assignment = DataFrame(CSV.File(assignment_file))
graph_data = outerjoin(state_data,assignment, on = "GEOID20")
graph = BaseGraph(graph_data, population_col)
from geodataframes.jl.
I think this should work:
df = GDF.read("input.shp")
GDF.write("input.gpkg", df)
state_data = GDF.read("input.gpkg")
It's a good idea to put 3 backticks around your code to make it easier to read by the way. If you write julia after your first 3 backticks it will even apply syntax highlighting.
```julia
from geodataframes.jl.
Thanks @visr,
It seems the problem starts from the begining when reading the file
df = GDF.read("input.shp")
because it gives:
LoadError: MethodError: Cannot `convert` an object of type
ArchGDAL.IGeometry{wkbMultiPolygon} to an object of type
ArchGDAL.IGeometry{wkbPolygon}
Is there any solution for this?
I have tried to read directly with
state_data=ArchGDAL.read(graph_file)
It works ok for reading, but afterwards I cannot use the command:
graph_data = outerjoin(state_data,assignment, on = "GEOID20")
because it gives:
LoadError: MethodError: no method matching outerjoin(::ArchGDAL.IDataset, ::DataFrame; on="GEOID20")
Closest candidates are:
outerjoin(::AbstractDataFrame, ::AbstractDataFrame; on, makeunique, source, indicator, validate, renamecols, matchmissing) at /home/mmestre/.julia/packages/DataFrames/pVFzb/src/join/composer.jl:1026
outerjoin(::AbstractDataFrame, ::AbstractDataFrame, ::AbstractDataFrame...; on, makeunique, validate, matchmissin
Thank you very much,
Martín
from geodataframes.jl.
Ah sorry I missed that it failed on GDF.read
. Another way you can convert to a GeoPackage is using the GDAL command line tools, see for instance the last example here: https://github.com/JuliaGeo/GDAL.jl#using-the-gdal-and-ogr-utilities
from geodataframes.jl.
Related Issues (20)
- support ArchGDAL v0.7.0 HOT 2
- isempty export HOT 1
- can not write multip-layer to same the same geopackage HOT 2
- Implement Union of all geometries in a GeoDataFrame
- Add missing geometry operations from ArchGDAL
- ArchGDAL now has a vector dataset writer HOT 1
- Support metadata such as crs HOT 1
- Pointer 'hDS' is NULL in 'GDALDatasetH'.
- Store geometry column names in dataframe metadata
- Friendlier error messages when file not found HOT 2
- Use AG.identifydriver instead of curated list of supported drivers HOT 2
- Detect empty columns
- Pointer 'hDefn' is NULL in 'OGR_F_Create' HOT 3
- Set empty crs to unknown engineering crs
- Exported 3D Point Geometeries Get Flattened (3D -> 2D) HOT 3
- Feature request: Reading from CSV HOT 4
- Can't write a geojson file HOT 2
- Convenience plotting method for use with GeoMakie?
- Approaches to metadata
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 geodataframes.jl.