[Marble-devel] Adding placemarks using Marble bindings for Python

Jes Sik jes_sik77 at hotmail.com
Wed Jan 9 16:54:01 UTC 2013


    Hello,

    I'm developing a small application using Python bindings for Marble. I want my application to gather some geographic data from a database and pinpoint several coordinates in a map.

    As far as I understand, such can be achieved by the use of placemarks, as explained in this fragment of code extracted from one of the Marble Tutorials, where GeoDataPlacemarks are instantiated and then added to a GeoDataDocument that will later render them in the map.

	GeoDataPlacemark *place = new GeoDataPlacemark( "Bucharest" );
	place->setCoordinate( 25.97, 44.43, 0.0, GeoDataCoordinates::Degree );
	place->setPopulation( 1877155 );
	place->setCountryCode ( "Romania" );
 
 
	GeoDataDocument *document = new GeoDataDocument;
	document->append( place );
 
	// Add the document to MarbleWidget's tree model
	mapWidget->model()->treeModel()->addDocument( document );
    Trying to reproduce these lines of code in Python have proven to be unsuccesful. The MarbleWidget.model() doesn't seem to have the corresponding treeModel(). Even so, looking at the MarbleModel.sip files inside the Marble source code, the treeModel attribute is commented.

This is a small snippet of the code I'm using, which would be equivalent to the one above.

mapWidget = Marble.MarbleWidget()
mapWidget.resize(800,600)

place = Marble.GeoDataPlacemark( "Bucharest" )
place.setCoordinate( 25.97, 44.43, 0.0, Marble.GeoDataCoordinates.Degree )
place.setPopulation( 1877155 )
place.setCountryCode ( "Romania" )

document = Marble.GeoDataDocument()
document.append( place )

mapWidget.model().treeModel().addDocument(document)   --> this is where the compiler warns there is no tree model attribute


    My question is whether the addition of placemarks can be done using python bindings, and if so,  whether my approach is correct or if there is another way to do it.
    
    Thanks in advance,

     Jess
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20130109/d3d78785/attachment.html>


More information about the Marble-devel mailing list