[Geoserver-users] About Geoserver & temporary datasets

hi everybody,

I want in my application (avaible as prototype in
http://edit.csic.es:8080/edit_geo/prototype/edit.html)
to let users insert their point data in PostGIS and perform point-in-polygon
operations (CONTAINS function), for example, number of species (it means
updating column number_species in polygon table). Then, user should see the
results reflected in polygon maps (different colors depending on value in
number_species column).

The question is that Geoserver takes data from an unique table when
"requesting" a Feature Type.
If two users insert points at the same time and want to perform analysis on
the same polygon table, then we have a problem: should we interactively
create a new feature Type (with different name of the one created by the
first user), that calls a different table (with different name) to let user
visualize their data?
Or, that's the question: could TEMPORARY DATASETS (create temporary table)
be the solution? These tables can only be seen by who has created them, and
as soon as the connection terminates, they are deleted automatically. So, I
could have two tables with the same name and just a featureType (only
referring to a table name) calling them.

It would be great! but has someone experience about the behaviour of
Geoserver and these kind of tables? will GeoServer understand which of the
two newly created tables has to take data from?

Which would be your approach for solving this kind of multi-user problems?

I hope to make me understand,
Best regards,

Pere Roca
--
View this message in context: http://www.nabble.com/About-Geoserver---temporary-datasets-tf4429741.html#a12636969
Sent from the GeoServer - User mailing list archive at Nabble.com.

pere roca ha scritto:

hi everybody,

I want in my application (avaible as prototype in
http://edit.csic.es:8080/edit_geo/prototype/edit.html)
to let users insert their point data in PostGIS and perform point-in-polygon
operations (CONTAINS function), for example, number of species (it means
updating column number_species in polygon table). Then, user should see the
results reflected in polygon maps (different colors depending on value in
number_species column).

The question is that Geoserver takes data from an unique table when
"requesting" a Feature Type.
If two users insert points at the same time and want to perform analysis on
the same polygon table, then we have a problem: should we interactively
create a new feature Type (with different name of the one created by the
first user), that calls a different table (with different name) to let user
visualize their data?
Or, that's the question: could TEMPORARY DATASETS (create temporary table)
be the solution? These tables can only be seen by who has created them, and
as soon as the connection terminates, they are deleted automatically. So, I
could have two tables with the same name and just a featureType (only
referring to a table name) calling them.

It would be great! but has someone experience about the behaviour of
Geoserver and these kind of tables? will GeoServer understand which of the
two newly created tables has to take data from?

Which would be your approach for solving this kind of multi-user problems?

Unfortunately there is no support for temporary tables nor in GeoServer,
nor in the underlying GeoTools library. You would have to create new persitent tables, but that would require some sizeable coding effort.

One way to handle this would be to add your point data table a UUID
column, that your client code would populate it with a different identifier for each user. Then to perform the point in polygon analsys you would just have to add a UUID = xxx predicate to your query, something you can do even with WFS GetFeature.
Would that work for you?

Cheers
Andera

Hi Andrea,
thanks for your help.
Ok, I think I catched it. After inserting an unique identifier for each client (UUID) in point table, I should interactively insert this parameter in the PostGIS function to take only point-in-polygon data from this client (sql function point-in-pol ($UUID) (update polygon_table … WHERE UUID=$1 and CONTAINS…).
This new data (number_species) is inserted in a new polygon table (polygon_point). If we suppose there are more users at the same time, then this table will have data like this:

UUID the_geom(polygon) number_species
1 33
1 2
2 5

Now, we want to use SLD to print polygons by number_species parameter, BUT only the data of an unique user. So,in our SLD we should state somewhere TWO Rules: UUID=x and PropertyIsBetwwen (or similar) number_species (then, PolygonSymbolizer).

Can we do it by SLD? (I mean, these two filters).

I think I can use php to pass the parameter $UUID to SLD (something like http://geoserver/wms?service=Getmap…SLD=http//slds/number_species.php?UUID=1).

number_species.php (the one that creates the SLD) would be like this:

<ogc:PropertyIsLike wildCard=“*” singleChar=“?” escape=""> ogc:PropertyNameUUID</ogc:PropertyName>
ogc:Literal<?php echo($_REQUEST['UUID']); ?></ogc:Literal>
</ogc:PropertyIsLike>

BUT, what about the next filter? (print it depending of number_species column?).

Thanks in advance,

Pere

2007/9/12, Andrea Aime <aaime@anonymised.com>:

pere roca ha scritto:

hi everybody,

I want in my application (avaible as prototype in
http://edit.csic.es:8080/edit_geo/prototype/edit.html )
to let users insert their point data in PostGIS and perform point-in-polygon
operations (CONTAINS function), for example, number of species (it means
updating column number_species in polygon table). Then, user should see the
results reflected in polygon maps (different colors depending on value in
number_species column).

The question is that Geoserver takes data from an unique table when
“requesting” a Feature Type.
If two users insert points at the same time and want to perform analysis on
the same polygon table, then we have a problem: should we interactively
create a new feature Type (with different name of the one created by the
first user), that calls a different table (with different name) to let user
visualize their data?
Or, that’s the question: could TEMPORARY DATASETS (create temporary table)
be the solution? These tables can only be seen by who has created them, and
as soon as the connection terminates, they are deleted automatically. So, I
could have two tables with the same name and just a featureType (only
referring to a table name) calling them.

It would be great! but has someone experience about the behaviour of
Geoserver and these kind of tables? will GeoServer understand which of the
two newly created tables has to take data from?

Which would be your approach for solving this kind of multi-user problems?

Unfortunately there is no support for temporary tables nor in GeoServer,
nor in the underlying GeoTools library. You would have to create new
persitent tables, but that would require some sizeable coding effort.

One way to handle this would be to add your point data table a UUID
column, that your client code would populate it with a different
identifier for each user. Then to perform the point in polygon analsys
you would just have to add a UUID = xxx predicate to your query,
something you can do even with WFS GetFeature.
Would that work for you?

Cheers
Andera

pere roca ristol ha scritto:

Hi Andrea,
thanks for your help.
Ok, I think I catched it. After inserting an unique identifier for each client (UUID) in point table, I should interactively insert this parameter in the PostGIS function to take only point-in-polygon data from this client (sql function point-in-pol ($UUID) (update polygon_table ... WHERE UUID=$1 and CONTAINS...). This new data (number_species) is inserted in a new polygon table (polygon_point). If we suppose there are more users at the same time, then this table will have data like this:

UUID the_geom(polygon) number_species
1 33
1 2
2 5

Now, we want to use SLD to print polygons by number_species parameter, BUT only the data of an unique user. So,in our SLD we should state somewhere TWO Rules: UUID=x and PropertyIsBetwwen (or similar) number_species (then, PolygonSymbolizer).

Can we do it by SLD? (I mean, these two filters).

I think I can use php to pass the parameter $UUID to SLD (something like http://geoserver/wms?service=Getmap...SLD=http//slds/number_species.php?UUID=1).

number_species.php (the one that creates the SLD) would be like this:

<ogc:PropertyIsLike wildCard="*" singleChar="?" escape="\"> <ogc:PropertyName>UUID</ogc:PropertyName>
   <ogc:Literal><?php echo($_REQUEST['UUID']); ?></ogc:Literal> </ogc:PropertyIsLike>

BUT, what about the next filter? (print it depending of number_species column?).

You just have to enclose both filters in the <And> filter, something like:

<ogc:And>
   <ogc:PropertyIsBetween>
             <ogc:PropertyName>PERSONS</ogc:PropertyName>
             <ogc:LowerBoundary>
               <ogc:Literal>2000000</ogc:Literal>
             </ogc:LowerBoundary>
             <ogc:UpperBoundary>
               <ogc:Literal>4000000</ogc:Literal>
             </ogc:UpperBoundary>
           </ogc:PropertyIsBetween>
   <ogc:PropertyName>UUID</ogc:PropertyName>
     <ogc:Literal><?php echo($_REQUEST['UUID']); ?></ogc:Literal>
  </ogc:PropertyIsLike>
</ogc:And>

Yet, you have a second option. You can have your SLD be static,
stored into GeoServer, and include only the between filter.
The UUID filter can be added to the WMS request as well,
using for example &CQL_FILTER=UUID = value.
Beware this is a vendor parameter, so you won't be able
to change server and preserve the functionality.
For more information about these and other vendor parameters
have a look at:
http://docs.codehaus.org/display/GEOSDOC/WMS+vendor+parameters

Hope this helps
Cheers
Andrea