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

Dharman
  • 30,962
  • 25
  • 85
  • 135
Simon Palmer
  • 384
  • 1
  • 2
  • 13
  • 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](https://stackoverflow.com/questions/11835623/google-maps-api-getting-street-coordinates) – Seth Lutske Aug 04 '22 at 01:53
  • You may also find some direction in the question [How to get all roads around a given location in OpenStreetMap?](https://stackoverflow.com/questions/20322823/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 – Seth Lutske Aug 04 '22 at 01:55
  • Oh wow thanks for the advice. Overpass turbo is awesome! @SethLutske – Simon Palmer Aug 05 '22 at 04:38

1 Answers1

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

cabesuon
  • 4,860
  • 2
  • 15
  • 24
  • 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 – Simon Palmer Aug 05 '22 at 04:47
  • @SimonPalmer not clear on what you're asking here... – Seth Lutske Aug 08 '22 at 06:58