tobinbradley / map_widget_maker

Create at embed-able map iFrame using WMS services and leaflet.
MIT License
15 stars 8 forks source link

No layers to select #3

Open mtravis opened 11 years ago

mtravis commented 11 years ago

Hi Tobin

I thought I'd give this a go with my home set up but seem to have hit a problem as no layers show in the select box. Is wmsnamespace parameter the same thing as the name of the workspace?

I have both apache and geoserver (with a proxy) running on my localhost.

Here's my config:

{ "basemaps": { "osm": { "title": "Open Street Map", "url": "http://tile.openstreetmap.org/{z}/{x}/{y}.png", "options": { "attribution": "Open Street Map"} } }, "wmsurl": "http://localhost/geoserver/wms", "wmsnamespace": "cite", "wmsfilter": "", "attribution": "Plymouth City Council GIS", "defaultlayer": "", "center": [50.370, -4.14], "zoom": 9, "search": false }

Thanks

Matt

tobinbradley commented 11 years ago

Hey Matt,

wmsnamespace actually wasn't implemented anywhere, so you can skip that entirely (wmsfilter works :).

Did you have it on a http server that has PHP enabled? My best guess is jQuery isn't getting the WMS GetCapabilities document from wmsproxy.php. Try loading wmsproxy.php in your web browser and see if it comes up with an enormous XML document.

Apologies in advance for this stupid question, but are you proxying to GeoServer in Apache or something? By default GeoServer would be something like http://localhost:8080/geoserver.

mtravis commented 11 years ago

Hi Tobin

No such thing as a stupid question. I am indeed proxying to geoserver in apache as I was trying to bring a wfs layer into leaflet on another test I'm working on.

I am running wamp with php5 enabled. I opened the wmsproxy.php in chrome and got the follwing:

This page contains the following errors: error on line 2 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error. Checked my error logs in apache and get the following:

[Mon Jul 15 18:16:14 2013] [error] [client 127.0.0.1] PHP Notice: Undefined index: type in C:\wamp\www\map_maker\wmsproxy.php on line 9 [Mon Jul 15 18:16:14 2013] [error] [client 127.0.0.1] PHP Stack trace: [Mon Jul 15 18:16:14 2013] [error] [client 127.0.0.1] PHP 1. {main}() C:\wamp\www\map_maker\wmsproxy.php:0 [Mon Jul 15 18:16:14 2013] [error] [client 127.0.0.1] PHP Warning: file_get_contents(?service=wms&version=1.1.1&request=GetCapabilities): failed to open stream: No error in C:\wamp\www\map_maker\wmsproxy.php on line 20 [Mon Jul 15 18:16:14 2013] [error] [client 127.0.0.1] PHP Stack trace: [Mon Jul 15 18:16:14 2013] [error] [client 127.0.0.1] PHP 1. {main}() C:\wamp\www\map_maker\wmsproxy.php:0 [Mon Jul 15 18:16:14 2013] [error] [client 127.0.0.1] PHP 2. file_get_contents() C:\wamp\www\map_maker\wmsproxy.php:20 [Mon Jul 15 18:16:14 2013] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico

Cheers

Matt

On Mon, Jul 15, 2013 at 4:44 PM, Tobin Bradley notifications@github.comwrote:

Hey Matt,

wmsnamespace actually wasn't implemented anywhere, so you can skip that entirely (wmsfilter works :).

Did you have it on a http server that has PHP enabled? My best guess is jQuery isn't getting the WMS GetCapabilities document from wmsproxy.php. Try loading wmsproxy.php in your web browser and see if it comes up with an enormous XML document.

Apologies in advance for this stupid question, but are you proxying to GeoServer in Apache or something? By default GeoServer would be something like http://localhost:8080/geoserver.

— Reply to this email directly or view it on GitHubhttps://github.com/tobinbradley/map_widget_maker/issues/3#issuecomment-20978607 .

tobinbradley commented 11 years ago

It looks like wmsproxy.php is having a problem reading js/config.json for some reason. As a result it isn't getting "wmsurl" and isn't setting the path to your GetCapabilities properly. I can't imagine why that would happen. But to check and see if it's the case, make sure your GeoServer is tossing back a GetCapabilities via:

http://localhost/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities

And try to bypass the problem by making the end of wmsproxy.php like this:

$url = "http://localhost/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities"; echo file_get_contents($url);

If that works, it's definitely having a problem finding or reading js/config.json. You had valid JSON, so I imagine it's a finding it and/or permissions issue.