Bernhard Kastner | 12 Jan 2006 12:31
Picon
Favicon

Using a bounding box filter

Hi list,

I want to get a number of points, that appear on my screen and are
stored in a shapefile.
I used the snippet, I found in the tutorial about "Using a bounding box
Filter". there is the following snippet:

-----------------------------
FilterFactory ff = FilterFactory.createFilterFactory();
BBoxExpression bb = ff.createBBoxExpression(env);
Filter bboxFilter =
        ff.createGeometryFilter(AbstractFilter.GEOMETRY_BBOX);
((GeometryFilter)bboxFilter).addRightGeometry(bb);
String geom = ds.getSchema(featureType).getDefaultGeometry().getName();
((GeometryFilter)bboxFilter).addLeftGeometry(
        ff.createAttributeExpression(ds.getSchema(featureType),geom));
-----------------------------

For the env-variable I used mapContext.getAreaOfInterest, which should
limit the Filter to the Area I'm currently displaying at the screen.
The ds-variable is DataStore ds = new ShapefileDataStore(theShape.toURL());

Only the featureType is unclear, and I tried the store.getTypeNames()[0]
instead of the variable.

Btw: This is a missing point at the tutorial: Nowhere is explained,
where the variables are coming from.

Anyways, my code now looks like this:
-----------------------------
(Continue reading)

Christina Greschner | 12 Jan 2006 18:14
Picon
Picon

SLD-Style: createFeatureTypeStyle WITHOUT FeatureTypeName

Hello !

Maybe someone can help me with problem when building a SLD-style:
I am creating a Styled Layer Descriptor (SLD) Style with Geotools, but I
would like to create a Style WITHOUT having a FeatureTypeName created.
I have attached the code of my class "ExampleStyleFactory" where I build my
style. After this I use the SLDTransformer to have print out an SLD-XML file
on my console:
The problem is in the method "createFeatureTypeStyle": when I set the
FeatureTypeName to "null" I still get a <sld:FeatureTypeName/> -Tag after
using the SLDTransformer in the SLD-Dokument. If I do not set a name at all
then I get the following tag
<sld:FeatureTypeName>feature</sld:FeatureTypeName>.
Does anyone know if there is a way to NOT have this tag created? This is
because I would like to have a very general SLD-Dokument.

Thanks a lot in advance!

Christina Greschner

SLDTransformer aTransformer = new SLDTransformer();
aTransformer.setIndentation(4);
aTransformer.transform(style,  new PrintWriter(System.out));
-----

public class ExampleStyleFactory {

    private StyleBuilder sb;
    private StyleFactory sf;
    private Style style;
(Continue reading)

Jody Garnett | 12 Jan 2006 18:21
Favicon

Re: SLD-Style: createFeatureTypeStyle WITHOUT FeatureTypeName

Use the typeName of Feature

All FeatureTypes form a heiarchy and the one called "Feature" is at the 
top.  There is a formal hierarchy around somewhere, and we could 
constuct a bunch of useful styles based on it ....

but yeah "WITHOUT featureTypeName" == "Feature"

Jody

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Justin Deoliveira | 12 Jan 2006 20:02

Re: [Geoserver-users] Limit Size Of Polygons

Hi Lena,

170 coordinates isn't that large, shouldn't be a resource problem at 
all. Something else must be going wrong.

-Justin

Lena Pahl wrote:
> Hi Justin!
> I encoutered problems with a polygon of 170 coordinates. I didn't have any trouble dealing with a feature
polygon of 70 nodes.
> 
> 
> Justin Deoliveira <jdeolive@...> schrieb am 11.01.06 19:43:14:
> 
>>I would think the only limit is memory, it could be that your polygon 
>>has so many coordinates that you are running out of memory. Do you have 
>>any idea of how many coordinates your polygon has?
>>
>>Lena Pahl wrote:
>>
>>>Hello!
>>>I don't know if my problem is related to GeoServer or Geotools so I'm posting this to both lists...
>>>Is there a known limitation to the number of nodes/points that a multipolygon can have? I was wondering -
because sometimes when I insert features with large geometries into ArcSDE using GeoServer those
features cannot be deleted anymore. Querying works fine though..
>>>Did anybody have that experience? How many points can a multipolygon/polygon have anyways? 
>>>Any help is highly apreciated... Thanks!
>>>Regards,
>>>Lena
(Continue reading)

Rueben Schulz | 13 Jan 2006 06:58
Picon
Favicon

Re: Stupid question about coordinates and distance

Hi,

I just have one small point to add to Martin's answer.

Map projections convert Lat/Long to a planar coordinate system that we
can easily do calculations on (distance, area, etc.). However, a map
projection ends up distorting either area, direction, distance or shape
(I think that is the full list). So if you want to calculate areas, you
should chose a map projection that preserves area (though it might
distort other properties). For example, the Mercator projection was
created to preserve direction, but completely distorts area (checkout
Greenland on a Mercator map).

Also, note that any projection will distort properties more as you get
away from their central meridian (or latitude of origin). So projection
parameters for Canada do not work very well for Europe. For example, the
Mercator (usually with a latitude of origin at the equator) will distort
greenland much more than shapes near the equator.

There is a bit more information (in serious need of an edit) here:

http://www.geotools.org/display/GEOTOOLS/Introduction+to+Coordinate
+systems

Rueben

On Wed, 2006-11-01 at 12:32 -0800, todd runstein wrote:
> I'm still very new to GIS - hence the newbie style
> question.
> 
(Continue reading)

Petra Staub | 13 Jan 2006 10:12
Picon
Favicon

Cannot render/display GridCoverage


Hi

Can someone help me newbie display my GridCoverage2D, obtained
from a WMS (geoserver)? I am using gt 2.1.1.

- I have a GridCoverage2D containing a world map. If I run for debugging 
purposes
  gridCoverage.show(), I actually see the whole map...cool so far...

- From my PostGIS DB I obtain two feature sources

- Create a MapContext and add my GridCoverage and the two feature sources

- Create a MapPane and set the MapContext

- For checking I iterate over mapPane.getRenderer().getLayers() and print 
out
  the following:

Layer: SLDRenderedGeometries[z=0] / true / GEOGCS["WGS84", DATUM["WGS84", 
SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], 
UNIT["degree of angle",0.017453292519943295], AXIS["Geodetic 
longitude",EAST], AXIS["Geodetic latitude",NORTH]]

Layer: SLDRenderedGeometries[z=1] / true / GEOGCS["WGS84", DATUM["WGS84", 
SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], 
UNIT["degree of angle",0.017453292519943295], AXIS["Geodetic 
longitude",EAST], AXIS["Geodetic latitude",NORTH]]

(Continue reading)

jeremy.deroyer | 13 Jan 2006 10:45

RE Cannot render/display GridCoverage


I've posted it a week ago, see my code attached.





"Petra Staub" <calc42-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>
Envoyé par : geotools-gt2-users-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org

13/01/2006 10:12

A
geotools-gt2-users-5NWGOfrQmneRv+LV9MX5urNAH6kLmebB@public.gmane.org.net
cc
Objet
[Geotools-gt2-users] Cannot render/display GridCoverage






Hi

Can someone help me newbie display my GridCoverage2D, obtained
from a WMS (geoserver)? I am using gt 2.1.1.

- I have a GridCoverage2D containing a world map. If I run for debugging
purposes
 gridCoverage.show(), I actually see the whole map...cool so far...

- From my PostGIS DB I obtain two feature sources

- Create a MapContext and add my GridCoverage and the two feature sources

- Create a MapPane and set the MapContext

- For checking I iterate over mapPane.getRenderer().getLayers() and print
out
 the following:

Layer: SLDRenderedGeometries[z=0] / true / GEOGCS["WGS84", DATUM["WGS84",
SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0],
UNIT["degree of angle",0.017453292519943295], AXIS["Geodetic
longitude",EAST], AXIS["Geodetic latitude",NORTH]]

Layer: SLDRenderedGeometries[z=1] / true / GEOGCS["WGS84", DATUM["WGS84",
SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0],
UNIT["degree of angle",0.017453292519943295], AXIS["Geodetic
longitude",EAST], AXIS["Geodetic latitude",NORTH]]

Layer: SLDRenderedGeometries[z=2] / true / GEOGCS["WGS84", DATUM["WGS84",
SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0],
UNIT["degree of angle",0.017453292519943295], AXIS["Geodetic
longitude",EAST], AXIS["Geodetic latitude",NORTH]]

- Now if I display the MapPane (mapPane.createScrollPane()) I only see my
features,
 but no world data from my GridCoverage.


Can someone point me to the mistake I am making? I think the created
GridCoverage2D
should be fine, as you can see its output with gridCoverage.show(). However,
it
seems, I am doing something wrong with rendering.

Any code examples or references very, very welcome! ;-)

Thanks for any input!

_________________________________________________________________
Umfangreich, essenziell und aktuell! Auf MSN Search werden Sie schnell
fündig! http://search.msn.ch/



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Attachment (WorldImageViaWms.java): application/octet-stream, 5693 bytes
todd runstein | 13 Jan 2006 22:45
Picon
Favicon

GeodeticCalculator problems

I'm trying to determine ratios of width and height
based on 2 coordinates.  I thought this was working
well, but I've run into trouble when I want to
encompass the entire planet.

I'm using GeodeticCalculator to calculate the
difference between the "x"s and "y"s.  Unfortunately,
I'm not able to get it working.  Any assistance would
be appreciated.

Here's the code - the comments describe where the
problem lies:

public static int calculateImageHeight(int
targetWidth, Coordinate min, Coordinate max, String
crs){
		int retVal = targetWidth;
			
		try {
			GeographicCRS geoCRS =DefaultGeographicCRS.WGS84;
			DefaultEllipsoid e = (DefaultEllipsoid)
CRSUtilities.getHeadGeoEllipsoid(geoCRS);
			GeodeticCalculator calc = new
GeodeticCalculator(e);
			
			double minx = min.x;
			double miny = min.y;
			double maxx = max.x;
			double maxy = max.y;
			
			//Get the median
			double horz = maxy-((maxy-miny)/2d);
			//returns 0, as expected
			
			//Just to make sure the points are different
			if (minx==-180&&maxx==180)minx=-179.99999999;
			
			//The order of the Anchor and Dest
			//doesn't seem to matter - using
			//maxx for the Anchor and minx for
			//Dest returns the same value
			calc.setAnchorPoint(minx, horz);
			calc.setDestinationPoint(maxx, horz);
			
			double w_dist = calc.getOrthodromicDistance();
			//result is 0.0011131.....
			//This seems a little short
			
			//reset this before recalculating median
			minx=min.x;
			horz = maxx-((maxx-minx)/2d);
			
			calc.setAnchorPoint(horz, miny);
			calc.setDestinationPoint(horz, maxy);
			double h_dist = calc.getOrthodromicDistance();
			//returns 20003931.4586.. 
			//This seems a lot more reasonable
			
			retVal = (int)((targetWidth/w_dist)*h_dist);
		} catch (IllegalArgumentException e) {
			logger.error(e, new Throwable(e));
		} catch (IllegalStateException e) {
			logger.error(e, new Throwable(e));
		}
		
		return retVal;
	}

The only "dumb question" is the one you were too afraid to ask.
________________________________________
Check out RouteRuler - Free software for runners, cyclists, walkers, etc.
http://routeruler.sourceforge.net
________________________________________
Get a handle on your data with "pocOLAP", the "little" OLAP project
http://pocolap.sourceforge.net
________________________________________

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
Martin Desruisseaux | 14 Jan 2006 06:09

Re: GeodeticCalculator problems

todd runstein a écrit :
> I'm using GeodeticCalculator to calculate the
> difference between the "x"s and "y"s.  Unfortunately,
> I'm not able to get it working.  Any assistance would
> be appreciated.

> GeographicCRS geoCRS = DefaultGeographicCRS.WGS84;
> DefaultEllipsoid e = (DefaultEllipsoid) CRSUtilities.getHeadGeoEllipsoid(geoCRS);
> GeodeticCalculator calc = new GeodeticCalculator(e);

Note 1: If you know that you want the WGS84 ellipsoid in all cases, you 
can just use the default constructor:

   GeodeticCalculator calc = new GeodeticCalculator();

Note 2: if you use one of latest Geotools snapshot (I'm not sure since 
which milestone), you can write:

   CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84;
   GeodeticCalculator calc = new GeodeticCalculator(crs);

where 'crs' doesn't need to be geographic; GeodeticCalculator will 
performs the needed transformations on the fly if you use 
'setFooPosition' methods.

The code you sent seems correct. What are the coordinates values tested?

	Martin.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
todd runstein | 14 Jan 2006 06:31
Picon
Favicon

Re: GeodeticCalculator problems

Thanks for the code tips!  I'm sticking with EPSG:4326
because it's available on every WMS service I'm
interested in (at least so far) - it seemed an easy
shortcut to limit the calculation for now.  I
appreciate the more concise approach - thank you!

The code works fine in most cases but fails if I use
-180:-90 & 180:90.  Any ideas?

--- Martin Desruisseaux
<martin.desruisseaux@...> wrote:

> todd runstein a écrit :
> > I'm using GeodeticCalculator to calculate the
> > difference between the "x"s and "y"s. 
> Unfortunately,
> > I'm not able to get it working.  Any assistance
> would
> > be appreciated.
> 
> 
> > GeographicCRS geoCRS = DefaultGeographicCRS.WGS84;
> > DefaultEllipsoid e = (DefaultEllipsoid)
> CRSUtilities.getHeadGeoEllipsoid(geoCRS);
> > GeodeticCalculator calc = new
> GeodeticCalculator(e);
> 
> Note 1: If you know that you want the WGS84
> ellipsoid in all cases, you 
> can just use the default constructor:
> 
>    GeodeticCalculator calc = new
> GeodeticCalculator();
> 
> Note 2: if you use one of latest Geotools snapshot
> (I'm not sure since 
> which milestone), you can write:
> 
>    CoordinateReferenceSystem crs =
> DefaultGeographicCRS.WGS84;
>    GeodeticCalculator calc = new
> GeodeticCalculator(crs);
> 
> where 'crs' doesn't need to be geographic;
> GeodeticCalculator will 
> performs the needed transformations on the fly if
> you use 
> 'setFooPosition' methods.
> 
> The code you sent seems correct. What are the
> coordinates values tested?
> 
> 	Martin.
> 
> 
>
-------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do
> you grep through log files
> for problems?  Stop!  Download the new AJAX search
> engine that makes
> searching your log files as easy as surfing the 
> web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@...
>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> 

The only "dumb question" is the one you were too afraid to ask.
________________________________________
Check out RouteRuler - Free software for runners, cyclists, walkers, etc.
http://routeruler.sourceforge.net
________________________________________
Get a handle on your data with "pocOLAP", the "little" OLAP project
http://pocolap.sourceforge.net
________________________________________

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

Gmane