Le samedi 22 avril 2006 à 22:58 -0500, Myunghwa Hwang a écrit :
> I'm trying to retrieve attributed values for selected polygon.
> By using python mapscript and postgis layer, I tried to get a feature by
> querybypoint.
> In the following code, a feature by getFeature has no bounding box.
> The minimum x, y and the maximum x, y are all -1.
> So any attribute was not retrieved.
> Anybody has any idea of this problem?
>
>
> def getNearFeat(qpoint, map):
> # get query layer
> qlayer = map.getLayerByName('blockgroup')
> qlayer.template = 'query_result.html'
> qlayer.tolerance = 1000 # Unit is meter
> # query the query layer
> qlayer.queryByPoint(map, qpoint, ms.MS_MULTIPLE, 1000)
> numResults = qlayer.getNumResults()
> results = qlayer.getResults()
> # retrieve shape index for selected features
> if (numResults > 0):
> featAtts = []
> qlayer.open()
> for i in range(numResults):
> att = []
> query_result = results.getResult(i)
> afeat = qlayer.getFeature(query_result.shapeindex,
> query_result.tileindex)
> if afeat:
> for j in range(qlayer.numitems):
> att.append(afeat.getValue(j))
> featAtts.append(att)
> qlayer.close()
> return featAttsFYI, i've tested your code. It's working fine with MapServer 4.4 but it does not with MapServer 4.8 ( 4.8.3-2 debian version). With the 4.8.2 version, the method getValue always return None, the query_result.shapeindex always return 0. The number of results only seems to work fine. It seems to be a bug but maybe i'm not aware of some new things in the api. Didrik
signature.asc
Description: Ceci est une partie de message numériquement signée
