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 inline
* @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], inline: Option[Boolean]) = UserAwareAction.async { implicit request =>
apiLogging(request.remoteAddress, request.identity, request.toString)

val cityMapParams: MapParams = ConfigTable.getCityMapParams
Expand Down Expand Up @@ -186,7 +187,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 = inline = inline.getOrElse(false), onClose = () => attributesJsonFile.delete()))
}
}

Expand All @@ -199,10 +200,11 @@ class ProjectSidewalkAPIController @Inject()(implicit val env: Environment[User,
* @param lng2
* @param severity
* @param filetype
* @param inline
* @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], inline: Option[Boolean]) = UserAwareAction.async { implicit request =>
apiLogging(request.remoteAddress, request.identity, request.toString)

val cityMapParams: MapParams = ConfigTable.getCityMapParams
Expand Down Expand Up @@ -247,7 +249,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 = inline.getOrElse(false), onClose = () => attributesJsonFile.delete()))
}
}

Expand Down
2 changes: 1 addition & 1 deletion conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ POST /userapi/logWebpageActivity @controllers.UserCo
PUT /userapi/setUserOrg/:orgId @controllers.UserProfileController.setUserOrg(orgId: Int)

# Access Feature and Access Score APIs
GET /v2/access/attributes @controllers.ProjectSidewalkAPIController.getAccessAttributesV2(lat1: Option[Double], lng1: Option[Double], lat2: Option[Double], lng2: Option[Double], severity: Option[String], filetype: Option[String])
GET /v2/access/attributes @controllers.ProjectSidewalkAPIController.getAccessAttributesV2(lat1: Option[Double], lng1: Option[Double], lat2: Option[Double], lng2: Option[Double], severity: Option[String], filetype: Option[String], inline: Option[Boolean] )
GET /v2/access/attributesWithLabels @controllers.ProjectSidewalkAPIController.getAccessAttributesWithLabelsV2(lat1: Option[Double], lng1: Option[Double], lat2: Option[Double], lng2: Option[Double], severity: Option[String], filetype: Option[String])
GET /v2/access/score/streets @controllers.ProjectSidewalkAPIController.getAccessScoreStreetsV2(lat1: Option[Double], lng1: Option[Double], lat2: Option[Double], lng2: Option[Double], filetype: Option[String])
GET /v2/access/score/neighborhoods @controllers.ProjectSidewalkAPIController.getAccessScoreNeighborhoodsV2(lat1: Option[Double], lng1: Option[Double], lat2: Option[Double], lng2: Option[Double], filetype: Option[String])
Expand Down
8 changes: 4 additions & 4 deletions public/javascripts/developer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ function Developer () {
$('#city-neighborhood-geojson').attr({ 'href': '/v2/access/score/neighborhoods?filetype=geojson' });

// Use parameters to fill in example URLs.
var attributesURL = `/v2/access/attributes?lat1=${data.attribute.lat1}&lng1=${data.attribute.lng1}&lat2=${data.attribute.lat2}&lng2=${data.attribute.lng2}`;
var attributesURLCSV = `/v2/access/attributes?lat1=${data.attribute.lat1}&lng1=${data.attribute.lng1}&lat2=${data.attribute.lat2}&lng2=${data.attribute.lng2}&filetype=csv`;
var attributesURLSeverity = `/v2/access/attributes?lat1=${data.attribute.lat1}&lng1=${data.attribute.lng1}&lat2=${data.attribute.lat2}&lng2=${data.attribute.lng2}&severity=3`;
var attributeWithLabelsURL = `/v2/access/attributesWithLabels?lat1=${data.attribute.lat1}&lng1=${data.attribute.lng1}&lat2=${data.attribute.lat2}&lng2=${data.attribute.lng2}`;
var attributesURL = `/v2/access/attributes?lat1=${data.attribute.lat1}&lng1=${data.attribute.lng1}&lat2=${data.attribute.lat2}&lng2=${data.attribute.lng2}&inline=true`;
var attributesURLCSV = `/v2/access/attributes?lat1=${data.attribute.lat1}&lng1=${data.attribute.lng1}&lat2=${data.attribute.lat2}&lng2=${data.attribute.lng2}&filetype=csv&inline=true`;
var attributesURLSeverity = `/v2/access/attributes?lat1=${data.attribute.lat1}&lng1=${data.attribute.lng1}&lat2=${data.attribute.lat2}&lng2=${data.attribute.lng2}&severity=3&inline=true`;
var attributeWithLabelsURL = `/v2/access/attributesWithLabels?lat1=${data.attribute.lat1}&lng1=${data.attribute.lng1}&lat2=${data.attribute.lat2}&lng2=${data.attribute.lng2}&inline=true`;

var streetsURL = `/v2/access/score/streets?lat1=${data.street.lat1}&lng1=${data.street.lng1}&lat2=${data.street.lat2}&lng2=${data.street.lng2}`;
var streetsURLCSV = `/v2/access/score/streets?lat1=${data.street.lat1}&lng1=${data.street.lng1}&lat2=${data.street.lat2}&lng2=${data.street.lng2}&filetype=csv`;
Expand Down