Hi All,
Think I'm just completely overlooking something here. I'm attempting to get the closest street to a point for an address and gathering the individual components of the name for the address point.
Here's what I'm attempting to use for the code. It was telling me that I needed another curly brace, checked them all, they all matched up. Now it says that the else is a reserved word on the second else on line 37. Any help is appreciated.
Lorinda
var fsn = $feature.FullStreetName;
var streetLayer = FeatureSetByName($datastore, "server.dbo.StreetCenterline");
var pre = $feature.PreDirection;
var sn = $feature.StreetName;
var st = $feature.StreetType;
var post = $feature.PostDirection;
var searchDistance = 150;
var streetIntersect = Intersects(streetLayer, Buffer($feature, searchDistance, "feet"));
var cnt = Count(streetIntersect);
var minDistance = Infinity;
if (cnt > 0) {
for (var street in streetIntersect) {
var dist = Distance(street, $feature, "feet");
if (dist < minDistance) {
var stparse = {
attributes: {
pre: ["streetLayer.PreDirection"],
sn: ["streetLayer.StreetName"],
st: ["streetLayer.StreetType"],
post: ["streetLayer.PostDirection"],
fsn: ["streetLayer.FullStreetName"],
minDistance: dist
}
}
} else {
var stparse = {
attributes: {
pre: "",
sn: "",
st: "",
post: "",
fsn: ""
}
}
}
} else {
// pass no features found within search distance, name remains null
var stparse = {
attributes: {
pre: "",
sn: "",
st: "",
post: "",
fsn: ""
}
}
}
}
return stparse;