This is how QGIS writes the proj-string and WKT with +towgs84-parameter:
+proj=longlat +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7 +no_defs
GEOGCS["DHDN",DATUM["Deutsches_Hauptdreiecksnetz",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],TOWGS84[598.1,73.7,418.2,0.202,0.045,-2.455,6.7],AUTHORITY["EPSG","6314"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4314"]]
But keep in mind that there is no overall value for converting any Bessel-1841-Data to WGS84.
For Germany, there were a lot of parametres published, until a NADgrid for the whole country was created. This applies the correct shift for every point inside Germany.
Other surveying authorities have done similar conversions, but with other values.
EDIT
There is a forum entry in Russian http://gis-lab.info/forum/viewtopic.php?t=9386
giving the following proj parameters:
+proj=tmerc +lat_0=55.6666666667 +lon_0=37.5 +x_0=0 +y_0=0 +k_0=1. +a=6377397 +rf=299.15 +towgs84=396,165,557.7,-0.05,0.04,0.01,0 +no_defs
Maybe you get lucky with those values.
This is less of a Leaflet issue than a CartoDB one. In your code you are adding a CartoDB layer to your Leaflet map, then interacting with CartoDB to filter the features the layer shows.
The short answer is: you need to ask CartoDB for the bounds. Leaflet doesn't know much about the CartoDB layer, especially when it comes to the features CartoDB is showing.
The longer answer is:
Get the bounds from CartoDB. There are a few ways to do this, but the easiest is likely to use sql.getBounds()
. This will looks something like:
var sql = new cartodb.SQL({ user: 'tbushman' });
sql.getBounds(YOUR_QUERY).done(function(bounds) {
// TODO Set Leaflet's bounds here
});
Where YOUR_QUERY
is whatever SQL query you used to filter your layer. For example, looking in your code, one of them is:
SELECT * FROM full_uu_tb WHERE type = 'Health and Ability'
Now set your Leaflet map's bounds (on the TODO
line above). This should be as simple as what you already have in the code above:
map.fitBounds(bounds);
Get rid of most of the bounds-handling code you have above, everything between (but not including) $(this).addClass('selected');
and LayerActions[$(this).attr('id')] ();
Finally, the LayerActions
object in your full code is a nice way of separating the various SQL queries from the rest of the code. The only problem is that it is a bit redundant and you're going to need to get the actual SQL query in order to get the bounds. I would recommend storing only the SQL queries this way and moving the rest into $('.button').click(...)
.
Best Answer
You have several mistakes in your code:
You are using a factory method as a constructor. Instead of
var foo = new L.featureGroup()
, usevar foo = L.featureGroup()
orvar foo = new L.FeatureGroup()
. Note lowercase/uppercase! Leaflet coding style favours using factory methods (lowercase, nonew
).layer
is not defined, so you cannot assignlayer.boundary_geom
.Your polygon coordinates have repeated coordinates. In practice this means that your polygon only has two vertices.
The polygon coordinates are very close, only a few meters apart. When fitting to bounds, the map will hit
maxZoom
, and your polygon will appear to be just one point.Once these are taken care of, a demo map looks just fine, in both Leaflet 0.7.x and 1.0.0-beta.