Skip to content

Commit

Permalink
#276 remove lowreskml, use entry.kml
Browse files Browse the repository at this point in the history
  • Loading branch information
webgisdeveloper committed Apr 12, 2023
1 parent 485cd33 commit b960f3c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
11 changes: 4 additions & 7 deletions frontend/src/components/UAVSAR.vue
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,6 @@ export default {
}
//Now handle the selected entry
if(!entry.extended) {
console.log("entry", entry.hasAlternateColoring);
console.log("vm.geoserverChecked", vm.geoserverChecked);
console.log("vm.hasAlternateColoring:",vm.hasAlternateColoring);
console.log("vm.hasHighresOverlay:",vm.hasHighresOverlay)
this.extendingActive = true;
if(this.plotActive){
this.getCSV(entry, [this.plottingMarkerEnd.getLatLng().lat, this.plottingMarkerEnd.getLatLng().lng,
Expand Down Expand Up @@ -585,9 +581,9 @@ export default {
vm.hasAlternateColoring = true; }
if (Object.prototype.hasOwnProperty.call(datajson, 'hasHighresOverlay')) {
vm.hasHighresOverlay = true; }
if (Object.prototype.hasOwnProperty.call(datajson, 'lowreskml')) {
vm.lowResKML = datajson['lowreskml'];}
// if (Object.prototype.hasOwnProperty.call(datajson, 'lowreskml')) {
// vm.lowResKML = datajson['lowreskml'];}
console.log(entry);
if (vm.alternateColoringChecked) {
vm.layerFound = true;
vm.extendedColor = '#CCFFCC'
Expand Down Expand Up @@ -649,6 +645,7 @@ export default {
})
} else {
const parser = new DOMParser();
this.lowResKML = entry.kml;
const kml = parser.parseFromString(this.lowResKML, 'text/xml');
const track = new L.KML(kml,{'ignorePlacemark':true});
this.uavsarHighResLayer = track;
Expand Down
25 changes: 13 additions & 12 deletions geogateway_django_app/GeoGatewayData.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,30 +175,32 @@ def uavsarTest(request):
geoserver_response = requests.get(wmsColorUrl + testURI + layername)
data = geoserver_response.json()
checkdict = {'layer':layername}

if "layerDescriptions" in data:
checkdict['hasAlternateColoring'] = 1

# test if it has highres layer
geoserver_response = requests.get(wmsUrl + testURI + layername)
data = geoserver_response.json()
if "layerDescriptions" in data:
checkdict['hasHighresOverlay'] = 1
else:
# get lowres kml
baseURI = 'https://data.geo-gateway.org/kmz/'
dataname = request.GET.get('dataname')
postfix = 'uid' + uid + '/' + dataname + '.unw.kml'
kmldata = requests.get(baseURI + postfix)
toRep = '<href>https://data.geo-gateway.org/kmz/' + 'uid' + uid + '/'
respData = kmldata.content.replace('<href>'.encode(), toRep.encode()).decode("utf-8")
checkdict['lowreskml'] = respData
# it seems no need for lowres kml
# entry.kml already has lowres kml
# else:
# # get lowres kml
# baseURI = 'https://data.geo-gateway.org/kmz/'
# dataname = request.GET.get('dataname')
# postfix = 'uid' + uid + '/' + dataname + '.unw.kml'
# kmldata = requests.get(baseURI + postfix)
# toRep = '<href>https://data.geo-gateway.org/kmz/' + 'uid' + uid + '/'
# respData = kmldata.content.replace('<href>'.encode(), toRep.encode()).decode("utf-8")
# checkdict['lowreskml'] = respData
return HttpResponse(json.dumps(checkdict))


def uavsarKML(request):
if request.method == 'GET':

#baseURI = 'http://gf2.ucs.indiana.edu/kmz/'
baseURI = 'https://data.geo-gateway.org/kmz/'

raw = request.GET.get('json')
Expand All @@ -209,7 +211,6 @@ def uavsarKML(request):

uid = query['uid']

#toRep = '<href>http://gf2.ucs.indiana.edu/kmz/' + 'uid' + uid + '/'
toRep = '<href>https://data.geo-gateway.org/kmz/' + 'uid' + uid + '/'

respData = data.content.replace('<href>'.encode(), toRep.encode()).decode("utf-8")
Expand Down

0 comments on commit b960f3c

Please sign in to comment.