fix editstops js
This commit is contained in:
parent
427fdb99a3
commit
d406a81561
|
@ -39,6 +39,7 @@ var API_BASE = "/1.0/",
|
|||
$('.list').click(function(e) {
|
||||
var name = $(this).attr("id").replace("sList", ""); //FIXME: stick name in a data attr or so?
|
||||
var $target = $(e.target).parent();
|
||||
//console.log($target);
|
||||
if (!$target.hasClass('listItem')) {
|
||||
return;
|
||||
}
|
||||
|
@ -75,10 +76,12 @@ var API_BASE = "/1.0/",
|
|||
$('#stopForm').remove();
|
||||
$('#formCol').empty();
|
||||
$.getJSON(url, {'srid': 3857}, function(obj) {
|
||||
//console.log("here", $target);
|
||||
$loading.remove();
|
||||
var stopsGeojson = obj.stops;
|
||||
var stops = stopsGeojson.features;
|
||||
var $stopsList = getStopsList(stops);
|
||||
//console.log($stopsList);
|
||||
var stopsWithGeom = [];
|
||||
$.each(stops, function(i,v) {
|
||||
if (!$.isEmptyObject(v.geometry)) {
|
||||
|
@ -89,11 +92,16 @@ var API_BASE = "/1.0/",
|
|||
stopsGeojson.features = stopsWithGeom;
|
||||
var currFeatures = jsonLayer.features;
|
||||
jsonLayer.removeFeatures(currFeatures);
|
||||
console.log(stopsWithGeom);
|
||||
if (stopsWithGeom.length !== 0) {
|
||||
jsonLayer.addFeatures(geojson_format.read(stopsGeojson));
|
||||
var maxExtent = jsonLayer.getDataExtent();
|
||||
map.zoomToExtent(maxExtent);
|
||||
//What you see here with the setTimeout is a sign of having given up - PLEASE PLEASE make this go away - you should not need to do this - but apparently there is some error being raised by map.zoomToExtent() ALTHOUGH it seems to be doing the right thing and calling it in a setTimeout makes the other code work alright. But it causes me to sleep a little less soundly at night. Please HELP.
|
||||
setTimeout(function() {
|
||||
map.zoomToExtent(maxExtent);
|
||||
}, 50);
|
||||
}
|
||||
//console.log("whoosh", $target);
|
||||
$target.append($stopsList);
|
||||
// $target.data("hasList", true);
|
||||
$target.data("loading", false);
|
||||
|
@ -315,7 +323,7 @@ var API_BASE = "/1.0/",
|
|||
var permalink = new OpenLayers.Control.Permalink({base: "http://www.openstreetmap.org/"});
|
||||
map.addControl(permalink);
|
||||
$(".olControlPermalink a").attr("target","_blank").html("View in OSM");
|
||||
alert('Not here');
|
||||
//alert('Not here');
|
||||
}
|
||||
|
||||
function onFeatureSelect(e) {
|
||||
|
|
28
patches/postgis-adapter-2.patch
Normal file
28
patches/postgis-adapter-2.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
--- django/contrib/gis/db/backends/postgis/adapter.py.orig 2011-09-09 11:51:27.769648151 +0100
|
||||
+++ django/contrib/gis/db/backends/postgis/adapter.py 2011-09-12 14:09:51.733962708 +0100
|
||||
@@ -12,6 +12,7 @@
|
||||
# the adaptor) and the SRID from the geometry.
|
||||
self.ewkb = str(geom.ewkb)
|
||||
self.srid = geom.srid
|
||||
+ self._adapter = Binary(self.ewkb)
|
||||
|
||||
def __conform__(self, proto):
|
||||
# Does the given protocol conform to what Psycopg2 expects?
|
||||
@@ -26,10 +27,15 @@
|
||||
def __str__(self):
|
||||
return self.getquoted()
|
||||
|
||||
+ def prepare(self, conn):
|
||||
+ # Pass the connection to the adapter: this allows escaping the binary
|
||||
+ # in the style required by the server's standard_conforming_string setting.
|
||||
+ self._adapter.prepare(conn)
|
||||
+
|
||||
def getquoted(self):
|
||||
"Returns a properly quoted string for use in PostgreSQL/PostGIS."
|
||||
- # Want to use WKB, so wrap with psycopg2 Binary() to quote properly.
|
||||
- return 'ST_GeomFromEWKB(E%s)' % Binary(self.ewkb)
|
||||
+ # psycopg will figure out whether to use E'\\000' or '\000'
|
||||
+ return 'ST_GeomFromEWKB(%s)' % self._adapter.getquoted()
|
||||
|
||||
def prepare_database_save(self, unused):
|
||||
return self
|
Loading…
Reference in New Issue
Block a user