ESRI example code in Create a FeatureLayer from a shapefile adds zipped shapefile into map.
This code uses ArcGIS REST API Generate to create the feature collection, but it is limited and can't create if total recors number is greater than 4000.
So, I want to analyze the zipped shapefile prior to generating features using Generate operation, in order to know the number of records, either total, or better - per layer.
My questios are:
I'll appreciate help,
Michael
Solved! Go to Solution.
So there is no convenient way to get total records count of zipped shapefile before passing it to arcgis rest ap generate".
So I always pass the zip to "generate", and I'm using "generate" returned error message to inform the user that this zip has more than 4000 records.
Michael
Michael,
My suggestion is to start looking for a JS library for shapefiles. I know there where a couple of them years ago. Using one of them clientside you can read and create a featurelayer clientside and get past your feature limit issue. But this is a not something others will be able to provide help with as I have seen little to no discussion of this on esri forums for the last 10 or more years.
HiMichael Lev,
To process a zip file or uploaded file you will need to work with the server-side. Javascript will only be able to process if the server-side responds with data. JS libraries that can process zip files or uploaded files are executed on server usually as node libraries.
So this is not a client-side javascript question, as that technology is restricted for security reasons by browsers in reading files from file system.
IF for your scenario Generate returns a response, only that you cannot place the feature entirely as a layer – then you may be able to read and extract information from the response object to a generate call and take necessary actions.
Note here, you are asking ArcGIS REST API running on server (probably using python with pyshp(https://pypi.org/project/pyshp/) like libraries to process shape) to process the file.
Thank You!
So there is no convenient way to get total records count of zipped shapefile before passing it to arcgis rest ap generate".
So I always pass the zip to "generate", and I'm using "generate" returned error message to inform the user that this zip has more than 4000 records.
Michael