Simple OSM layer

225 views
Skip to first unread message

Thomas Becker

unread,
Sep 11, 2014, 11:01:20 AM9/11/14
to geoext-vi...@googlegroups.com
Hi,

I am just starting with Heron by going through the examples. I worked with OpenLayers already a bit bit before and thought it will be a piece of cake to get a OSM layer shown. However,
a simple 
Heron.options.map.layers = [
   
new OpenLayers.Layer.OSM(),
   
new OpenLayers.Layer.WMS("World Cities (OpenGeo)",
{layers: "cities", transparent: true, format: "image/png"},
{singleTile: true, opacity: 0.9, isBaseLayer: false, visibility: false, noLegend: false, featureInfoFormat: "application/vnd.ogc.gml", transitionEffect: "resize"})
];
comes back with tons of error for the OSM tiles of sort "Failed to load resource: The requested URL was not found on this server.", and all the other layers specified within the Heron.options.map.layers array are greyed out in the table of content.

When I look at the example of http://lib.heron-mc.org/heron/1.0.3/examples/googlemaps/index.html then it works absolutely fine there and OSM is just loaded the way I did it.
Can one of you help me out here?

Cheers Thomas

Just van den Broecke

unread,
Sep 11, 2014, 12:38:45 PM9/11/14
to geoext-vi...@googlegroups.com
Hi Thomas,

Hard to tell from the config snippet. If you send us your complete Heron
config or via pastebin it will be easier to analyse what is going wrong.
best, Just
On 11-09-14 17:01, Thomas Becker wrote:
> Hi,
>
> I am just starting with Heron by going through the examples. I worked
> with OpenLayers already a bit bit before and thought it will be a piece
> of cake to get a OSM layer shown. However,
> a simple
> |
> Heron.options.map.layers =[
> newOpenLayers.Layer.OSM(),
> newOpenLayers.Layer.WMS("World Cities (OpenGeo)",
> |
> "http://suite.opengeo.org/geoserver/ows?",
> {layers: "cities", transparent: true, format: "image/png"},
> {singleTile: true, opacity: 0.9, isBaseLayer: false, visibility: false,
> noLegend: false, featureInfoFormat: "application/vnd.ogc.gml",
> transitionEffect: "resize"})
> ];
> comes back with tons of error for the OSM tiles of sort "Failed to load
> resource: The requested URL was not found on this server.", and all the
> other layers specified within the Heron.options.map.layers array are
> greyed out in the table of content.
>
> When I look at the example
> of http://lib.heron-mc.org/heron/1.0.3/examples/googlemaps/index.html
> then it works absolutely fine there and OSM is just loaded the way I did it.
> Can one of you help me out here?
>
> Cheers Thomas
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "geoext-viewer-devel" group.
> To post to this group, send email to
> geoext-vi...@googlegroups.com
> To unsubscribe from this group, send email to
> geoext-viewer-d...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/geoext-viewer-devel?hl=en
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Heron Mapping Client Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to geoext-viewer-d...@googlegroups.com
> <mailto:geoext-viewer-d...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Thomas Becker

unread,
Sep 11, 2014, 1:28:21 PM9/11/14
to geoext-vi...@googlegroups.com, jus...@gmail.com
Hi Just,

thanks for the fast reply.
Here is the html file: http://pastebin.com/EpfuYr2G, the config file: http://pastebin.com/chYHmE1e, and the Layout file: http://pastebin.com/ELREA5a0

Bests, Thomas

Just van den Broecke

unread,
Sep 11, 2014, 3:48:42 PM9/11/14
to Thomas Becker, geoext-vi...@googlegroups.com
Hi Thomas,

Thanks for the clear info on pastebin.

Your map settings are incorrect. Google Maps and OSM use "Google
Projection", EPSG:900913 and a displayProjection EPSG:4326. Yes this is
confusing but at least OSM and Google are alike in this. Like in the
original Heron example, the settings should be:

Heron.options.map.settings =
{
projection: 'EPSG:900913',
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: 'm',
maxExtent: '-20037508.34, -20037508.34, 20037508.34, 20037508.34',
center: '594576, 6831611',
maxResolution: 'auto',
xy_precision: 5,
zoom: 6,
theme: null
};

Your Options.js shows:

Heron.options.map.settings = {
projection: 'EPSG:4326',
units: 'dd',
// reolutions: [860.160, 430.080, 215.040, 107.520, 53.760,
26.880, 13.440, 6.720, 3.360, 1.680, 0.840, 0.420, 0.210, 0.105, 0.0525],
maxExtent: '-180.0, -90.0, 180.0, 90.0',
// center: '155000, 463000',
xy_precision: 3,
max_features: 10,
zoom: 1,
theme: null
};

Think/hope this will help, best,

Just

Thomas Becker

unread,
Sep 12, 2014, 3:59:05 AM9/12/14
to geoext-vi...@googlegroups.com, tb0...@gmail.com, jus...@gmail.com
Hi Just,

thanks again for your reply. I posted some earlier state of the code on paste bin... sorry about that. Of course I changed the projection and added a displayProjection to the settings. Except of the maxResolution I altered all the settings according to the code in the example. Now I adjusted again, including the maxResolution. However, that doesn't change the outcome. I thought there might be some overlays interfering with the projection or the units and I reduced the layers to only the OSM layer. The outcome is that the OSM layer is active in the TOC but the OSM tiles can't be found (Failed to load resource: The requested URL was not found on this server.). As soon as I add one or more layers into this setting, all layers in the code, subsequent to the OSM layer will be out of reach for the user. They are greyed out and only the initial settings made in the code (visibility, etc.) are applied - no user interaction possible.

I attached a screenshot to illustrate the issue.

Bests, Thomas
Screen Shot 2014-09-12 at 09.57.31.png

Just van den Broecke

unread,
Sep 12, 2014, 6:33:44 AM9/12/14
to Thomas Becker, geoext-vi...@googlegroups.com
Hi Thomas,

Still hard to tell without more context. If you provide your entire
config like earlier that will help. Do you run your app from a
webserver? Does the standard Heron example with Google Maps+OSM work in
your environment? "Failed to load resource:": what URL is it trying to
fetch? best, Just

Thomas Becker

unread,
Sep 12, 2014, 6:50:56 AM9/12/14
to geoext-vi...@googlegroups.com, tb0...@gmail.com, jus...@gmail.com
Hi Just,

You can find the current config file at: http://pastebin.com/7CNeQkUY.
I copied the config file from the example http://lib.heron-mc.org/heron/1.0.3/examples/googlemaps/index.html and only the Google layers work. OSM does not load and by looking at the referenced source that seems reasonable. All tiles should be loaded from file://c.tile.openstreetmap.org/6/32/21.png, where the leading character ('c') and the trailing numbers differ.

The application runs locally in a MAMP environment. MAMP combines Apache, MySQL and PHP. The whole thing I run on OS X. All JS frameworks are located in the htdocs directory within the MAMP structure.

Bests, Thomas

Just van den Broecke

unread,
Sep 12, 2014, 1:23:38 PM9/12/14
to Thomas Becker, geoext-vi...@googlegroups.com
Hi Thomas,

Indeed strange, this could be something in your server setup or local
network, proxy maybe. I can run the example even without a server by
just loading index.html directly in the browser. The URLs alternate
normally between http://[a-c].tile.openstreetmap.org/z/x/y.png with
z,x,y the tilenum.
Why http:// is replaced by file:// is a mystery.

You could try to hardcode the tile base url as follows:

new OpenLayers.Layer.OSM("OSM Forced",
"http://a.tile.openstreetmap.org/${z}/${x}/${y}.png")

But I suspect that that will also redirect to file://.

Also on OSX, I use as well, you don't need the MAMP environment, Apache
is already built-in and configured in /etc/apache2. best,

Just
Reply all
Reply to author
Forward
0 new messages