Skip to content

Commit

Permalink
fix redirect to /map and .mapfile
Browse files Browse the repository at this point in the history
  • Loading branch information
TomPohys committed Jan 21, 2020
1 parent 5bdba76 commit 7586985
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,10 @@ def crs_text(id, format):

for r in code_result:
rcode = r['code']
# XXX One of the formats is a map (because /coordinates/ was redirect on /coordinates and then catch by <format>)
# make it sooner for quicker answer
if format == "map":
return redirect("/map#srs=" + rcode)
rcode = r['code']
rname = r['name'].replace("ESRI: ","").strip()
def_trans = r['code_trans']
Expand Down Expand Up @@ -1248,9 +1252,6 @@ def crs_text(id, format):
ref.SetTOWGS84(*values)
wkt = ref.ExportToWkt().decode('utf-8')

# XXX One of the formats is a map (because /coordinates/ was redirect on /coordinates and then catch by <format>)
if format == "/map":
return redirect("/map#srs=" + rcode);

ref.ImportFromWkt(wkt)
headers = {
Expand Down Expand Up @@ -1312,7 +1313,8 @@ def crs_text(id, format):
if request.args.get('download',1) == "":
headers['Content-disposition'] = "attachment; filename=%s.gml" % rcode

elif format == 'map':
#mapfile in detail.html
elif format == 'mapfile':
export = 'PROJECTION\n\t'+'\n\t'.join(['"'+l.lstrip('+')+'"' for l in ref.ExportToProj4().split()])+'\nEND' ### CSS: white-space: pre-wrap
if request.args.get('download',1) == "":
headers['Content-disposition'] = "attachment; filename=%s.map" % rcode
Expand Down
2 changes: 1 addition & 1 deletion templates/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ <h3 >Attributes</h3>

{% if 'datum' in item %}
{% if item['datum'] != 0 and item['datum'] %}
<p><span class="caption">Datum: </span><a href="/{{item['datum'][0]}}-datum/">{{item['datum'][1]}}</a></p>
<p><span class="caption">Datum: </span><a href="/{{item['datum'][0]}}-datum">{{item['datum'][1]}}</a></p>
{% endif %}
{% endif %}

Expand Down

0 comments on commit 7586985

Please sign in to comment.