<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Yes, you should be able to assign the query to the MgQueryOptions
object.<br>
<br>
I don't have a syntax sample, and the avalibility/performance would
probally depend heavily on the provider.<br>
<br>
If you have a lot of features/layers, I would probally be a perfomance
killer doing it manually.<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth, GEOGRAF A/S
</pre>
<br>
<br>
David Hequet wrote:
<blockquote cite="mid11003408.post@talk.nabble.com" type="cite">
  <pre wrap="">and about "Select Envelope(geometry) from datasource"
I can do that with ExecuteSqlQuery ?
do you have a syntaxe sample? i think i have to check if the fdoprovider has
this "SpatialExtents" capability? 
going through each object can be very slow on each map loading..


Kenneth, GEOGRAF A/S wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Yes, you have to run through each feature in the feature reader.
Then on each feature, you have to use some of the obscure 
AgfReader/Bytereader stuff to get the actual object out of the geometry 
column.
When you have the object, it has a GetEnvelope() method.

Regards, Kenneth, GEOGRAF A/S


David Hequet wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Arg, i was so close of my goal

I think i have to take a look on your idea because of MGSelection seems
to
have a limit.

here is my code:

For i = 0 To aMgLayerCollection.GetCount() - 1
    aLayer = aMgLayerCollection.GetItem(i)
    aProvider = Me._getLayerSourceType(, aLayer)
    If aProvider &lt;&gt; "Autodesk.Raster" And aProvider &lt;&gt; "DWF" Then

        aLayerClassName = aLayer.GetFeatureClassName()
        If aClassArray.IndexOf(aLayerClassName) = -1 Then
            Me._log(aLayerClassName)
            aLayerFeatureId = aLayer.GetFeatureSourceId()
            aLayerResId = New MgResourceIdentifier(aLayerFeatureId)
            aFeatureReader =
Me._featureService.SelectFeatures(aLayerResId,
aLayerClassName, aMGQueryOptions)
            aMGSelection.AddFeatures(aLayer, aFeatureReader, 0)
            aClassArray.Add(aLayerClassName)
        End If
    End If
Next i
aMgEnveloppe = aMGSelection.GetExtents(Me._featureService)
I got an error:
Une exception non classifiée s'est produite.Une exception non classifiée
s'est produite.
Une exception s'est produite dans la méthode
MgServerSelectFeatures.SelectFeatures à  la ligne 217 dans le fichier
c:\build_tux_area\mgdev\server\src\services\feature\ServerSelectFeatures.cpp
In english "non classified error"
When i use this method
aMgEnveloppe = aMGSelection.GetExtents(Me._featureService)

it didn't happen every time: 
on a map with ~30 features dispatched on 4 layers it's ok
on a map with ~1200 features on 2 layers it crash (if i try too much the
mgserver service crash).

i didn't see a getExtent method on the featurereader, i think i have to
check enveloppe for each feature in the reader?


Kenneth, GEOGRAF A/S wrote:
  
      </pre>
      <blockquote type="cite">
        <pre wrap="">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:
    
        </pre>
        <blockquote type="cite">
          <pre wrap="">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.
  
      
          </pre>
        </blockquote>
        <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


    
        </pre>
      </blockquote>
      <pre wrap="">  
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>