0

I have an app whereby users select parcels of land based on shapefile information. How can I return the associated street polyline location (lat, long)? I want to be able to locate the center of the street and its extents in front of this parcel. Refer to the image below the parcel is in blue and the street polyline I am interested in is in red.

If I could be pointed towards which Esri javascript method or class I could use then I can figure out the rest

enter image description here

3
  • There's no magic method that's gonna do this for you. The shapefile just tells you where that polygon goes on the map. It doesn't contain any information about the streets around it, does it? You'd likely need a dataset that describes the streets. and then you can do some comparison. Or you can try to use some of the google search apis, as discussed in Google Maps API - Getting Street Coordinates Commented Aug 4, 2022 at 1:53
  • You may also find some direction in the question How to get all roads around a given location in OpenStreetMap?, which discusses how to get roads surrounding a point from overpass turbo. In any case, you're gonna need some help from an external, geo-location search-based api to know the GeoJSON of the streets around your given locations Commented Aug 4, 2022 at 1:55
  • Oh wow thanks for the advice. Overpass turbo is awesome! @SethLutske Commented Aug 5, 2022 at 4:38

1 Answer 1

2

Assuming that you have a Road FeatureLayer, what you could do is to spatial query it using the parcel geometry. In order to do that you can use queryFeatures method. You can add a buffer distance in order to get the roads that are around the parcel. Something like this,

let query = roadsFeatureLayer.createQuery();
query.geometry = parcelGeometry;  // the parcel polygon geometry
query.distance = 10;
query.units = "meters";
query.spatialRelationship = "intersects";
query.returnGeometry = true;
query.outFields = ["*"];

roadsFeatureLayer.queryFeatures(query)
.then(function(response){
  // returns a feature set with the roads features that
  // intersect the 10 meters buffered parcel polygon geometry
});

Now, the result includes a set of roads. The decision of wich one you need, is another problem like @seth-lutske mention in the comments.

ArcGIS JS API - FeatureLayer queryFeatures

2
  • If I then have my lat and lngs for the street polyline as a latlng Object is there a way with the ArcGIS javascript API to draw a line from the polyline to a nearby latlng object (parcel coords in this case) IF parcel coords intersect perpendicular to this street polyline? So in other words if lines where drawn out from the street in a perpendicular fashion will they intersect the points inside the LatLng Object that is the parcel? @SethLutske as well Commented Aug 5, 2022 at 4:47
  • @SimonPalmer not clear on what you're asking here... Commented Aug 8, 2022 at 6:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.