dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20339
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9239: FRED-API: switched to using [lng, lat] instead of [lat, lng]
------------------------------------------------------------
revno: 9239
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-12-09 15:27:00 +0300
message:
FRED-API: switched to using [lng, lat] instead of [lat, lng]
modified:
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToFacilityConverter.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToOrganisationUnitConverter.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm
dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToFacilityConverter.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToFacilityConverter.java 2012-12-08 20:35:51 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToFacilityConverter.java 2012-12-09 12:27:00 +0000
@@ -63,8 +63,8 @@
{
GeoUtils.Coordinates coordinates = GeoUtils.parseCoordinates( organisationUnit.getCoordinates() );
+ facility.getCoordinates().add( coordinates.lng );
facility.getCoordinates().add( coordinates.lat );
- facility.getCoordinates().add( coordinates.lng );
}
if ( organisationUnit.getParent() != null )
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToOrganisationUnitConverter.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToOrganisationUnitConverter.java 2012-12-08 20:35:51 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/utils/ToOrganisationUnitConverter.java 2012-12-09 12:27:00 +0000
@@ -46,11 +46,11 @@
public class ToOrganisationUnitConverter implements Converter<Facility, OrganisationUnit>
{
@Autowired
- @Qualifier( "org.hisp.dhis.organisationunit.OrganisationUnitService" )
+ @Qualifier("org.hisp.dhis.organisationunit.OrganisationUnitService")
private OrganisationUnitService organisationUnitService;
@Autowired
- @Qualifier( "org.hisp.dhis.dataset.DataSetService" )
+ @Qualifier("org.hisp.dhis.dataset.DataSetService")
private DataSetService dataSetService;
@Override
@@ -86,8 +86,7 @@
organisationUnit.setFeatureType( OrganisationUnit.FEATURETYPE_POINT );
- GeoUtils.Coordinates coordinates = GeoUtils.parseCoordinates(
- facility.getCoordinates().toString(), GeoUtils.CoordinateOrder.COORDINATE_LATLNG );
+ GeoUtils.Coordinates coordinates = GeoUtils.parseCoordinates( facility.getCoordinates().toString() );
organisationUnit.setCoordinates( String.format( "[%f, %f]", coordinates.lng, coordinates.lat ) );
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm 2012-12-09 09:26:56 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facilities.vm 2012-12-09 12:27:00 +0000
@@ -36,12 +36,12 @@
$.each(facilities, function (idx, item) {
if (item.coordinates !== undefined && JSON.parse(item.coordinates).length > 0) {
var coords = JSON.parse(item.coordinates);
- var latlng = new google.maps.LatLng(coords[0], coords[1]);
+ var latlng = new google.maps.LatLng(coords[1], coords[0]);
var name = item.name;
var id = item.id;
- lats += coords[0];
- lngs += coords[1];
+ lats += coords[1];
+ lngs += coords[0];
n += 1;
var marker = new google.maps.Marker({
@@ -52,7 +52,7 @@
markers.push(marker);
var infoWindow= new google.maps.InfoWindow({
- content: "<div>" + "<b>" + name + "</b><br/>" + coords[0] + "<br/>" + coords[1] +
+ content: "<div>" + "<b>" + name + "</b><br/>Latitude " + coords[1] + "<br/> Longitude " + coords[0] +
"<br/><br/><a href='$baseUrl/facilities/" + id + "'>More information</a></div>"
});
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm 2012-12-08 16:49:44 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/webapp/WEB-INF/api-fred-velocity/v1/facility.vm 2012-12-09 12:27:00 +0000
@@ -2,7 +2,7 @@
<script>
function updateMap(coordinates) {
- var latlng = new google.maps.LatLng(coordinates[0], coordinates[1]);
+ var latlng = new google.maps.LatLng(coordinates[1], coordinates[0]);
var options = {
zoom: 12,
@@ -23,8 +23,8 @@
var coordinates = JSON.parse("$entity.coordinates");
if (coordinates.length > 0) {
- $('#facilityLatitude').val(coordinates[0]);
- $('#facilityLongitude').val(coordinates[1]);
+ $('#facilityLatitude').val(coordinates[1]);
+ $('#facilityLongitude').val(coordinates[0]);
updateMap(coordinates);
} else {
@@ -47,7 +47,7 @@
var lat = $('#facilityLatitude').val();
var lng = $('#facilityLongitude').val();
- data.coordinates = [ lat, lng ];
+ data.coordinates = [ lng, lat ];
$.ajax({
url: '$baseUrl/facilities/${entity.id}',
@@ -57,7 +57,7 @@
dataType: 'json'
}).success(function (data) {
console.log("save success!", data);
- updateMap([lat, lng]);
+ updateMap([lng, lat]);
$('#facilitySubmit').removeAttr('disabled').text('Save');
}).error(function (data) {
console.log("could not update!", data);