Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gdal overviews not working, std::bad_alloc thrown when creating too large an image #599

Closed
artemp opened this issue Oct 11, 2011 · 3 comments
Milestone

Comments

@artemp
Copy link
Member

artemp commented Oct 11, 2011

no idea what is going wrong here...

wms request which triggered it:

http://12.189.158.78:8092/?SRS=EPSG%3A4326&LAYERS=__all__&STYLES=&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=1.43333333333,41.0,2.76666666667,42.0&WIDTH=800&HEIGHT=600

huge image being created:
(see the width=7500000, height=5430000)

#!sh
#0  0x00002aaaae189265 in raise () from /lib64/libc.so.6
#1  0x00002aaaae18ad10 in abort () from /lib64/libc.so.6
#2  0x00002aaaada85cb4 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib64/libstdc++.so.6
#3  0x00002aaaada83db6 in ?? () from /usr/lib64/libstdc++.so.6
#4  0x00002aaaada83de3 in std::terminate() () from /usr/lib64/libstdc++.so.6
#5  0x00002aaaada83eca in __cxa_throw () from /usr/lib64/libstdc++.so.6
#6  0x00002aaaada841d9 in operator new(unsigned long) () from /usr/lib64/libstdc++.so.6
#7  0x00002aaaac1d8736 in mapnik::ImageData<unsigned int>::ImageData (this=0x41e00450, width=7500000, height=5430000)
    at include/mapnik/image_data.hpp:42
#8  0x00002aaaac2cb4b0 in mapnik::agg_renderer<mapnik::image_32>::process (this=0x41e00e30, sym=..., feature=..., prj_trans=...)
    at src/agg/process_raster_symbolizer.cpp:58
#9  0x00000000004703c5 in mapnik::feature_style_processor<mapnik::agg_renderer<mapnik::image_32> >::apply_to_layer(mapnik::layer const&, mapnik::agg_renderer<mapnik::image_32>&, mapnik::projection const&, double) ()
#10 0x0000000000470e93 in mapnik::feature_style_processor<mapnik::agg_renderer<mapnik::image_32> >::apply() ()
#11 0x00000000004390c5 in http::paleoserver::request_handler::handle_request(http::paleoserver::request const&, http::paleoserver::reply&, mapnik::Map) ()
#12 0x0000000000473e79 in http::paleoserver::connection::handle_read(boost::system::error_code const&, unsigned long) ()
#13 0x000000000047590f in boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::receive_op<boost::asio::mutable_buffers_1, boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::paleoserver::connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<http::paleoserver::connection> >, boost::arg<1> (*)(), boost::arg<2> (*)()> > >::do_complete(boost::asio::detail::task_io_service<boost::asio::detail::epoll_reactor>*, boost::asio::detail::task_io_service_operation<boost::asio::detail::epoll_reactor>*, boost::system::error_code, unsigned long) ()
@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[mar_rud] My quess is: You are rendering to EPSG-4326 from raster that isn't and mapnik can't reproject raster layers.

Key here are these values:

GDAL Plugin: Raster extent=box2d(373340,4613390,385840,4622440)
GDAL Plugin: View extent=box2d(373340,4613390,385840,4622440)
GDAL Plugin: Query resolution=600,600

and http://trac.mapnik.org/browser/trunk/plugins/input/gdal/gdal_featureset.cpp#L155:

153         double width_res = boost::get<0>(q.resolution());
154         double height_res = boost::get<1>(q.resolution());
155         int im_width = int(width_res * intersect.width() + 0.5);
156         int im_height = int(height_res * intersect.height() + 0.5);

so in effect output image size is:

(385840-373340)*600 = 7500000px
(4622440-4613390)*600 = 5430000px

So it's not a problem with gdal/overviews, but why query resolution is so big.

From query ("BBOX=1.43333333333,41.0,2.76666666667,42.0&WIDTH=800&HEIGHT=600"), it looks like at some point projections are mixed:[[BR]]
in EPSG-4326:(1.43333333333,41.0,2.76666666667,42.0)[[BR]]
in Raster: (373340,4613390,385840,4622440)

resolution 600 is good, but only for first one:[BR]_600 = 800px[BR]_600 = 600px[[BR]]
It should be around (0.064,0.066298) if output projection is same as raster one.

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] exactly right marcin, thanks, that must be what is happening. I thought I fixed at lease on underlying issues that could cause this but it turns out I put off fixing in trunk (#527,r1717).

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] marking as dupe of #527

@artemp artemp closed this as completed Oct 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant