14.01.2013 Views

Developer's Guide - MapGuide Open Source - OSGeo

Developer's Guide - MapGuide Open Source - OSGeo

Developer's Guide - MapGuide Open Source - OSGeo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example<br />

$queryOptions = new MgFeatureQueryOptions();<br />

$queryOptions->SetFilter("RTYPE = 'MFG'");<br />

$queryOptions->SetSpatialFilter('SHPGEOM', $bufferGeometry,<br />

MgFeatureSpatialOperations::Inside);<br />

$featureResId = new MgResourceIdentifier(<br />

"Library://Samples/Sheboygan/Data/Parcels.Feature<strong>Source</strong>");<br />

$featureReader = $featureService->SelectFeatures($featureResId,<br />

"Parcels", $queryOptions);<br />

This example builds on the example from Working With the Active Selection<br />

(page 46). Instead of listing the parcels in the selection, it creates a series of<br />

concentric buffers around the selection, showing increasing distance. The<br />

code sections below contain the significant additions in this example. The<br />

complete source code is available with the Developer’s <strong>Guide</strong> samples.<br />

Because this example modifies the map, it must refresh the map when it loads,<br />

by executing a JavaScript function. Add the function to the page.<br />

<br />

function OnPageLoad()<br />

{<br />

parent.parent.Refresh();<br />

}<br />

<br />

Add an OnLoad command to the element:<br />

<br />

The example uses a temporary map layer named Buffer to store the buffer<br />

feature. It creates a feature source and the layer if it does not exist. Otherwise,<br />

it deletes any existing features before creating the new buffer. The functions<br />

CreateBufferFeature<strong>Source</strong>() and CreateBufferLayer() are in<br />

bufferfunctions.php, which is described below.<br />

Example | 81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!