upgrade default projection of epsg:4326 to match exactly what proj4 stores in /usr/local/share/epsg for 4326 (aka WGS84)

This commit is contained in:
Dane Springmeyer 2010-08-10 18:18:31 +00:00
parent 5297d9bba0
commit 6cce96dd06
19 changed files with 64 additions and 59 deletions

View file

@ -14,6 +14,11 @@ For a complete change history, see the SVN log.
Mapnik Trunk
------------
- Upgraded to the latest proj4 string literal for EPSG:4326 (WGS84) as global default projection (#333)
- Added 'mapnik_version_from_string()' function in python bindings to easily convert string representation
of version number to the integer format used in 'mapnik/version.hpp'. e.g. '0.7.1' --> 701.
- Added 'mapnik_version_from_string()' function in python bindings to easily convert string representation
of version number to the integer format used in 'mapnik/version.hpp'. e.g. '0.7.1' --> 701.

View file

@ -128,11 +128,11 @@ void export_layer()
"\n"
"The srs can be either a Proj.4 epsg code ('+init=epsg:<code>') or\n"
"of a Proj.4 literal ('+proj=<literal>').\n"
"If no srs is specified it will default to '+proj=latlong +datum=WGS84'\n"
"If no srs is specified it will default to '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
"\n"
"Usage:\n"
">>> from mapnik import Layer\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr\n"
"<mapnik._mapnik.Layer object at 0x6a270>\n"
))
@ -146,7 +146,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import Layer\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.envelope()\n"
"box2d(-1.0,-1.0,0.0,0.0) # default until a datasource is loaded\n"
)
@ -163,7 +163,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import Layer\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.visible(1.0/1000000)\n"
"True\n"
">>> lyr.active = False\n"
@ -178,7 +178,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import Layer\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.abstract\n"
"'' # default is en empty string\n"
">>> lyr.abstract = 'My Shapefile rendered with Mapnik'\n"
@ -193,7 +193,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import Layer\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.active\n"
"True # Active by default\n"
">>> lyr.active = False # set False to disable layer rendering\n"
@ -217,7 +217,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import Layer, Datasource\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.datasource = Datasource(type='shape',file='world_borders')\n"
">>> lyr.datasource\n"
"<mapnik.Datasource object at 0x65470>\n"
@ -230,7 +230,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import Layer\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.maxzoom\n"
"1.7976931348623157e+308 # default is the numerical maximum\n"
">>> lyr.maxzoom = 1.0/1000000\n"
@ -245,7 +245,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import Layer\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.minzoom # default is 0\n"
"0.0\n"
">>> lyr.minzoom = 1.0/1000000\n"
@ -260,7 +260,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import Layer\n"
">>> lyr = Layer('My Layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = Layer('My Layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.name\n"
"'My Layer'\n"
">>> lyr.name = 'New Name'\n"
@ -275,7 +275,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import layer\n"
">>> lyr = layer('My layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.queryable\n"
"False # Not queryable by default\n"
">>> lyr.queryable = True\n"
@ -290,9 +290,9 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import layer\n"
">>> lyr = layer('My layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.srs\n"
"'+proj=latlong +datum=WGS84' # The default srs if not initialized with custom srs\n"
"'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' # The default srs if not initialized with custom srs\n"
">>> # set to google mercator with Proj.4 literal\n"
"... \n"
">>> lyr.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over'\n"
@ -304,7 +304,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import layer\n"
">>> lyr = layer('My layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.styles\n"
"<mapnik._mapnik.Names object at 0x6d3e8>\n"
">>> len(lyr.styles)\n"
@ -323,7 +323,7 @@ void export_layer()
"\n"
"Usage:\n"
">>> from mapnik import layer\n"
">>> lyr = layer('My layer','+proj=latlong +datum=WGS84')\n"
">>> lyr = layer('My layer','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
">>> lyr.title\n"
"''\n"
">>> lyr.title = 'My first layer'\n"

View file

@ -150,7 +150,7 @@ void export_map()
"Create a Map with a width and height as integers and, optionally,\n"
"an srs string either with a Proj.4 epsg code ('+init=epsg:<code>')\n"
"or with a Proj.4 literal ('+proj=<literal>').\n"
"If no srs is specified the map will default to '+proj=latlong +datum=WGS84'\n"
"If no srs is specified the map will default to '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
"\n"
"Usage:\n"
">>> from mapnik import Map\n"
@ -158,7 +158,7 @@ void export_map()
">>> m\n"
"<mapnik._mapnik.Map object at 0x6a240>\n"
">>> m.srs\n"
"'+proj=latlong +datum=WGS84'\n"
"'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
))
.def_pickle(map_pickle_suite()
@ -419,7 +419,7 @@ void export_map()
"Spatial reference in Proj.4 format.\n"
"Either an epsg code or proj literal.\n"
"For example, a proj literal:\n"
"\t'+proj=latlong +datum=WGS84'\n"
"\t'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
"and a proj epsg code:\n"
"\t'+init=epsg:4326'\n"
"\n"
@ -428,7 +428,7 @@ void export_map()
"\n"
"Usage:\n"
">>> m.srs\n"
"'+proj=latlong +datum=WGS84' # The default srs if not initialized with custom srs\n"
"'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' # The default srs if not initialized with custom srs\n"
">>> # set to google mercator with Proj.4 literal\n"
"... \n"
">>> m.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over'\n"

View file

@ -508,7 +508,7 @@ BOOST_PYTHON_MODULE(_mapnik2)
">>> m = Map(256,256)\n"
">>> load_map(m,'mapfile_wgs84.xml')\n"
">>> m.srs\n"
"'+proj=latlong +datum=WGS84'\n"
"'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
">>> m.srs = '+init=espg:3395'\n"
">>> save_map(m,'mapfile_mercator.xml')\n"
"\n"

View file

@ -27,7 +27,7 @@ except:
installed successfully before running this script.\n\n'
raise
m = Map(690,690,"+proj=latlong +ellps=WGS84")
m = Map(690,690,"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
m.background = Color(255,100,100,255)

View file

@ -27,7 +27,7 @@ except:
installed successfully before running this script.\n\n'
raise
m = Map(690,690,"+proj=latlong +ellps=WGS84")
m = Map(690,690,"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
m.background = Color(255,100,100,255)

View file

@ -27,7 +27,7 @@ except:
installed successfully before running this script.\n\n'
raise
m = Map(690,690,"+proj=latlong +ellps=WGS84")
m = Map(690,690,"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
m.background = Color(255,100,100,255)

View file

@ -27,7 +27,7 @@ except:
installed successfully before running this script.\n\n'
raise
m = Map(690,690,"+proj=latlong +ellps=WGS84")
m = Map(690,690,"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
m.background = Color(255,100,100,255)

View file

@ -39,12 +39,12 @@ namespace mapnik
* Create a layer with a named string and, optionally, an srs string either
* with a Proj.4 epsg code ('+init=epsg:<code>') or with a Proj.4 literal
* ('+proj=<literal>'). If no srs is specified it will default to
* '+proj=latlong +datum=WGS84'
* '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
*/
class MAPNIK_DECL layer
{
public:
explicit layer(std::string const& name, std::string const& srs="+proj=latlong +datum=WGS84");
explicit layer(std::string const& name, std::string const& srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
layer(layer const& l);
layer& operator=(layer const& l);
bool operator==(layer const& other) const;

View file

@ -95,7 +95,7 @@ public:
* Creates a map with these parameters:
* - width = 400
* - height = 400
* - projection = "+proj=latlong +datum=WGS84"
* - projection = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
*/
Map();
@ -104,7 +104,7 @@ public:
* @param height Initial map height.
* @param srs Initial map projection.
*/
Map(int width, int height, std::string const& srs="+proj=latlong +datum=WGS84");
Map(int width, int height, std::string const& srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
/*! \brief Copy Constructur.
*

View file

@ -47,8 +47,8 @@ public:
private:
projection const& source_;
projection const& dest_;
bool is_source_latlong_;
bool is_dest_latlong_;
bool is_source_longlat_;
bool is_dest_longlat_;
bool is_source_equal_dest_;
};
}

View file

@ -41,7 +41,7 @@ kismet_featureset::kismet_featureset(const std::list<kismet_network_data> &knd_l
tr_(new transcoder(encoding)),
feature_id (0),
knd_list_it(knd_list_.begin ()),
source_("+proj=latlong +datum=WGS84")
source_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
{
//cout << "kismet_featureset::kismet_featureset()" << endl;
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map bgcolor="#b5d0d0" srs="+proj=latlong +datum=WGS84">
<Map bgcolor="#b5d0d0" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="coast-poly">
<Rule>
@ -481,7 +481,7 @@
</Rule>
</Style>
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="roads" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>roads-casing</StyleName>
<StyleName>footway</StyleName>
<StyleName>cycleway</StyleName>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map bgcolor="#d0d0d0" srs="+proj=latlong +datum=WGS84">
<Map bgcolor="#d0d0d0" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="amenity">
<Rule>
<Filter>[amenity]='pub'</Filter>
@ -466,7 +466,7 @@
</Rule>
</Style>
<Layer name="leisure" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="leisure" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>leisure</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
@ -474,7 +474,7 @@
</Datasource>
</Layer>
<Layer name="waterway" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="waterway" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>river</StyleName>
<StyleName>stream</StyleName>
<Datasource>
@ -483,7 +483,7 @@
</Datasource>
</Layer>
<Layer name="lakes" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="lakes" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>lakes</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
@ -491,7 +491,7 @@
</Datasource>
</Layer>
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="roads" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>roads-casing</StyleName>
<StyleName>footway</StyleName>
<StyleName>cycleway</StyleName>
@ -510,7 +510,7 @@
</Datasource>
</Layer>
<Layer name="amenity" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="amenity" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>amenity</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
@ -518,7 +518,7 @@
</Datasource>
</Layer>
<Layer name="roadstext" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="roadstext" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>roads-text</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
@ -526,7 +526,7 @@
</Datasource>
</Layer>
<Layer name="text" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="text" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>text</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map bgcolor="#d0d0d0" srs="+proj=latlong +datum=WGS84">
<Map bgcolor="#d0d0d0" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="amenity">
<Rule>
<Filter>[amenity]='pub'</Filter>
@ -466,14 +466,14 @@
</Rule>
</Style>
<Layer name="leisure" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="leisure" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>leisure</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="waterway" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="waterway" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>river</StyleName>
<StyleName>stream</StyleName>
<Datasource>
@ -481,14 +481,14 @@
</Datasource>
</Layer>
<Layer name="lakes" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="lakes" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>lakes</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="roads" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>roads-casing</StyleName>
<StyleName>footway</StyleName>
<StyleName>cycleway</StyleName>
@ -506,21 +506,21 @@
</Datasource>
</Layer>
<Layer name="amenity" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="amenity" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>amenity</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="roadstext" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="roadstext" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>roads-text</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="text" status="on" srs="+proj=latlong +datum=WGS84">
<Layer name="text" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>text</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>

View file

@ -63,7 +63,7 @@ IMPLEMENT_ENUM( aspect_fix_mode_e, aspect_fix_mode_strings );
Map::Map()
: width_(400),
height_(400),
srs_("+proj=latlong +datum=WGS84"),
srs_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"),
buffer_size_(0),
aspectFixMode_(GROW_BBOX) {}

View file

@ -91,7 +91,7 @@ metawriter_json_stream::~metawriter_json_stream()
metawriter_json_stream::metawriter_json_stream(metawriter_properties dflt_properties)
: metawriter(dflt_properties), count_(-1), only_nonempty_(true),
trans_(0), output_srs_("+proj=latlong +datum=WGS84"), f_(0)
trans_(0), output_srs_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"), f_(0)
{
}

View file

@ -35,8 +35,8 @@ proj_transform::proj_transform(projection const& source,
: source_(source),
dest_(dest)
{
is_source_latlong_ = source_.is_geographic();
is_dest_latlong_ = dest_.is_geographic();
is_source_longlat_ = source_.is_geographic();
is_dest_longlat_ = dest_.is_geographic();
is_source_equal_dest_ = (source_ == dest_);
}
@ -50,7 +50,7 @@ bool proj_transform::forward (double & x, double & y , double & z) const
if (is_source_equal_dest_)
return true;
if (is_source_latlong_)
if (is_source_longlat_)
{
x *= DEG_TO_RAD;
y *= DEG_TO_RAD;
@ -66,7 +66,7 @@ bool proj_transform::forward (double & x, double & y , double & z) const
return false;
}
if (is_dest_latlong_)
if (is_dest_longlat_)
{
x *= RAD_TO_DEG;
y *= RAD_TO_DEG;
@ -80,7 +80,7 @@ bool proj_transform::backward (double & x, double & y , double & z) const
if (is_source_equal_dest_)
return true;
if (is_dest_latlong_)
if (is_dest_longlat_)
{
x *= DEG_TO_RAD;
y *= DEG_TO_RAD;
@ -96,7 +96,7 @@ bool proj_transform::backward (double & x, double & y , double & z) const
return false;
}
if (is_source_latlong_)
if (is_source_longlat_)
{
x *= RAD_TO_DEG;
y *= RAD_TO_DEG;

View file

@ -245,7 +245,7 @@ def test_map_init():
eq_(m.width, 256)
eq_(m.height, 256)
eq_(m.srs, '+proj=latlong +datum=WGS84')
eq_(m.srs, '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
m = mapnik2.Map(256, 256, '+proj=latlong')
@ -255,7 +255,7 @@ def test_map_init():
# Map initialization from string
def test_map_init_from_string():
map_string = '''<Map bgcolor="steelblue" srs="+proj=latlong +datum=WGS84">
map_string = '''<Map bgcolor="steelblue" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="My Style">
<Rule>
<PolygonSymbolizer>