Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3437 geo json api file download #3454

Merged
merged 7 commits into from
Jan 23, 2024
10 changes: 6 additions & 4 deletions app/controllers/ProjectSidewalkAPIController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ class ProjectSidewalkAPIController @Inject()(implicit val env: Environment[User,
* @param lng2
* @param severity
* @param filetype
* @param inlineCheck
misaugstad marked this conversation as resolved.
Show resolved Hide resolved
* @return
*/
def getAccessAttributesWithLabelsV2(lat1: Option[Double], lng1: Option[Double], lat2: Option[Double], lng2: Option[Double],
severity: Option[String], filetype: Option[String]) = UserAwareAction.async { implicit request =>
severity: Option[String], filetype: Option[String], inlineCheck: Boolean = false) = UserAwareAction.async { implicit request =>
apiLogging(request.remoteAddress, request.identity, request.toString)

val cityMapParams: MapParams = ConfigTable.getCityMapParams
Expand Down Expand Up @@ -185,7 +186,7 @@ class ProjectSidewalkAPIController @Inject()(implicit val env: Environment[User,
writer.print("]}")
writer.close()

Future.successful(Ok.sendFile(content = attributesJsonFile, inline = true, onClose = () => attributesJsonFile.delete()))
Future.successful(Ok.sendFile(content = attributesJsonFile, inline = inlineCheck, onClose = () => attributesJsonFile.delete()))
}
}

Expand All @@ -198,10 +199,11 @@ class ProjectSidewalkAPIController @Inject()(implicit val env: Environment[User,
* @param lng2
* @param severity
* @param filetype
* @param inlineCheck
* @return
*/
def getAccessAttributesV2(lat1: Option[Double], lng1: Option[Double], lat2: Option[Double], lng2: Option[Double],
severity: Option[String], filetype: Option[String]) = UserAwareAction.async { implicit request =>
severity: Option[String], filetype: Option[String], inlineCheck: Boolean = false) = UserAwareAction.async { implicit request =>
apiLogging(request.remoteAddress, request.identity, request.toString)

val cityMapParams: MapParams = ConfigTable.getCityMapParams
Expand Down Expand Up @@ -246,7 +248,7 @@ class ProjectSidewalkAPIController @Inject()(implicit val env: Environment[User,
writer.print("]}")
writer.close()

Future.successful(Ok.sendFile(content = attributesJsonFile, inline = true, onClose = () => attributesJsonFile.delete()))
Future.successful(Ok.sendFile(content = attributesJsonFile, inline = inlineCheck, onClose = () => attributesJsonFile.delete()))
}
}

Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/developer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ function Developer () {
// Assign URLs to download buttons to get citywide data.
$('#city-attributes-csv').attr({ 'href': '/v2/access/attributes?filetype=csv' });
$('#city-attributes-shapefile').attr({ 'href': '/v2/access/attributes?filetype=shapefile' });
$('#city-attributes-geojson').attr({ 'href': '/v2/access/attributes?filetype=geojson' });
$('#city-attributes-geojson').attr({ 'href': '/v2/access/attributes?filetype=geojson&inlineCheck=true' });

$('#city-attributes-label-csv').attr({ 'href': '/v2/access/attributesWithLabels?filetype=csv' });
$('#city-attributes-label-shapefile').attr({ 'href': '/v2/access/attributesWithLabels?filetype=shapefile' });
$('#city-attributes-label-geojson').attr({ 'href': '/v2/access/attributesWithLabels?filetype=geojson' });
$('#city-attributes-label-geojson').attr({ 'href': '/v2/access/attributesWithLabels?filetype=geojson&inlineCheck=true' });

$('#city-streets-csv').attr({ 'href': '/v2/access/score/streets?filetype=csv' });
$('#city-streets-shapefile').attr({ 'href': '/v2/access/score/streets?filetype=shapefile' });
Expand Down