Here is the issue I am having:
I want to get the extent of a layer in EPSG:4326 that I am overlaying on
top of a google maps (EPSG:900913) base layer. However, When I do this,
it returns the extent as being the entire map. This is because I have
points all across the U.S. even Alaska. Google map's projection is
spherical and therefore you can scroll inifitely. This means that a point
in Alaska that is in my layer means that the extent reaches across the
entire map back to the same point in Alaska.
This is confusing but I hope someone has run into the same problem. A
solution I have explored is getting the extent of the layer before it is
projected to google's EPSG:900913 and then converting those bounds (from
EPSG:4326 to EPSG:900913 ). This actually works, but getting this extent
and then recreating the same layer and projecting it seems like a long
work around. anyone else have any ideas?
below is the code I have. I have calculated the correct extent, but the
problem now is that my layer is not projected, so it does not show up in
the right place.
var landunits = new OpenLayers.Layer.Vector("Land Units", {
styleMap: myStyles,
filter: new OpenLayers.Filter({
type:
OpenLayers.Filter.Comparison.NOT_EQUAL_TO,
property: "lat",
value: 0
}),
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: "myurl/wfs",
featureType: "lupoints",
featureNS: "blahblah"
})
//commented this out so it would not reproject so I
could retrieve the correct bounds
//projection: wfsproj
});
//this function retrieves the correct bounds and zooms to said bounds
landunits.events.on({
loadend: function() {
extent = landunits.getDataExtent();
extent = extent.transform(wfsproj,mapproj);
map.zoomToExtent(extent);
}_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users