[Openstreetmap] [PATCH] Make it easier to change the default map location
Petter Reinholdtsen
pere at hungry.com
Tue May 17 21:20:57 BST 2005
Here is a patch to make it easier to change the default map
location/scale for the server side map drawing. It is untested, as I
lack a working test environment. But I believe it should work. It
might be better to mark the default values as static values, but I
didn't do this in this draft patch.
Index: java/jsp/viewMap.jsp
===================================================================
--- java/jsp/viewMap.jsp (revision 324)
+++ java/jsp/viewMap.jsp (working copy)
@@ -14,6 +14,11 @@
String searchTerm = request.getParameter("searchTerm");
boolean bSuccessParsing = false;
+// The default map coordinates to use when no coordinate is given
+float fLonDefault = -0.14746371f;
+float fLatDefault = 51.526447f;
+float fScaleDefault = 10404.917f;
+
float fLon = 0;
float fLat = 0;
float fScale = 0;
@@ -30,7 +35,7 @@
StringTokenizer st = new StringTokenizer( searchTerm );
fLat = Float.parseFloat(st.nextToken());
fLon = Float.parseFloat(st.nextToken());
- fScale = 10404.917f;
+ fScale = fScaleDefault;
bSuccessParsing = true;
}
@@ -38,9 +43,9 @@
}
catch(Exception e)
{
- fScale = 10404.917f;
- fLat = 51.526447f;
- fLon = -0.14746371f;
+ fScale = fScaleDefault;
+ fLat = fLatDefault;
+ fLon = fLonDefault;
}
}
@@ -49,9 +54,9 @@
if(lat == null || lon == null || scale == null)
{
- fScale = 10404.917f;
- fLat = 51.526447f;
- fLon = -0.14746371f;
+ fScale = fScaleDefault;
+ fLat = fLatDefault;
+ fLon = fLonDefault;
}
else
@@ -67,9 +72,9 @@
}
catch(Exception e)
{
- fScale = 10404.917f;
- fLat = 51.526447f;
- fLon = -0.14746371f;
+ fScale = fScaleDefault;
+ fLat = fLatDefault;
+ fLon = fLonDefault;
}
More information about the talk
mailing list