Dane,

I included the shebang line in there because it wouldn't interpret
otherwise. As for running this app as WSGI...I am doing that, I just browse
to the cgi-bin directory and then kick it off it by typing "python wms.py".
I get the "Welcome to OGC WMS Server" message. Note that what I typed is not
actually what it says, but it is working.

I did install mod_python and mod_wsgi and as it turns out, the standalone
wsgi script worked the best of all three so I will leave it at that. You're
right about the osm layer! I was trying to debug using OpenLayers and I
probably had that in there as an artifact as another script I was testing. I
will replace that with "__all__" and see what happens.

I am pretty sure I grabbed the code from bitbucket like you recommended but
I will definitely check it again tomorrow. I started with a brand new VM
today just in case I jacked something up on my laptop. I don't recall which
version I grabbed but it's possible that I just used the version of
ogcserver that came with Mapnik. Again, I have used the code from bitbucket
but I have to check my current config one more time for sanity sake.

I do use easy_install for Windows (http://pypi.python.org/pypi/setuptools)
which does a pretty good job of installing the python libraries and
dependencies I need. I know now to grab lxml and scons from there along with
anything else I need to build/configure the application. I know everything
is working when I do an "import mapnik" and then "from mapnik import
Projections" like the documentation suggests. Everything appears to be
working fine.

So it sounds like I can try my luck with setting Layers="__all__" in
OpenLayers which might fix the parsing errors I appear to be having. Let me
ask you this...is adding the osm.xml file the intended behavior here? I've
been able to use TileLite to generate a tile cache from the same XML file
which makes me believe that OGCServer is supposed read the file to produce
the WMS.  I feel like I am 90% there...just need some fine tuning.

I will report back tomorrow morning! Thanks again for lending a hand to
someone who's never used Python to serve anything over the web ;-)

Adam Estrada

On Mon, Mar 22, 2010 at 9:37 PM, Dane Springmeyer <[email protected]>wrote:

>
>
> --- \o/ ---
> Sent from my phone
>
> On Mar 22, 2010, at 1:04 PM, Adam Estrada <[email protected]> wrote:
>
> All,
>
> I am having the damnedest time getting OGCServer up and running on my
> Windows server.
>
>
> Maybe then get things running on Linux first?
>
> Here's what I've got so far.
>
> *cgi-bin/wms.py*
>
> #!/usr/bin/env python -u
>
>
> That shebang line can't work on windows can it?
>
> import sys
> from mapnik.ogcserver.wsgi import WSGIApp
> # from mapnik.ogcserver.modserver import ModHandler
> sys.path.append('C:/Program Files (x86)/Apache/cgi-bin')
>
> # application = ModHandler('C:/Program Files
> (x86)/Apache/cgi-bin/ogcserver.conf')
> application = WSGIApp('C:/Program Files
> (x86)/Apache/cgi-bin/ogcserver.conf')
>
> if __name__ == '__main__':
>     from wsgiref.simple_server import make_server
>     httpd = make_server('localhost', 8000, application)
>     print "Listening on port 8000...."
>     httpd.serve_forever()
>
> *cgi-bin/map_factory.py*
>
> #!/usr/bin/env python -u
>
> from mapnik.ogcserver.WMS import BaseWMSFactory
>
> class WMSFactory(BaseWMSFactory):
>   def __init__(self):
>     BaseWMSFactory.__init__(self)
>     self.loadXML('C:/Program Files (x86)/Apache/cgi-bin/osm.xml')
>     self.finalize()
>
>
> Normally you would only put your 'wms.py' script in the cgi-bin, not
> anything else. Also you'd only put 'wms.py' in cgi bin if it were actually
> being deployed as cgi. In this case it looks like you are embedding in
> apache through mod_wsgi or _mod_python so you can just put it in any web
> accessible directory and point mod_wsgi/mod_python at it.
>
>
> *cgi-bin/ogcserver.conf*
>
> # module:  The module containing the MapFactory class.  See the readme for
> #          details.
> # This would be the name of the map_factory file (without extension .py)
>
> module=map_factory
>
> There is a lot more in the .conf file but you get the idea...
>
> My goal here is to serve up my own OSM tiles using ogcserver but when I
> view the data in OpenLayers 
> (<http://localhost:8000/?LAYERS=osm&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=90,0,180,90&WIDTH=256&HEIGHT=256>
> http://localhost:8000/?LAYERS=osm&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=90,0,180,90&WIDTH=256&HEIGHT=256)
> I get the following error in my XML response.
>
>
> What is that 'osm' layer? How is that going to work? The layers list must
> correspond to the layer names in the XML file or be set to __all__ to
> request them all as one map.
>
> Put debug=true in your config to get HTML error response. Might help since
>  your ol request is asking for image error which is odd if your are getting
> an XML parsing error as per below.
>
>
> XML Parsing Error: no element found Location:
> moz-nullprincipal:{7c4d5cef-42fc-4fe8-a12e-82b7e6256b36} Line Number 1,
> Column 1:
>
>
> Very odd, that one.
>
> In QGIS, I am able to pass in the url ( <http://localhost:8000>
> http://localhost:8000) which gives me the entire list of the OSM data (via
> GetCapabilities) I have stored in Postgres/PostGIS.When I finalize the WMS
> setup in QGIS, I get an error with no values at all so it's hard to debug in
> that environment.
>
>
> Run the server as wsgi standalone and you can see the request coming in.
> Grab it and paste into a browser. To learn more.
>
> I am also able to get the Capabilities list from my mini-WMS in ArcGIS, but
> not data is being returned. Can anyone suggest what I may be doing wrong
> here? I am using the latest and greatest version of everything so I really
> don't know what might be messing up.
>
>
> Capabilies depend on lxml being installed. Also I'd recommend using the
> ogcserver code from bitbucket that I told you about earlier as a variety of
> subtle things are fixed in terms of capabilities compatability with ESRI
> clients.
>
> Thanks in advance,
> Adam
>
>
>
>
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users
>
>
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to