[Qgis-developer] Use of Spatial Index and more

maaza mekuria sailmcm at yahoo.com
Fri Jul 29 12:26:40 EDT 2011


Thanks again Martin. I was able to use it effectively for my needs. I am delighted to have you guys to help. Many times because of the lack of available documentation, your experiences are invaluable and it may be the one that would make or break a person's patience to do plugging along in QGis. 

I did also benefit greatly from Sergey Yakushev's road graph plugin. I did not realize that one can setup a plugin Gui fairly easily once cmakelist file is modified by disabling the dummy plugin's ".ui" file. That file, while it is meant to help one use the designer, many times it makes it harder to manage all that goes on in the internals. Unless a person is well versed in QT Designer and, I must say, uses QT for compiling, I found it to be a bit awkward to use in Windows. I learned about making a dockable widget, writing defaults and storing variables in the project file, etc.

Sergey's programming ability is very impressive, I wish I could be like him. But I am thankful that he shared his knowledge and work with me. I am glad I was able to glean a lot from him and learned a bit about the internals of QGIS. There are still many things that I do not understand how the program works but it is an excellent work worthy of a QGIS award. Is there something like that? 

One question I would ask Sergey is, why RoadGraph runs out of memory when I include more data. It works if the dataset is relatively small. But as soon as I increase the extent of the data, the program quits. I looked at the code and there is a number of points allocation that seems to be set at twice the size of a certain estimate. But I did not want to attempt to bungle an excellent program. It took me almost two month just to grasp what the program was doing, and yet there are still things that I still do not understand. But it has helped me comprehend many things including interaction with the canvas, and of-course the question I asked about spatial indexing came after looking at the road graph code of creating an in memory index.

I still would like that one should be able to create and access indices to perform spatial analysis fairly easily. For doing GIS work one must perform these actions many times not just from a single geometry, but in groups. So my humble request is to place a function function (perhaps in QgsSpatialIndex that will take a data layer and return a spatial index. Also it would be helpful for those with less memory, and highly memory intensive work, to allow access to the spatial index disk file for similar use in place of memory index. It may be a bit slower than an in memroy version, but it should do just the same as the other.

What do you think,

Maaza  

--- On Thu, 7/28/11, Martin Dobias <wonder.sk at gmail.com> wrote:

> From: Martin Dobias <wonder.sk at gmail.com>
> Subject: Re: [Qgis-developer] Use of Spatial Index
> To: "maaza mekuria" <sailmcm at yahoo.com>
> Cc: "QGIS Developer" <qgis-developer at lists.osgeo.org>
> Date: Thursday, July 28, 2011, 2:45 PM
> On Thu, Jul 28, 2011 at 8:36 PM,
> maaza mekuria <sailmcm at yahoo.com>
> wrote:
> > Thank you, Martin for your explanation. I ahve one
> more followup question.
> >
> > Can the spatial index be composed of features other
> than points? I do not see any restriction in the
> documentation. Can I use features such as lines and
> polylines in an in-memory spatial index and use these as one
> uses points?
> 
> Yes, you can use lines and polygons. Spatial index only
> uses bounding
> boxes of the geometries to for the queries. Therefore also
> intersection query will return features that have bounding
> box of
> their geometry intersecting the query rectangle.
> 
> Martin
> 


More information about the Qgis-developer mailing list