[FeatureServer] GeoAlchemy, what is the trick?

Gery . gamejihou at hotmail.com
Tue Dec 4 01:31:00 PST 2012


Hello,

I'm using GeoAlchemy with FeatureServer, but I'm new using both, so sorry for the very simple questions. This is my model (boreholes.model) for one of my PostGis tables:

*****************************
print "Content-type: text/html\n\n";

from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.dialects.postgresql import *
from geoalchemy import *
from geoalchemy.postgis import *

engine = create_engine('postgresql://postgres:pass@localhost:5432/map', echo=False)
metadata = MetaData(engine)

session = sessionmaker(bind=engine)()

boreholes_table = Table('boreholes_point_wgs84', metadata,
                        Column('id', SMALLINT, primary_key=True),
                        Column('fid', SMALLINT),
                        Column('longitude', DOUBLE_PRECISION),
                        Column('latitude', DOUBLE_PRECISION),
                        Column('w_depth_m', DOUBLE_PRECISION),
                        Column('station', VARCHAR(150)),
                        Column('type', VARCHAR(150)),
                        Column('survey', VARCHAR(150)),
                        Column('source', VARCHAR(150)),
                        Column('max_pen_m', VARCHAR(150)),
                        Column('core_rec_m', VARCHAR(150)),
                        Column('t_g_ckm1', VARCHAR(150)),
                        Column('h_f_mwm2', VARCHAR(150)),
                        Column('comments', TEXT),
                        GeometryExtensionColumn('geom', Geometry(3)))

class Boreholes(object):
    def __init__ (self, id, fid, longitude, latitude, w_depth_m, station, type, survey, source, max_pen_m, core_rec_m, t_g_ckm1, h_f_mwm2, comments):
        self.id = id
        self.fid = fid
        self.longitude = longitude
        self.latitude = latitude
        self.w_depth_m = w_depth_m
        self.station = station
        self.type = type
        self.survey = survey
        self.source = source
        self.max_pen_m = max_pen_m
        self.core_rec_m = core_rec_m
        self.t_g_ckm1 = t_g_ckm1
        self.h_f_mwm2 = h_f_mwm2
        self.comments = comments

mapper(Boreholes, boreholes_table,
       properties={
                 'geom': GeometryColumn(boreholes_table.c.geom,
                                        comparator=PGComparator)
                  })

GeometryDDL(boreholes_table)

*****************************

and this is what I have in my featureserver.cfg:

*****************************
[boreholes]
type=GeoAlchemy
dburi=postgresql://postgres:pass@localhost:5432/map
model=../model/boreholes.model
cls=boreholes_point_wgs84
fid=id
geometry=geom
*****************************

so what I want is to query this table and output that in GeoJSON format. I'm doing the query in OpenLayers using GeoExt like this:

*****************************
var searchformPanel = new GeoExt.form.FormPanel(
        {
            width: 250,
            bodyStyle: 'padding:5px',
            labelAlign: 'top',
            defaults:
            {
                anchor: '100%'
            },
            protocol: new OpenLayers.Protocol.HTTP(
            {
                url: 'http://www.mop.org/fs/boreholes?format=GeoJSON',
                format: new OpenLayers.Format.GeoJSON(
                {
                    ignoreExtraDims: true,
                    'internalProjection': new OpenLayers.Projection("EPSG:900913"),
                    'externalProjection': new OpenLayers.Projection("EPSG:4326")
                }
                )
            }
            ),
            items:
            [
            {
                xtype: 'textfield',
                name: 'station__like',
                fieldLabel: 'Enter a word',
                allowBlank: false
            }
            ],
...
...
*****************************

by the way, this PostGis table is served by MarServer as WMS, but I think this has nothing to do with the query. So, to do this query I'm sure I need something else related to GeoAlchemy and featureserver itself but not sure what it is, I'd be grateful for some support on this, thanks in advance for any help.

Best regards,

Gery
 
__________________________________________________________________________________________
Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es necesario.
Think green - keep it on the screen. Do NOT print if it is NOT necessary.
Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie NICHT, wenn es NICHT notwendig ist.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/featureserver/attachments/20121204/57a80ea5/attachment-0001.html>


More information about the FeatureServer mailing list