Envelope Example - Java

The following shows a Java example that returns an Envelope object.


public static Envelope buildEnvelope() throws Exception
{
    Envelope envelope = new Envelope();
    envelope.setSrsName("EPSG:4326");
    //set the startPoint
    Pos pos = new Pos();
    pos.setX(-80.44);
    //pos.setX(-75.44);
    pos.setY(45.66);
    pos.setMValue(new Double(54.33));
    envelope.getPos().add(pos);

    //set the endPoint.
    Pos pos1 = new Pos();
    pos1.setX(-73.44);
    //pos1.setY(43.66);
    pos1.setY(37.66);
    pos1.setMValue(54.33);
    envelope.getPos().add(pos1);

    return envelope;
}