[Cartoweb-users] using edit_filter with view for edit_table

Vid Bijelic vidb at fanweb.ca
Fri Feb 2 15:18:40 EST 2007


Hi Pierre,

Thank you for the pointer.  I have implemented the edit_filter.

In file plugins/edit/server/ServerEdit.php I added the function:

    /**
     * Gets the edit_filter from metadata
     * @return string edit_filter
     */
    protected function getFilter() {
        $editFilter = $this->getMetadataValueString($this->layer, 
'edit_filter');
        return $editFilter;

and then replaced this:
$sql = sprintf('SELECT *, astext(%s) as %s FROM %s.%s ' .
                                  'WHERE intersects (%s, ' .
                                  "SetSRID('BOX3D(%s %s, %s %s)'::box3d, 
%s))",
                                  $this->geomColumn,
                                  $this->geomColumn,
                                  $this->editSchema,
                                  $this->editTable,
                                  $this->geomColumn,
                                  $shape->minx,
                                  $shape->miny,
                                  $shape->maxx,
                                  $shape->maxy,
                                  $this->getSrid()
                                  );

with this:
$sql = sprintf('SELECT *, astext(%s) as %s FROM %s.%s ' .
                                  'WHERE intersects (%s, ' .
                                  "SetSRID('BOX3D(%s %s, %s %s)'::box3d, 
%s)) %s",
                                  $this->geomColumn,
                                  $this->geomColumn,
                                  $this->editSchema,
                                  $this->editTable,
                                  $this->geomColumn,
                                  $shape->minx,
                                  $shape->miny,
                                  $shape->maxx,
                                  $shape->maxy,
                                  $this->getSrid(),
                                  $this->getFilter()
                                  );

It is not perfect but it works.

Thanks,

Vid

Pierre GIRAUD wrote:

> Hello,
>
> I'm sorry but the "edit_filter" you probably found in the demoEdit 
> project has no effect. It is never taken into account in the edit plugin.
> This would be a great enhancement. It was considered at first and 
> proposed with this never used parameter. Though, no customer ask for 
> it, so it has not been implemented.
>
> I don't have any workaround to do this.
>
> Regards
>
> Pierre
>
>
> Vid Bijelic wrote:



More information about the Cartoweb-users mailing list