I need to get a service area polygon (graphics) for inserting it into a query as geometry.
This is a piece of code (a serviceAreaTask)
serviceAreaTask.solve(params,function(solveResult){
var polygonSymbol = new SimpleFillSymbol("solid",
new SimpleLineSymbol("solid", new Color([232,104,80]), 2),
new Color([232,104,80,0.25])
);
arrayUtils.forEach(solveResult.serviceAreaPolygons,function(serviceArea){
serviceArea.setSymbol(polygonSymbol);
map.graphics.add(serviceArea);
});
According to API ServiceAreaSolveResult https://developers.arcgis.com/javascript/3/jsapi/serviceareasolveresult-amd.html
ServiceAreaPolygon is already a graphic, and I can use its geometry in my query, but I don´t know how I can get this geometry.
Thanks a lot!
you are correct! As mentined in document serviceAreaPolygons are already in esri graphic format.
Well, geometry is a property of the graphic. below is the way to access this.
In your case-
arrayUtils.forEach(solveResult.serviceAreaPolygons,function(serviceArea){
serviceArea.setSymbol(polygonSymbol);
var serviceAreaGeometry = serviceArea.geometry; // this is the geometry. you can use this geometry in your further query.
map.graphics.add(serviceArea);
});
Hoping this will help you.
Feel free to shoot your further queries.
Related
I am attempting to use AsterixDB (which uses SQL++) to join two sets together via an sql query. In one dataset, I have a series of points in the form of latitude and longitude. The other dataset is geometries for zip codes. I am trying to append the relevant zip code to the first dataset based on whether the point exists in the zip code or not.
The query is below as well as the schema for each dataset
use csv;
select sett.lat, sett.long, zip.g
from csv_set as sett
left join csv_zipset as zip
on st_contains(zip.g, st_make_point(sett.lat, sett.long));
create type csv_type as {
id:uuid,
...
lat: double,
long: double
};
create type csv_ziptype as {
id: uuid,
g:geometry
};
This is the error I am facing:
ERROR: Code: 1 "java.lang.NullPointerException: Cannot invoke \"org.apache.hyracks.control.nc.io.FileHandle.close()\" because \"fHandle\" is null"
I have tried adding null checks for both the point and geometry with no luck.
I have also validated that st_make_point is working properly, and st_contains works when I pass it a fixed geometry which leads me to believe that this is an issue with the geometry.
Any help is much appreciated
After exhausting more options I came to the realization that there were multiple types in my dataset: polygon, multipolygon, linestring, and geometryCollection. It seems that AsterixDB doesn't yet have the ability to compute st_contains with geometry collections. Once I removed those entries from the dataset the query was able to complete successfully.
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
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
Working in ArcGIS JS API 4.22:
I am trying to query a feature layer (polygons) with a large amount of points (~1000) in order to find which polygons the points intersect with (by name only, no need for geometries. Doing this with a loop for each point individually is extremely slow and errors out. I've tried condensing the points to a multipoint geometry in hopes of speeding the process to no avail. Is there a solution to this that I am just overlooking?
Added code:
const layer = new FeatureLayer({
url: "https://arcgis-server.lsa.umich.edu/arcgis/rest/services/IFR/glahf_classification_poly/MapServer/0",
outFields: ["AEU_Code"],
});
//gets a server error at about 250 points
var multipoint = new Multipoint({
points: [
[-86, 45],
[-85, 47],
[-84, 49]
]
});
const query = new Query();
query.geometry = multipoint;
query.outSpatialReference = { wkid: 102100 };
query.returnGeometry = false;
query.outFields = ["AEU_Code"];
layer.queryFeatures(query).then(function (results) {
console.log(results.features); // prints the array of features to the console
});
Thanks!
So you have two separate layers in this situation right? A polygon layer and a points layer? Use the pairwise intersect tool, it should result in an feature class where the attribute table has all of your points along with the fields from the polygon layer they intersect with. 1000 points really isn't that many, this should not be very computationally intense.
If this is not what you're doing can you be more descriptive with the data you have and what you are trying to accomplish?
The other way I interpret the question is that you already have the feature layer I described, but are trying to query it in some way. If this is the case can you elaborate on what you are trying to glean from the data? I don't understand why you would need to query each point individually.
I check the polygon service and it has 77 features. If you can load all the polygons in the view, then one possible option is to do the intersection in the client instead of the server. In this way at least you avoid timeout issues, you will have to time it to see how long it takes.
In order to to the intersection in the client use the layer view instead of the layer, ArcGIS JS API - FeatureLayerView queryFeatures.
While learning about Photoshop scripting I found about the Action Manager, the ScriptListener Plug-In and how it can generate code based on your actions. Sergey Kritskiy was kind enough to help me with a proposed solution (How to adjust the colors of a large number of images based on one spesific?) but there are a lot of class IDs -which are used in charIDToTypeID(), that I do not understand (the code needs to be documented since it will go into my thesis). Strangely there is an index of all EventIDs in the photoshop-cc-javascript-ref-2019.pdf available at adobe help center but cannot find anything similar for class IDs. I googled quite a bit but cannot find anything of the sort. Am I doing something wrong?
For instance the following is the code generated for the filter > Stylize > Emboss (example taken from photoshop-cc-scripting-guide-2019.pdf -from adobe help center )
var idEmbs = charIDToTypeID( "Embs" );
var desc24 = new ActionDescriptor();
var idAngl = charIDToTypeID( "Angl" );
desc24.putInteger( idAngl, 135 );
var idHght = charIDToTypeID( "Hght" );
desc24.putInteger( idHght, 3 );
var idAmnt = charIDToTypeID( "Amnt" );
desc24.putInteger( idAmnt, 100 );
executeAction( idEmbs, desc24, DialogModes.NO );
The 'Embs' is an event Id, while 'Angl', 'Hght', 'Amnt' are class Ids. But while those are easy to guess others like 'Lctn, 'Mdpn', 'Opct' or '#Prc' are not (least to a novice like me)
Download the Photoshop SDK. Inside you'll find some documentation in HTML format.
The key Lctn, for example, can be found in the full 'Adobe Photoshop SDK File List', inside PITerminology.h (to be fair, I had to use a File Search utility to locate it):
#define keyLocation 'Lctn'
In turn, where is this used then? There is some minimal guidance where these are used in `Photoshop Actions Guide.pdf'; it seems all of your abbreviations are function arguments.
Lctn, again for example, is used in eventStroke:
Table 4–36: eventStroke Parameters (6)
Key Type Bounds Options
keyWidth ('Wdth') typeInteger flagsSingleParameter
keyLocation ('Lctn') typeStrokeLocation ('StrL') flagsEnumeratedParameter
keyOpacity ('Opct') unitFloat/unitPercent ('#Prc') flagsEnumeratedParameter
keyMode ('Md ') typeBlendMode ('BldM') flagsEnumeratedParameter
keyPreserveTransparency ('PrsT') typeBoolean flagsOptionalEnumeratedParameter
keyUsing ('Usrs') typeClass ('Type') flagsOptionalSingleParameter
Yeah. This really is badly documented.
Im using the last version of datastax dse graph. I need to load geo point from text file into the graph.
Is it ok to write POINT(12.3 34.5) for geo point in the text data file?
or POINT(X,Y)? or Geo.point(x,y)?
There is an example in the documentation that shows how to load geo data - https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/reference/refDSEGraphDataTypes.html?hl=graph,geo,data
graph.addVertex(label,'author','name','Jamie Oliver','gender','M','point',Geo.point(1,2))
you can convert the longitude and latitude values into a Point using a transform with DSE GraphLoader (https://docs.datastax.com/en/datastax_enterprise/latest/datastax_enterprise/graph/dgl/dglTransform.html)
geoPointInput = geoPointInput.transform { it['location'] = new com.datastax.driver.dse.geometry.Point(Double.parseDouble(it['longitude']),Double.parseDouble(it['latitude'])); it }