[OpenLayers-Users] Clipping a vector layer before it is re-projected

Richard Marsden winwaed at gmail.com
Tue Nov 10 11:57:36 EST 2009


Hello,

I am currently trying to plot third party (ie. external website) GeoRSS or
KML data on a polar map. This is for a set of demos and articles for
GeoWebGuru.com along the lines of the recent Equal Area Map articles (demos
can be seen at http://www.equal-area-maps.com ).

I'm currently using the +sterea projection for dev, but I shall be extending
this to other polar projections.
Data is limited to the northern hemisphere. This is because some of these
projections are only valid for one hemisphere, and for the remaining
projections (eg. sterea) the opposing hemisphere is generally too distorted
for practical use.

My base map is served by WMS, and it is relatively easy to limit this to one
hemisphere because I host the data and can clip the data a priori (ie.
during my data prep).

These demos allow a user to plot external KML or GeoRSS data at run time
(implemented using OpenLayers).
That currently works well, but OpenLayers is currently plotting the entire
data for both hemispheres.
I need to clip the GeoRSS or KML data to the northern hemisphere. The
projected hemisphere is a circle. Both types of data feed use geographic
coordinates, so it is much easier to clip the data as it is read (ie. only
accept data where latitude >0deg).

How can I do this in OpenLayers?

I can't see an obvious way. I tried setting the vector layer's maxExtents -
not quite what I want, but worth a try. This didn't work.

It looks like a custom Strategy implementation might be the way to go? Are
there any examples or documentation as to how to write a custom Strategy?

At the moment I'm planning a two part article on polar projections, but if a
custom strategy is required, I could write a third article on how to do
this.

Another thought is that I could file a feature request:  To clip vector
layers to a shape (or bbox) before the vector layer is re-projected. This
could have other applications. For example, an application may wish to let a
user limit the display of input data to an area or country of interest.
Anyway, I thought I should post something first in-case this was possible
already and to avoid what could be an unnecessary feature request.


Thanks in advance,

Richard Marsden
Winwaed Software Technology LLC
http://www.winwaed.com
http://www.mapping-tools.com
http://www.geowebguru.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091110/c1b642f7/attachment.html


More information about the Users mailing list