Giter VIP home page Giter VIP logo

Comments (7)

ajolma avatar ajolma commented on July 18, 2024

It's in Geo::GDAL::FFI::new since those are semi-automatic, to wrap it into Layer class is manual work. There's no Extent class and I'm not sure one is needed. This can be used as it is now by creating the extent as $e = [0,0,0,0] before the call and giving $t as a parameter.

from geo-gdal-ffi.

shawnlaffan avatar shawnlaffan commented on July 18, 2024

What about to get the extent for an existing layer?

from geo-gdal-ffi.

shawnlaffan avatar shawnlaffan commented on July 18, 2024

OK, I figured it out.

    my $int = 1;
    my $extent = [0,0,0,0];
    my $e = Geo::GDAL::FFI::OGR_L_GetExtent ($$layer, $extent, \$int);
    print 'Gives: ' . join ' ', @$extent;
    #  Gives: 0 100000 0 100000

Is this in the docs somewhere? Or a pointer to the calling convention?

from geo-gdal-ffi.

ajolma avatar ajolma commented on July 18, 2024

I usually add it to the docs when I wrap it. Calling it from the root class is left as an exercise to the user, it's a combination of looking at the GDAL docs and similar cases here. Note that the raw API may be incorrect since it is there by the header file parser.

from geo-gdal-ffi.

shawnlaffan avatar shawnlaffan commented on July 18, 2024

There might be some possibility to generate the methods using a factory approach if there are similarities in how they are handled. For example the Identity, Union etc methods for layers all look like they differ only in the Geo::GDAL::FFI::OGR_L_* call. Same for CreateField and CreateGeomField.

A quick check of argument sets is below.

grep 'attach' FFI.pm | gawk -vFS='/' '{print $2}' | sort | uniq -c | sort -n | sed 's/^[ ]*//' | gawk -vFS=' ' '$1 > 4'

5 opaque double double double double double double
5 opaque int opaque
5 opaque string double
6 int
7 opaque int int*
7 opaque opaque opaque opaque GDALProgressFunc opaque
8 opaque GDALProgressFunc opaque
8 opaque string string
9 opaque double
10 opaque double double double
10 opaque int int
11 opaque double double double double double
11 opaque int*
13 opaque string_pointer
13 string
18 opaque double double double double
44 opaque string
57 opaque int
71 opaque opaque
103
219 opaque

from geo-gdal-ffi.

shawnlaffan avatar shawnlaffan commented on July 18, 2024

PR for factory creation of overlay methods is in #10. Let me know if there are other obvious candidates

I'll submit PRs for other methods as I wrap them for my own code.

from geo-gdal-ffi.

shawnlaffan avatar shawnlaffan commented on July 18, 2024

Issue fixed by PR #11

from geo-gdal-ffi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.