logo       

Re: python.i doesn't exist... why?: msg#00019

gis.geos.devel

Subject: Re: python.i doesn't exist... why?

Hi Pablo,

Ok - that's because the swig files assume there is a readHex method. This will be fixed for 3.0, sorry about the problems in 2.2.0.

Anyway, to manually fix open geos.i in the swig directory:

1. Comment out line 166 which is:

%newobject WKBReader::readHEX;

2. Comment out line 186-190:

%factory(geos::Geometry * geos::WKBReader::readHEX, geos::Point,
geos::LinearRing, geos::LineString,
geos::Polygon,
geos::MultiPoint,
geos::MultiLineString,
geos::MultiPolygon,
geos::GeometryCollection);

3. Comment out lines 297 to the end of the file:

%extend geos::Geometry {
static geos::GeometryFactory& factory()
{
static geos::GeometryFactory factory;
return factory;
}

static geos::WKBReader& reader()
{
#if GEOS_VERSION_MAJOR == 2
static geos::WKBReader reader(geos_Geometry_factory());
#else
static geos::io::WKBReader reader(geos_Geometry_factory());
#endif
return reader;
}

static Geometry* fromWKT(std::string wkt)
{
std::stringstream in(wkt);
return geos_Geometry_reader().read(in);
}

static Geometry* fromHEX(std::string hex)
{
std::stringstream in(hex);
return geos_Geometry_reader().readHEX(in);
}
};

Thanks,

Charlie


Pablo Souza Grigoletti wrote:
Hi Charlie,

I did what you said:

- mv geos_wrap.cxx geos_wrap.cxx.old
- I created python.i with the code that you gave me. - swig -c++ -python -modern -o geos_wrap.cxx ../geos.i


../../source/headers/geos/geom.h:671: Warning(509): Overloaded
geos::CoordinateS equence::hasRepeatedPoints(geos::CoordinateSequence
const *) is shadowed by hasR epeatedPoints() const at
../../source/headers/geos/geom.h:658.
../../source/headers/geos/geom.h:684: Warning(509): Overloaded
geos::CoordinateS equence::minCoordinate(geos::CoordinateSequence *) is
shadowed by minCoordinate( ) const at
../../source/headers/geos/geom.h:661.


- python setup.py build


...
geos_wrap.cxx: In function 'geos::Geometry*
geos_Geometry_fromHEX(std::string)': geos_wrap.cxx:4417: error: 'class
geos::WKBReader' has no member named 'readHEX' geos_wrap.cxx: In
function 'PyObject* _wrap_Geometry_srid_set(PyObject*, PyObjec t*)':
geos_wrap.cxx:24176: warning: passing 'double' for argument 1 to
'virtual void g eos::Geometry::setSRID(int)' error: command 'gcc' failed
with exit status 1


As you said me, a problem with readHEX happened.
do you have any suggestion?

Ahh, I have the SWIG right version:


# swig -version
SWIG Version 1.3.29


Best regards.
Pablo


On Mon, 05 Jun 2006 21:21:17 -0600
Charlie Savage <cfis@xxxxxxxxxxxx> wrote:

Hi Pablo,

Sorry not to respond sooner - I just got back from vacation.

What python.i is used for is to generate geos_wrap.cxx using SWIG. If

you look, you'll see that file exists. So theory you could get by without python.i and just run the part of the build script that builds/installs the extensions.

However, there unfortunately there is a problem with that because the geos_wrap.cxx file includes pointers to a method called readHex which does not actually exist in geos 2.2.2 (well, it does in my version but

no release version).

So I'd recommend:

Create python.i in your swig/python directory. Then put this code
into it:

%template(vector_GeometryP) std::vector<geos::Geometry *>;
%template(vector_LineStringP) std::vector<geos::LineString *>;
%template(vector_PolygonP) std::vector<geos::Polygon *>;

Then make sure you have swig 1.3.29 installed. Then try the build script again. You may also want to delete geos_wrap.cxx before you
start.

Hope this helps,

Charlie


_______________________________________________________ Abra sua conta no Yahoo! Mail: 1GB de espaço, alertas de e-mail no celular e anti-spam realmente eficaz. http://mail.yahoo.com.br/
_______________________________________________
geos-devel mailing list
geos-devel@xxxxxxxxxxxxxxxxxxxx
http://geos.refractions.net/mailman/listinfo/geos-devel

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
geos-devel mailing list
geos-devel@xxxxxxxxxxxxxxxxxxxx
http://geos.refractions.net/mailman/listinfo/geos-devel
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise