[OpenLayers-Users] error in url

Gery . gamejihou at hotmail.com
Thu Aug 23 14:34:51 PDT 2012


In my pc, through python, mod_wsgi, sqlalchemy as well as proxy.cgi script in /var/www/cgi-bin/ dir with localhost in AllowedHosts, I'm doing queries in my postgis database. With this code I want to retrieve data in geojson format and then displayed it in openlayers:

protocol: new OpenLayers.Protocol.HTTP(
                {
                        url: '/cgi-bin/proxy.cgi?url=http://localhost/mop/py/test3.py',
                        format: new OpenLayers.Format.GeoJSON()
                }
                ),

in firebug, I'm getting the query (as well as if I write in firefox http://localhost/mop/py/test3.py) and this error message:

JSON.parse: unexpected characterobject = JSON.parse(json, filter);
what does this mean? my idea at first was to get into my postgis database through a model, which is:

from sqlalchemy import *
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import *
from sqlalchemy.orm import mapper, relation, backref, sessionmaker
from sqlalchemy.ext.declarative import declarative_base

# Setup the url, database engine and session
url = 'postgresql+psycopg2://postgres:pass at localhost:5432/mop'
engine = create_engine(url, echo=True)
Session = sessionmaker(bind=engine)
session = Session()

# Setup the declarative extension and metadata
metadata = MetaData(engine)
Base = declarative_base(metadata=metadata)

# Define the model classes
class Boreholes(Base):
        __tablename__ = 'boreholes_point_wgs84'
        __table_args__ = {'autoload':True}

# DDL Extensions for geometry specific DDL
GeometryDDL(Boreholes.__table__)

but pointing that url doesn't work, I think I need something in between that will allow me to display the info in my postgis database and then through openlayers extract the data as geojson to plot it in my map.

Any hint is appreciated,

Regards,

Gery



 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120823/7f9d300a/attachment.html>


More information about the Users mailing list