phpDocumentor SMap
Layers
[ class tree: SMap ] [ index: SMap ] [ all elements ]

Class: SMap_Layer_OGR

Source Location: /SMap/Layer.php

Class SMap_Layer_OGR

Class Overview

An OGR readable vector file

Render a set of layers out of a OGR compatable file using the OGR library with the php_ogr binding.

For more information on the ogr library, see http://www.gdal.org/ogr/ . For information on php_ogr, see http://dl.maptools.org/dl/php_ogr/ .

To render a shapefile in any reasonable timeframe via OGR, you must index it. I've been indexing it via this command:

ogr2ogr -update -sql 'CREATE SPATIAL INDEX ON admin_polyg' admin_polyg admin_polyg

replace 'admin_polyg' with the layer name you're working with.

Located in /SMap/Layer.php [line 316]

SMap_Layer
   |
   --SMap_Layer_OGR

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From SMap_Layer

SMap_Layer::$id
SMap_Layer::$map

Inherited From SMap_Layer

SMap_Layer::__construct()
Construct the layer
SMap_Layer::cacheStatus()
How cachable is this layer?
SMap_Layer::getAdjViewBounds()
Adjust the view coords if we are in an image
SMap_Layer::getID()
Returns the ID of this layer
SMap_Layer::getImageFmt()
Recommended format for this layer
SMap_Layer::getImgObjs()
Composite this layer onto the tile (in a raster way)
SMap_Layer::getMap()
Return the map that contains this layer
SMap_Layer::getMapObjs()
Composite this layer onto the tile
SMap_Layer::hasCachedRects()
Might have cached rects in the DB
SMap_Layer::isValidZoom()
Is this layer zoomed to a useful resolution?
SMap_Layer::pxOffBound()
Get the bound at a pixel offset from a bound.

[ Top ]
Property Summary
mixed   $driver   OGR Driver
mixed   $ds   OGR Data source
mixed   $dsFn   OGR Data source file name
mixed   $layers   OGR Layers
mixed   $queries   SQL queries

[ Top ]
Method Summary
SMap_Layer_OGR   __construct()   Construct the layer
void   __destruct()   Destroy OGR data source
void   addFiles()   Add a set of files as a datasource
void   appendLayerByName()   Appends a layer by name
void   appendLayerBySQL()   Appends a layer by SQL
void   createObjects()   Get the objects to be rendered
resource   createSFilter()   Make the spatial filter
void   dsOpen()   Open the datasource
void   fetchLayer()   Create and append a set of objects from the given layer
integer   fetchLineString()   Create a line string
integer   fetchMultiPolygon()   Create a multi-polygon
integer   fetchPolygon()   Create a polygon
array   getImgObjs()   Draw the vector file into objects
array   getMapObjs()   Objects for the image map

[ Top ]
Properties
mixed   $driver = null [line 344]

OGR Driver

API Tags:
Access:  protected


[ Top ]
mixed   $ds = null [line 330]

OGR Data source

API Tags:
Access:  protected


[ Top ]
mixed   $dsFn = null [line 337]

OGR Data source file name

API Tags:
Access:  protected


[ Top ]
mixed   $layers = array() [line 351]

OGR Layers

API Tags:
Access:  protected


[ Top ]
mixed   $queries = array() [line 358]

SQL queries

API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 368]

  SMap_Layer_OGR __construct( SMap $map, integer $id  )

Construct the layer

Each layer should have a unique ID

Parameters:
object   $map: 
integer   $id:  This layer's ID


Redefinition of:
SMap_Layer::__construct()
Construct the layer

[ Top ]
Destructor __destruct  [line 700]

  void __destruct( )

Destroy OGR data source



[ Top ]
addFiles  [line 390]

  void addFiles( array $files  )

Add a set of files as a datasource

The array is integer indicies and string file names. The files are organized such that each index is the maximum zoom level which the datasource should be applied at.

If you save different resolutions of your vector files you can prevent the drawing of too much or too little detail as needed.

Parameters:
array   $files:  List of files and zoom levels


[ Top ]
appendLayerByName  [line 422]

  void appendLayerByName( string $layerName  )

Appends a layer by name

Parameters:
string   $layerName:  Layer name


[ Top ]
appendLayerBySQL  [line 445]

  void appendLayerBySQL( string $sql  )

Appends a layer by SQL

Actually just queues the SQL statement until the actual objects are requested in order to implement spatial filtering.

Parameters:
string   $sql:  SQL


[ Top ]
createObjects  [line 480]

  void createObjects( SMap_View $view, array $B, integer $adjX, integer $adjY, array &$objs  )

Get the objects to be rendered

Parameters:
object The   $view:  view
array   $B:  Tile bounds
integer   $adjX:  Bounds moved in X dir
integer   $adjY:  Bonuds moved in Y dir
array   &$objs:  Dump objects here

API Tags:
Access:  protected


[ Top ]
createSFilter  [line 454]

  resource createSFilter( $B, $adjX, $adjY  )

Make the spatial filter

Parameters:
   $B: 
   $adjX: 
   $adjY: 

API Tags:
Return:  OGR geometry
Access:  protected


[ Top ]
dsOpen  [line 404]

  void dsOpen( )

Open the datasource


API Tags:
Access:  protected


[ Top ]
fetchLayer  [line 526]

  void fetchLayer( SMap_View $view, array $layer, array $adjX, $adjY, &$objs  )

Create and append a set of objects from the given layer

Parameters:
object The   $view:  SMap view
array   $layer:  The layer and assoc info
array   $adjX:  Append created objects here
   $adjY: 
   &$objs: 

API Tags:
Access:  protected


[ Top ]
fetchLineString  [line 587]

  integer fetchLineString( SMap_View $view, resource $geom, float $adjX, float $adjY, array &$objs  )

Create a line string

Parameters:
object View   $view:  we are drawing for
resource   $geom:  OGR geometry
float   $adjX:  Adjust the line
float   $adjY:  Adjust the line
array   &$objs:  Place created objects here

API Tags:
Return:  OGR error code
Access:  protected


[ Top ]
fetchMultiPolygon  [line 634]

  integer fetchMultiPolygon( SMap_View $view, $geom, $adjX, $adjY, &$objs  )

Create a multi-polygon

Parameters:
resource   $view:  OGR geometry
   $geom: 
   $adjX: 
   $adjY: 
   &$objs: 

API Tags:
Return:  OGR error code
Access:  protected


[ Top ]
fetchPolygon  [line 614]

  integer fetchPolygon( SMap_View $view, $geom, $adjX, $adjY, &$objs  )

Create a polygon

Parameters:
resource   $view:  OGR geometry
   $geom: 
   $adjX: 
   $adjY: 
   &$objs: 

API Tags:
Return:  OGR error code
Access:  protected


[ Top ]
getImgObjs  [line 669]

  array getImgObjs( SMap_View $view, SMap_Tile $tile  )

Draw the vector file into objects

Parameters:
object   $view: 
object   $tile: 

API Tags:
Access:  public


Redefinition of:
SMap_Layer::getImgObjs()
Composite this layer onto the tile (in a raster way)

[ Top ]
getMapObjs  [line 658]

  array getMapObjs( SMap_View $view, SMap_Tile $tile  )

Objects for the image map

By default, there are none.

Parameters:
object   $view: 
object   $tile: 

API Tags:
Access:  public


Redefinition of:
SMap_Layer::getMapObjs()
Composite this layer onto the tile

[ Top ]

Documentation generated on Mon, 09 Apr 2007 18:53:19 -0500 by phpDocumentor 1.3.0