Gerson Galang | 1 Jun 2011 01:11
Picon

Re: Permission Denied Error on a PostGIS Query

Hi Ben, Andrea,

I followed your suggestion of cleaning up my eclipse project workspace 
but it still didn't fix the problem I reported originally. I'm still 
getting a warning message if I change the ownership of the 
geography_columns to 'postgres'

Jun 1, 2011 9:04:20 AM org.geotools.data.postgis.PostGISDialect 
getGeometrySRID
WARNING: Failed to retrieve information about 
public.lga07aaust_region.wkb_geometry from the geometry_columns table, 
checking geometry_columns instead
org.postgresql.util.PSQLException: ERROR: permission denied for relation 
geography_columns

But the clean eclipse project workspace has fixed the issue with 2.7.1 
complaining about CQLException not being thrown by CQL.toFilter() method.

Cheers,
Gerson

On 05/27/2011 05:01 PM, Ben Caradoc-Davies wrote:
> On 27/05/11 10:34, Gerson Galang wrote:
>> I had a go at 2.7.1 yesterday but it started complaining about the
>> parameter I'm trying to pass to the DataStoreFinder. I just get a null
>> value when I instantiate the DataStore.
>
> Do you have an old gt-postgis on your classpath? There is some funny 
> logic in gt-jdbc-postgis that gives gt-postgis preference if both are 
> present and you use dbtype=postgis (for backwards compatibility). But 
(Continue reading)

Jody Garnett | 1 Jun 2011 01:36
Picon
Gravatar

Re: Zoom Factor

Do you mind sharing your code for calculating "zoom factor"; I can add it to the docs for the next person with your question. Indeed i don't think I explain scale denominator in the docs yet...

On Wed, Jun 1, 2011 at 3:51 AM, Gustavo Mesquita <mesquita.gustavo-dXALDUftOVpQFI55V6+gNQ@public.gmane.org> wrote:
Thanks Jody, your answer solved my problem.

Gustavo Mesquita.

-----
Gustavo Mesquita da Silva.
Brazilian Navy Hydrographic Center
Niterói, Rio de Janeiro - Brazil
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Zoom-Factor-tp6422768p6423853.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@...
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Jody Garnett | 1 Jun 2011 01:38
Picon
Gravatar

Re: Structure of URL WMS/GetfeatureInfo

Thinking; the getFeatureInfo is supposed to be in reference to a GetMapRequest which you provide (that is you are performing your query against a map...). I suspect that you can only perform a query against a layer that is actually listed in your GetMap request?


Would that be the case...

You may need to check the test cases to find an example of GetFeatureInfo.

Jody

On Wed, Jun 1, 2011 at 6:16 AM, khalid Amiral <amiral33-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:
Hello every body,
I'm looking for  the structure of a URL for a query getFeatureInfo works because I used the code below but it gives me the following error: "QUERY_LAYERS contains layers not cited in LAYERS".
with the exit URL
: http://localhost:8080/geoserver/wms?Y=-42&X=147&SERVICE=WMS&FORMAT=image/png&HEIGHT=400&REQUEST=GetFeatureInfo&WIDTH=400&BBOX=-114.01268,59.4596930,-113.26043,60.0835794&SRS=EPSG:4326&QUERY_LAYERS=nurc%3AArc_Sample&VERSION=1.1.1
when i put the exit URL directly in the browser with the correct layer (QUERY_LAYERS=nurc:Arc_Sample) it give me the same error !
The code:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Iterator;
import org.geotools.data.ows.Layer;
import org.geotools.data.ows.WMSCapabilities;
import org.geotools.data.wms.WMSUtils;
import org.geotools.data.wms.WebMapServer;
import org.geotools.data.wms.request.GetFeatureInfoRequest;
import org.geotools.data.wms.request.GetMapRequest;
import org.geotools.data.wms.response.GetFeatureInfoResponse;

public class GetFeatureInfo {
    public static void main(String[] args) throws Exception {          
                   try{                      
                        URL url = new URL("http://localhost:8080/geoserver/wms?REQUEST=GetCapabilities");
                        WebMapServer wms = new WebMapServer(url);
                        WMSCapabilities caps = wms.getCapabilities();
                        Layer layer = null;
                        for( Iterator i = caps.getLayerList().iterator(); i.hasNext();){                       
                            Layer test = (Layer) i.next();                           
                            if( test.getName() != null && test.getName().length() != 0 ){                           
                                layer = test;
                                break;
                            }
                        }        
                     // GetFeatureInfo needs a GetMap before
                       GetMapRequest getMapRequest = wms.createGetMapRequest();            
                    // We set the SRS
                       getMapRequest.setSRS("EPSG:4326");
                    // We set the dimensions of the output
                       getMapRequest.setDimensions("400", "400");
                    // We set the output format
                       getMapRequest.setFormat("image/png");
                    // We set the BBOX of the requested Map
                       getMapRequest.setBBox("-114.01268,59.4596930,-113.26043,60.0835794");           
                    // Now, we can create our GetFeatureInfo, from the previous GetMap
                       GetFeatureInfoRequest request = wms.createGetFeatureInfoRequest(getMapRequest);
                    // We want request this layer           
                       request.addQueryLayer(layer);              
                   // We need information from this point
                       request.setQueryPoint(147,-42);                                           
                       System.out.println(request.getFinalURL());
                    // We ask the server
                       GetFeatureInfoResponse response = (GetFeatureInfoResponse) wms.issueRequest(request);
                       System.out.println(response.getContentType());                     
                       BufferedReader in = new BufferedReader(new InputStreamReader(response.getInputStream()));                   
                       String line;
                       boolean textFound = false;
                       while ((line = in.readLine()) != null) {
                           System.out.println(line);
                     } catch(java.net.ConnectException ce){
                       if(ce.getMessage().indexOf("timed out")>0){
                           System.err.println("Unable to test - timed out: "+ce);
                       } else{
                           throw(ce);
                       }
                   }
                  
               }
}

And thank you very much.

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@...
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Michael Bedward | 1 Jun 2011 03:51
Picon
Gravatar

Re: Zoom Factor

Hello Gustavo, Jody,

I hope this isn't complicating things, but I'm not sure whether Jody's
answer applies to JMapPane right now because it isn't explicitly using
the new MapContent and MapViewport classes yet. Rather, it is still
calculating its own AffineTransforms to convert between map and
display coordinates. So at the moment it might be safer to retrieve
the scale as described in the javadocs for JMapPane...

http://docs.geotools.org/stable/javadocs/org/geotools/swing/JMapPane.html#getWorldToScreenTransform()

Jody - please correct me if I'm wrong here.

Michael

On 1 June 2011 00:07, Jody Garnett <jody.garnett@...> wrote:
> Usually in GIS apps this is known as the scale; and represented as the
> "scale denominator". If you think of an exact picture as 1:1, and a half
> sized picture as 1:2 (the scale denominator is 2) you can see that this
> number gets bigger as you zoom out.
> All the information on what area of the world to display is in the Viewport
> now; you should be able to use that class; and the class ScaleUtils to
> calculate the current map scale.
>
> --
> Jody Garnett
>
> On Tuesday, 31 May 2011 at 11:48 PM, Gustavo Mesquita wrote:
>
> Hi guys,
>
> I need to show features on the map depending of the zoom level. I saw some
> codes from older versions of JMapPane class and there was a method
> getZoomFactor() but in the current version of this class doesn't have this
> method. How can I get the zoom factor, to know the current zoom on the map
> to show more or less features depending of the zoom over the map.
>
> Gustavo Mesquita.
>
> -----
> Gustavo Mesquita da Silva.
> Brazilian Navy Hydrographic Center
> Niterói, Rio de Janeiro - Brazil
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Zoom-Factor-tp6422768p6422768.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger.
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today.
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@...
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger.
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today.
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@...
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
Jody Garnett | 1 Jun 2011 05:51
Picon
Gravatar

Re: Zoom Factor

That is right we were going to start taking the affine transform into the viewport model (so you can externalize all the logic into one class).


So your example is kind of correct:

double scale = mapPane.getWorldToScreenTransform().getScaleX();

We should probably combine this with the MathTransform from the viewport in order to get the actual scale?


On Wed, Jun 1, 2011 at 11:51 AM, Michael Bedward <michael.bedward-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello Gustavo, Jody,

I hope this isn't complicating things, but I'm not sure whether Jody's
answer applies to JMapPane right now because it isn't explicitly using
the new MapContent and MapViewport classes yet. Rather, it is still
calculating its own AffineTransforms to convert between map and
display coordinates. So at the moment it might be safer to retrieve
the scale as described in the javadocs for JMapPane...

http://docs.geotools.org/stable/javadocs/org/geotools/swing/JMapPane.html#getWorldToScreenTransform()

Jody - please correct me if I'm wrong here.

Michael


On 1 June 2011 00:07, Jody Garnett <jody.garnett-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Usually in GIS apps this is known as the scale; and represented as the
> "scale denominator". If you think of an exact picture as 1:1, and a half
> sized picture as 1:2 (the scale denominator is 2) you can see that this
> number gets bigger as you zoom out.
> All the information on what area of the world to display is in the Viewport
> now; you should be able to use that class; and the class ScaleUtils to
> calculate the current map scale.
>
> --
> Jody Garnett
>
> On Tuesday, 31 May 2011 at 11:48 PM, Gustavo Mesquita wrote:
>
> Hi guys,
>
> I need to show features on the map depending of the zoom level. I saw some
> codes from older versions of JMapPane class and there was a method
> getZoomFactor() but in the current version of this class doesn't have this
> method. How can I get the zoom factor, to know the current zoom on the map
> to show more or less features depending of the zoom over the map.
>
> Gustavo Mesquita.
>
> -----
> Gustavo Mesquita da Silva.
> Brazilian Navy Hydrographic Center
> Niterói, Rio de Janeiro - Brazil
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Zoom-Factor-tp6422768p6422768.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger.
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today.
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger.
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today.
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@...
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Jiri Novak | 1 Jun 2011 05:59
Picon

Re: Oracle spatial plugin - WARNING: No mapping for com.vividsolutions.jts.geom.Point

Is this warning appearing only to me? I am really warried about its presence and based on what I have seen briefly in the OracleDialect source code, I don't fully understand how it could actually export the geometry if it logs, what it logs...

Thank you for aclaration...

May 28, 2011 9:02:36 PM org.geotools.jdbc.JDBCDataStore getMapping
WARNING: No mapping for com.vividsolutions.jts.geom.Point

Jiri

On 05/29/2011 11:11 AM, Jiri Novak [via OSGeo.org] wrote:

Thank you very much, with your code I manage the geometry column gets exported as well!

Nevertheless, the same warning still appears for each geometry I try. Any idea why? Is posible to get rid of it?

Jiri

To unsubscribe from Oracle spatial plugin - WARNING: No mapping for com.vividsolutions.jts.geom.Point, click here.


View this message in context: Re: Oracle spatial plugin - WARNING: No mapping for com.vividsolutions.jts.geom.Point
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@...
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Ben Caradoc-Davies | 1 Jun 2011 06:02
Picon
Picon
Favicon

Re: Permission Denied Error on a PostGIS Query

Thanks, Gerson. I can now confirm Andrea's advice that this is just a 
warning (with a typo) on trunk and 2.7.1. I have tested this using 
GeoServer (GeoTools trunk) and I get the same warning that you see on 
2.7.1. The warning is logged, but the plugin falls back to using 
geometry_columns and geometries are created correctly.

Thanks for taking the time to confirm this behaviour.

Kind regards,
Ben.

On 01/06/11 07:11, Gerson Galang wrote:
> Hi Ben, Andrea,
>
> I followed your suggestion of cleaning up my eclipse project workspace
> but it still didn't fix the problem I reported originally. I'm still
> getting a warning message if I change the ownership of the
> geography_columns to 'postgres'
>
> Jun 1, 2011 9:04:20 AM org.geotools.data.postgis.PostGISDialect
> getGeometrySRID
> WARNING: Failed to retrieve information about
> public.lga07aaust_region.wkb_geometry from the geometry_columns table,
> checking geometry_columns instead
> org.postgresql.util.PSQLException: ERROR: permission denied for relation
> geography_columns
>
> But the clean eclipse project workspace has fixed the issue with 2.7.1
> complaining about CQLException not being thrown by CQL.toFilter() method.
>
> Cheers,
> Gerson
>
>
> On 05/27/2011 05:01 PM, Ben Caradoc-Davies wrote:
>> On 27/05/11 10:34, Gerson Galang wrote:
>>> I had a go at 2.7.1 yesterday but it started complaining about the
>>> parameter I'm trying to pass to the DataStoreFinder. I just get a null
>>> value when I instantiate the DataStore.
>>
>> Do you have an old gt-postgis on your classpath? There is some funny
>> logic in gt-jdbc-postgis that gives gt-postgis preference if both are
>> present and you use dbtype=postgis (for backwards compatibility). But
>> this should not happen if you are using Maven.  :-(
>>
>> Perhaps the step below might help this too:
>>
>>> Another weird thing I've noticed is that the CQL.toFilter doesn't throw
>>> a CQLException anymore on 2.7.1. Even if the documentation states that
>>> it throws a CQLException, Eclipse just complains about my try-catch
>>> block not having any statement that throws a CQLException.
>>
>> Please try:
>> mvn eclipse:clean eclipse:eclipse
>> and then refresh and then clean your project in Eclipse. Sometimes
>> Eclipse falls down and can't get up.  :-P
>>
>

--

-- 
Ben Caradoc-Davies <Ben.Caradoc-Davies@...>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
Michael Bedward | 1 Jun 2011 06:58
Picon
Gravatar

Re: Zoom Factor

Hi Jody,

I'm not sure if we're exactly in sync. My point was just that the
required changes to JMapPane have not yet been done (nor the changes
in the render module which need to be done first) so if Gustavo is
querying the map pane for scale I think it's safest to do it as per
the javadocs.

As for the development work, I'll catch up with you on IRC to make
sure I'm up to date with all that needs doing and the best way to do
it. Sorry that didn't happen last week - paid work intervened :(

Michael

On 1 June 2011 13:51, Jody Garnett <jody.garnett@...> wrote:
> That is right we were going to start taking the affine transform into the
> viewport model (so you can externalize all the logic into one class).
> So your example is kind of correct:
> double scale = mapPane.getWorldToScreenTransform().getScaleX();
> We should probably combine this with the MathTransform from the viewport in
> order to get the actual scale?
>
> On Wed, Jun 1, 2011 at 11:51 AM, Michael Bedward <michael.bedward <at> gmail.com>
> wrote:
>>
>> Hello Gustavo, Jody,
>>
>> I hope this isn't complicating things, but I'm not sure whether Jody's
>> answer applies to JMapPane right now because it isn't explicitly using
>> the new MapContent and MapViewport classes yet. Rather, it is still
>> calculating its own AffineTransforms to convert between map and
>> display coordinates. So at the moment it might be safer to retrieve
>> the scale as described in the javadocs for JMapPane...
>>
>>
>> http://docs.geotools.org/stable/javadocs/org/geotools/swing/JMapPane.html#getWorldToScreenTransform()
>>
>> Jody - please correct me if I'm wrong here.
>>
>> Michael
>>
>>
>> On 1 June 2011 00:07, Jody Garnett <jody.garnett@...> wrote:
>> > Usually in GIS apps this is known as the scale; and represented as the
>> > "scale denominator". If you think of an exact picture as 1:1, and a half
>> > sized picture as 1:2 (the scale denominator is 2) you can see that this
>> > number gets bigger as you zoom out.
>> > All the information on what area of the world to display is in the
>> > Viewport
>> > now; you should be able to use that class; and the class ScaleUtils to
>> > calculate the current map scale.
>> >
>> > --
>> > Jody Garnett
>> >
>> > On Tuesday, 31 May 2011 at 11:48 PM, Gustavo Mesquita wrote:
>> >
>> > Hi guys,
>> >
>> > I need to show features on the map depending of the zoom level. I saw
>> > some
>> > codes from older versions of JMapPane class and there was a method
>> > getZoomFactor() but in the current version of this class doesn't have
>> > this
>> > method. How can I get the zoom factor, to know the current zoom on the
>> > map
>> > to show more or less features depending of the zoom over the map.
>> >
>> > Gustavo Mesquita.
>> >
>> > -----
>> > Gustavo Mesquita da Silva.
>> > Brazilian Navy Hydrographic Center
>> > Niterói, Rio de Janeiro - Brazil
>> > --
>> > View this message in context:
>> >
>> > http://osgeo-org.1803224.n2.nabble.com/Zoom-Factor-tp6422768p6422768.html
>> > Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Simplify data backup and recovery for your virtual environment with
>> > vRanger.
>> > Installation's a snap, and flexible recovery options mean your data is
>> > safe,
>> > secure and there when you need it. Data protection magic?
>> > Nope - It's vRanger. Get your free trial download today.
>> > http://p.sf.net/sfu/quest-sfdev2dev
>> > _______________________________________________
>> > Geotools-gt2-users mailing list
>> > Geotools-gt2-users@...
>> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Simplify data backup and recovery for your virtual environment with
>> > vRanger.
>> > Installation's a snap, and flexible recovery options mean your data is
>> > safe,
>> > secure and there when you need it. Data protection magic?
>> > Nope - It's vRanger. Get your free trial download today.
>> > http://p.sf.net/sfu/quest-sfdev2dev
>> > _______________________________________________
>> > Geotools-gt2-users mailing list
>> > Geotools-gt2-users@...
>> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>> >
>> >
>
>

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
Gustavo Mesquita | 1 Jun 2011 14:18
Picon
Favicon

Re: Zoom Factor

The first Jody's answer give me an idea to how I should
write my code. His explanation about scale and scale 
denominator was enough. I did not need to use the class
ScaleUtils. Here goes a piece of my code:

private class MouseHandler extends AbstractZoomTool {

// other code here...
.
.
.

  int jump = 0;

  double currentScale =
getMapPane().getWorldToScreenTransform().getScaleX();
  double scaleWithZoom = currentScale * this.getZoom();

  double resultScale = (scaleWithZoom - currentScale);

  if (resultScale >= 1 && resultScale < 5)
      jump = 12;
  if (resultScale >= 5 && resultScale < 10)
      jump = 9;
  if (resultScale >= 10 && resultScale < 15)
      jump = 6;
  if (resultScale >= 15)
      jump = 3;

  createPointWithArrows(jump);

.
.
.

// More code here...

}

Into the method "createPointWithArrows(int jump)" I have a loop:

for (j = 1; j <= 733; j+=jump) {
   for (i = 1; i <= 601; i+=jump) {

and it place arrows based on the scale of the map.

Gustavo Mesquita.

-----
Gustavo Mesquita da Silva.
Brazilian Navy Hydrographic Center
Niterói, Rio de Janeiro - Brazil
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Zoom-Factor-tp6422768p6426658.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Javier Moreno | 1 Jun 2011 23:09

Styles, Rules and custom functions

Hi everybody! 


I'm trying to stylish a shape and I would like to draw the points with the color that is written in a feature attribute. The name of the attribute is "FILL" and its value is just a rgb triplet string ("#A0A0A0", for example).

I've been looking at the documentation and as far as I can understand it should result in something like this (based on an example of the doc):

class ColorFunction extends FunctionExpressionImpl {        
        public static final FunctionName NAME = new FunctionNameImpl("Colorizador", 0);                
        public ColorFunction() {
            super("Color", filterFactory.literal("Color"));
            super.fallback = CommonFactoryFinder.getFilterFactory2(null).literal(Color.WHITE);
        }
        <at> Override
        public int getArgCount() {
            return 0;
        }
        
        <at> Override
        public Object evaluate(SimpleFeature feature) {
            String fill = (String) feature.getAttribute("FILL");
            ...
            Color color = new Color(...);
            return color;
        }           
}

class XXX {
    ...
    public Style getStyle() {
            style = styleFactory.createStyle();
            FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(
                    new Rule[]{ this.createRule("dummy", 10); }
            style.featureTypeStyles().add(fts);
            return style;
    }

    protected Rule createRule(String name, int size) {        
        ColorFunction colorFn = new ColorFunction();
        
        Graphic gr = styleFactory.createDefaultGraphic();
        Mark mark = styleFactory.getCircleMark();
        mark.setStroke(styleFactory.createStroke(
                colorFn,  filterFactory.literal(1), filterFactory.literal(0.5)));
        mark.setFill(styleFactory.createFill(
                colorFn, filterFactory.literal(1),  filterFactory.literal(0.3),    null));
        gr.graphicalSymbols().clear();
        gr.graphicalSymbols().add(mark);
        gr.setSize(filterFactory.literal(size));
        Rule rule = styleFactory.createRule();
        PointSymbolizer sym = styleFactory.createPointSymbolizer(gr, null);
        rule.setName(name);
        rule.symbolizers().add(sym);
        return rule;
    }
}

If I've understood it right once applied the StreamingRenderer should invoke the ColorFunction evaluate(...) method for each point instance but looks like it's never call and I'm running out of ideas. Could someone tell me what's happening? Maybe am I absolutely wrong about the way this should be implemented?

Thanks in advance!

jv
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@...
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Gmane