How to get all building footprint of a particular bounds

839
3
11-09-2017 12:04 AM
ikennaemman
New Contributor

Please someone should help me. I want to get the building footprints of all the building in a particular polygon bound using. Thanks

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Ikenna,

   Well this is a basic Spatial Query then You need to use QueryTask and Query classes specifying the polygon that you want to find the building in as the Query.geometry.

 See this sample for basic Spatial Query:

Manage results from multiple queries | ArcGIS API for JavaScript 3.22 

0 Kudos
ikennaemman
New Contributor

Thanks for pointing me in the right direction.

Please how do I query the  building footprints without calling the services api 

var basemap = new ArcGISDynamicMapServiceLayer("https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServe...");
 app.map.addLayer(basemap);
// query task and query for parcels
 app.qtParcels = new QueryTask("https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServe...");
 app.qParcels = new Query();
 // query task and query for landuse 
 app.qtBuildings = new QueryTask("https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServe...");

As i do not have the data for my city. I want to be able to get the building footprints in the rendered map. 

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ikenna,

Please how do I query the  building footprints without calling the services api 

As i do not have the data for my city. I want to be able to get the building footprints in the rendered map.

I don't understand these statements at all... How do expect to do any of this if you do not have data for your city?

First you have to get a specific polygon from your parcels layer. You can use a querytask for this as well if you know an attribute of the parcel you want to use.

Next you use that polygon as the input geometry for your building footprint.

app.qBuildings = new Query();
app.qBuildings.geometry = YOUR_BUILDING_POLYGON;
app.qBuildings.outFields = ["*"];
app.qBuildings.returnGeometry = true;
app.qBuildings.outSpatialReference = map.spatialRefernce;

app.qtBuildings.execute(app.qBuildings, function(results){
  //work with the results
});
0 Kudos