[mapguide-users] Getting all object Enveloppe

Kenneth, GEOGRAF A/S ks at geograf.dk
Tue Jun 5 02:54:27 EDT 2007


You don't have to use the selection part.
You can extract the object directly from the feature reader.
Once you have the object, you can also get the extent (aka bbox).
If you then construct an envelope object, you can add the features 
envelope to original envelope.

Something like:

create a new MgFeatureQueryOptions with an empty filter
create a new Envelope
For Each Layer
{
   Use a featureReader with the MgFeatureQueryOptions
   Add the feature's envelope to the outer Envelope
}
Get zoom extents from the Envelope


Other than this, I don't think you can optimize it anymore, as you need 
to execute the query on each layer.

I think there is a "Get Extents" on the feature source, but I can't find 
it. And I don't think it works on filtered datasources.

Perhaps you can execute the query with some SQL optimizations like 
"Select Envelope(geometry) from datasource".

Hope it helps.

Regards, Kenneth, GEOGRAF A/S



David Hequet wrote:
> Hello,
>
> I'm trying to make a fonction that can return me the enveloppe of the entire
> visible map (no way with original map extent).
>
> Explain: I have a map "template" with a lot of layers, i have a function
> that change all the layer filter (basic filter, no spatial) to see different
> map based on that template. Doing that make the "zoom to original extent"
> useless, because data are not on the same area.
> I wan't to set the new map extent in the MapDefinition. 
> My ask is about getting the new extent.
>
> I thought to do it like that:
>
> create a new MgSelection
> create a new MgFeatureQueryOptions with an empty filter
> For Each Layer
> {
>    Use a featureReader with the MgFeatureQueryOptions
>    Add the selected feature to the MgSelection
> }
> Getting the MgSelection enveloppe
>
> It will work, but i don't think it's very optimized with a lot of
> Layer/Feature (and it will used at each map load, filter modification..)
>
> Did someone have a better way?
>
> Thank you!
>
> Ps: sorry for my poor english, ask i you want precision.
>   


More information about the mapguide-users mailing list