-
Notifications
You must be signed in to change notification settings - Fork 25
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
Should ArchGDAL.envelope(geom) return Vector{Float64} instead of GDAL.OGREnvelope? #343
Comments
Thank you for filing this issue, and proposing an approach (in #343 (comment)) that I haven't thought of: shp_ds = GDAL.gdalopenex(shp_dir, GDAL.GDAL_OF_VECTOR, C_NULL, C_NULL, C_NULL)
layer1 = GDAL.gdaldatasetgetlayer(shp_ds , 0)
transformE = Array{Cdouble}(undef, 4)
GDAL.ogr_l_getextent(layer1,pointer(transformE),false) My main concern with returning a vector rather than julia> envelope = GDAL.OGREnvelope(100.0, 100.0, 70.0, 70.0)
GDAL.OGREnvelope(100.0, 100.0, 70.0, 70.0)
julia> envelope.M
MaxX MaxY MinX MinY
julia> [envelope.MaxX, envelope.MaxY, envelope.MinX, envelope.MinY]
4-element Vector{Float64}:
100.0
70.0
100.0
70.0 |
May I kindly ask why you are working directly with GDAL? I ask because we've abstracted away many of these C like calls in ArchGDAL, and further abstractions exist in GeoInterface, Rasters, GeoArrays and GeoDataFrames. (disclosure, I'm the author of the latter two). Are we missing functionality in these higher level packages? For example, there's GeoInterface.extent, which gives you a more generic extent (namedtuple like) from the Extents package, that should work on Archgdal geometries. |
Oh, I wish I knew about the envelope.MaxX, then I would not ask and bother you. I should have checked the attributes on GDAL OGREnvelope class. I am sorry for that! I never before used that function. However, I am getting an error when try envelope.M
Forgot to mention, my ArchGDAL version is v0.8.4 and GDAL v1.3.0. Looks like it is time to make an update! |
I started learning Julia and working with, by rewriting my python scripts where GDAL was the library I was using. |
|
Yes, right! My mistake! Thanks! |
UPDATE!
Ok, I figured it out. I used the original GDAL function as I was working with raster, and created an array as a pointer:
Hi!
I am a bit struggling to get shapefile extent coordinates and projection.
If had a raster, I would do:
For shapefile, I do:
Without do-blocks approach, I am getting error:
To get the extent of the shapefile (it is not rectangle but administration unit, but I need extent)
And here is the main problem: I cannot convert GDAL.OGREnvelope object to array nor dataframe. What am I missing?
Sorry if that is basic!
The text was updated successfully, but these errors were encountered: