Heraldo,
I have tried querying a postgis layer and it works great.
This is the code that I use:
protected List queryLayerByPoint(int i, pointObj queryPoint) {
List results = new ArrayList();
layerObj layer = map.getLayer(i);
if (layer != null && isVisible(layer)) {
if (log.isDebugEnabled()) {
log.debug("Querying layer: " + layer.getName());
}
if (layer.queryByPoint(map, queryPoint,
mapscript.MS_MULTIPLE, -1) == mapscript.MS_SUCCESS) {
//resultCacheObj resultCache = layer.ggetResultcache();
if (layer.open() == mapscript.MS_SUCCESS) {
//for (int j=0;j<resultCache.getNumresults();j++) {
for (int j = 0; j < layer.getNumResults(); j++) {
if (log.isDebugEnabled())
log.debug("Layer " + layer.getName() + ",
result number:" + j);
resultCacheMemberObj resultMember = layer.getResult(j);
shapeObj shape = new shapeObj(layer.getType());
layer.getShape(shape,
resultMember.getTileindex(), resultMember.getShapeindex());
if (shape != null) {
Map aResult = getResult(shape, layer);
results.add(aResult);
} else {
log.error("Shape " + j + " is null!");
}
}
layer.close();
} else {
log.error("Cannot open layer: " + layer.getName());
}
} else {
log.info("Query on layer " + layer.getName() + " failed.");
}
}
return results;
}
It is different from yours in that I do not fetch results from the
resultCache and I use layer.getShape instead of getFeature.
Let me know if this fixes your problem.
Regards,
Umberto
On 6/13/06, Rodriguez, Heraldo <[EMAIL PROTECTED]> wrote:
Thank you very much.
Heraldo G. Rodriguez
[EMAIL PROTECTED]
TE 4326-4002 int 255
Dpto. Desarrollo
Sistemas Catastrales S.A
-----Mensaje original-----
De: Umberto Nicoletti [mailto:[EMAIL PROTECTED]
Enviado el: martes, 13 de junio de 2006 10:13
Para: Rodriguez, Heraldo
CC: [email protected]
Asunto: Re: [UMN_MAPSERVER-USERS] JavaMapscript SIGSEGV
Open an issue on bugzilla (http://mapserver.gis.umn.edu/bugs/) and
attach the three logs.
I'll look into this asap.
Umberto
On 6/13/06, Rodriguez, Heraldo <[EMAIL PROTECTED]> wrote:
>
>
> Humberto ,
> This is the method that is crashing. I am attaching a couple of
> logs too. (line shapeObj shape = l.getFeature(r.getShapeindex(), -1); )
> I hope it helps. Thanks
>
> public List queryPorPunto(int x, int y) {
> List lista = new ArrayList();
> pointObj p = new pointObj(x, y, 0);
> String row = "";
>
> layerObj l = map.getLayerByName("entorno");
> l.queryByPoint(map, p, mapscriptConstants.MS_MULTIPLE,
-1);
>
> resultCacheObj results = l.getResults();
> if (results == null)
> return lista;
>
> l.open();
> for (int i = 0; i < results.getNumresults(); i++)
> {
> resultCacheMemberObj r =
> results.getResult(i);
> shapeObj shape =
> l.getFeature(r.getShapeindex(), -1);
> row = "";
> for (int j = 0; j < shape.getNumvalues();
> j++)
> {
> row = row + "<TD>" +
> shape.getValue(j) + "</TD>";
> }
> lista.add(row);
> }
> l.close();
> return lista;
> }
>
>
>
>
>
>
> Heraldo G. Rodriguez
> [EMAIL PROTECTED]
> TE 4326-4002 int 255
> Dpto. Desarrollo
> Sistemas Catastrales S.A
>
>
> -----Mensaje original-----
> De: Umberto Nicoletti [mailto:[EMAIL PROTECTED]
> Enviado el: martes, 13 de junio de 2006 3:50
> Para: Rodriguez, Heraldo
> CC: [email protected]
> Asunto: Re: [UMN_MAPSERVER-USERS] JavaMapscript SIGSEGV
>
> Hi,
> please post the hs_error_* file and the Java program that is causing the
> crash.
>
> Thanks,
> Umberto
>
>
> On 6/12/06, Rodriguez, Heraldo <[EMAIL PROTECTED]> wrote:
> > Hi guys,
> > I have started developing with java mapscript and I have the
> same
> > problems with the shapeObj class.
> > Every time I want to create a new shape I get the message
> > > #
> > > # An unexpected error has been detected by HotSpot Virtual Machine:
> > > #
> > > # SIGSEGV (0xb) at pc=0x00002aaaaae43d5b, pid=23120,
tid=46912501734144
> > > #
> > > # Java VM: Java HotSpot(TM) Client VM (1.4.2_11-b06 mixed mode)
> > > # Problematic frame:
> > ...
> >
> > I am using mapserver 4.8.1 with java 1.4.2_11 version under Debian
3.1.
> >
> > Mapserver Compiling options
> > ./configure --with-freetype=/usr/local/bin/freetype-config
> > --with-zlib=/usr/lib --with-png=/usr/local/lib --with-jpeg=/usr/lib
> > --with-libiconv=/usr/local/lib --with-gd=/usr/local/bin/gdlib-config
> > --with-pdf=/usr/local/lib --with-proj=/usr/local/lib --with-threads
> > --with-geos=/usr/local/bin/geos-config
> --with-ogr=/usr/local/bin/gdal-config
> > --with-gdal=/usr/local/bin/gdal-config
> > --with-postgis=/usr/local/pgsql/bin/pg_config --with-wfs --with-wcs
> > --with-wmsclient --with-curl-config=/usr/local/bin/curl-config
> >
> > Steps to compile java mapscript
> > Run make
> > Make interface (swig version 1.3.29)
> > Make all
> >
> > I looked for a solution in google and mapserver documentation without
> > success. Could you please give me a clue to solve this? Thanks in
> > advance.
> > Best regards.
> >
> >
> >
> > Heraldo G. Rodriguez
> > [EMAIL PROTECTED]
> > TE 4326-4002 int 255
> > Dpto. Desarrollo
> > Sistemas Catastrales S.A
> >
> >
> >
> > -----Mensaje original-----
> > De: Andre Sachs [mailto:[EMAIL PROTECTED]
> > Enviado el: miƩrcoles, 31 de mayo de 2006 5:16
> > Para: [email protected]
> > Asunto: Re: [UMN_MAPSERVER-USERS] JavaMapscript SIGSEGV
> >
> > On 31 May 2006, at 8:37 AM, Umberto Nicoletti wrote:
> >
> > > Andre, could you report whether the patch attached to gentoo bugzilla
> > > works or not?
> >
> > Hi Umberto,
> >
> > Sorry for not replying earlier.
> >
> > The patch works in a 32 intel environment, thanks !
> >
> > Due to time constraints on my current project I ditched my AMD 64,
> > Java 1.5 64 bit environment in favour of Intel 32 bit and this has
> > resolved my problem.
> >
> > The problems I experienced are somewhere in the application stack,
> > either in :
> > - Sun's 64 bit 1.5 jdk
> > - Gentoo's glibc 2.3.5-r2
> > - Linux kernel 2.6.16
> >
> > Once my current project is over (+- 3 weeks) I will be have some
> > spare time to hunt down the culprit.
> >
> > Regards,
> > Andre
> > --
> > Andre Sachs
> > IT Architect, Clue Technologies PTY (LTD)
> > email: [EMAIL PROTECTED]
> >
>
>
>
>