/***************************************************************************** * * This file is part of Mapnik (c++ mapping toolkit) * * Copyright (C) 2014 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ // mapnik #include #include #include // boost #include namespace mapnik { static const char * well_known_srs_strings[] = { "mapnik-longlat", "mapnik-gmerc", "" }; boost::optional is_well_known_srs(std::string const& srs) { if (srs == "+init=epsg:4326" || srs == MAPNIK_LONGLAT_PROJ) { return boost::optional(mapnik::WGS_84); } else if (srs == "+init=epsg:3857" || srs == MAPNIK_GMERC_PROJ) { return boost::optional(mapnik::G_MERC); } return boost::optional(); } boost::optional is_known_geographic(std::string const& srs) { std::string trimmed = util::trim_copy(srs); if (trimmed == "+init=epsg:3857") { return boost::optional(false); } else if (trimmed == "+init=epsg:4326") { return boost::optional(true); } else if (srs.find("+proj=") != std::string::npos) { if ((srs.find("+proj=longlat") != std::string::npos) || (srs.find("+proj=latlong") != std::string::npos) || (srs.find("+proj=lonlat") != std::string::npos) || (srs.find("+proj=latlon") != std::string::npos) ) { return boost::optional(true); } else { return boost::optional(false); } } return boost::optional(); } IMPLEMENT_ENUM( well_known_srs_e, well_known_srs_strings ) }