[geos-devel] python.i doesn't exist... why?

strk at refractions.net strk at refractions.net
Tue Jun 6 17:33:00 EDT 2006


Since we're talking about this, I'm in the process of closing
up the 3.0.0 release. Charlie, could you give the swig/ bit
a check ? If things get complicated we can rollback to the 2.x
way of only distributing files with no attempt to automatically
build.

--strk;

On Mon, Jun 05, 2006 at 11:58:25PM -0600, Charlie Savage wrote:
> 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 at savagexi.com> 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 at geos.refractions.net
> >http://geos.refractions.net/mailman/listinfo/geos-devel



> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel


-- 

 /"\    ASCII Ribbon Campaign
 \ /    Respect for low technology.
  X     Keep e-mail messages readable by any computer system.
 / \    Keep it ASCII. 




More information about the geos-devel mailing list