Getting a specific layer as file in ArcGis JS 4.x












1














The idea is simple:




  1. User draws graphic layer (similar visual example to my own https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=sketch-geometries)

  2. Saves the layer in a file (similar example, only from ArcGis JS 3.x https://developers.arcgis.com/javascript/3/jsapi/extractdata-amd.html)

  3. So later could add the said layer to the map and see it, maybe even edit it again (Not needed right now for this ticket).


So basically I am a bit stuck at step 2. Is there a way to extract and save a specific layer as a file in ArcGis JS 4.x?










share|improve this question


















  • 1




    The saving to shapefile part (step 2) needs to be a service hosted on arcgis server or arcgis server online. Do you have access to such service? If not you will have to use an external javascript library that convert geojson to shapefile on client-side.
    – Below the Radar
    Nov 23 '18 at 13:39












  • Thank you. That got me a little bit further, since I searched and found such library (github.com/mapbox/shp-write), which I will most likely test in Monday.
    – CodeBox
    Nov 23 '18 at 14:28










  • That's the library I was going to suggest you to try. But personnaly I never tryed it.
    – Below the Radar
    Nov 23 '18 at 14:32










  • After reading a bit more about shp-write library, you might have problems to use it on client-side because it was made for Node.js (server side). You can try to use browserify.js but it's going to be complicated to handle all dependancies
    – Below the Radar
    Nov 23 '18 at 19:07


















1














The idea is simple:




  1. User draws graphic layer (similar visual example to my own https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=sketch-geometries)

  2. Saves the layer in a file (similar example, only from ArcGis JS 3.x https://developers.arcgis.com/javascript/3/jsapi/extractdata-amd.html)

  3. So later could add the said layer to the map and see it, maybe even edit it again (Not needed right now for this ticket).


So basically I am a bit stuck at step 2. Is there a way to extract and save a specific layer as a file in ArcGis JS 4.x?










share|improve this question


















  • 1




    The saving to shapefile part (step 2) needs to be a service hosted on arcgis server or arcgis server online. Do you have access to such service? If not you will have to use an external javascript library that convert geojson to shapefile on client-side.
    – Below the Radar
    Nov 23 '18 at 13:39












  • Thank you. That got me a little bit further, since I searched and found such library (github.com/mapbox/shp-write), which I will most likely test in Monday.
    – CodeBox
    Nov 23 '18 at 14:28










  • That's the library I was going to suggest you to try. But personnaly I never tryed it.
    – Below the Radar
    Nov 23 '18 at 14:32










  • After reading a bit more about shp-write library, you might have problems to use it on client-side because it was made for Node.js (server side). You can try to use browserify.js but it's going to be complicated to handle all dependancies
    – Below the Radar
    Nov 23 '18 at 19:07
















1












1








1







The idea is simple:




  1. User draws graphic layer (similar visual example to my own https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=sketch-geometries)

  2. Saves the layer in a file (similar example, only from ArcGis JS 3.x https://developers.arcgis.com/javascript/3/jsapi/extractdata-amd.html)

  3. So later could add the said layer to the map and see it, maybe even edit it again (Not needed right now for this ticket).


So basically I am a bit stuck at step 2. Is there a way to extract and save a specific layer as a file in ArcGis JS 4.x?










share|improve this question













The idea is simple:




  1. User draws graphic layer (similar visual example to my own https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=sketch-geometries)

  2. Saves the layer in a file (similar example, only from ArcGis JS 3.x https://developers.arcgis.com/javascript/3/jsapi/extractdata-amd.html)

  3. So later could add the said layer to the map and see it, maybe even edit it again (Not needed right now for this ticket).


So basically I am a bit stuck at step 2. Is there a way to extract and save a specific layer as a file in ArcGis JS 4.x?







javascript arcgis-js-api






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 11:18









CodeBox

613




613








  • 1




    The saving to shapefile part (step 2) needs to be a service hosted on arcgis server or arcgis server online. Do you have access to such service? If not you will have to use an external javascript library that convert geojson to shapefile on client-side.
    – Below the Radar
    Nov 23 '18 at 13:39












  • Thank you. That got me a little bit further, since I searched and found such library (github.com/mapbox/shp-write), which I will most likely test in Monday.
    – CodeBox
    Nov 23 '18 at 14:28










  • That's the library I was going to suggest you to try. But personnaly I never tryed it.
    – Below the Radar
    Nov 23 '18 at 14:32










  • After reading a bit more about shp-write library, you might have problems to use it on client-side because it was made for Node.js (server side). You can try to use browserify.js but it's going to be complicated to handle all dependancies
    – Below the Radar
    Nov 23 '18 at 19:07
















  • 1




    The saving to shapefile part (step 2) needs to be a service hosted on arcgis server or arcgis server online. Do you have access to such service? If not you will have to use an external javascript library that convert geojson to shapefile on client-side.
    – Below the Radar
    Nov 23 '18 at 13:39












  • Thank you. That got me a little bit further, since I searched and found such library (github.com/mapbox/shp-write), which I will most likely test in Monday.
    – CodeBox
    Nov 23 '18 at 14:28










  • That's the library I was going to suggest you to try. But personnaly I never tryed it.
    – Below the Radar
    Nov 23 '18 at 14:32










  • After reading a bit more about shp-write library, you might have problems to use it on client-side because it was made for Node.js (server side). You can try to use browserify.js but it's going to be complicated to handle all dependancies
    – Below the Radar
    Nov 23 '18 at 19:07










1




1




The saving to shapefile part (step 2) needs to be a service hosted on arcgis server or arcgis server online. Do you have access to such service? If not you will have to use an external javascript library that convert geojson to shapefile on client-side.
– Below the Radar
Nov 23 '18 at 13:39






The saving to shapefile part (step 2) needs to be a service hosted on arcgis server or arcgis server online. Do you have access to such service? If not you will have to use an external javascript library that convert geojson to shapefile on client-side.
– Below the Radar
Nov 23 '18 at 13:39














Thank you. That got me a little bit further, since I searched and found such library (github.com/mapbox/shp-write), which I will most likely test in Monday.
– CodeBox
Nov 23 '18 at 14:28




Thank you. That got me a little bit further, since I searched and found such library (github.com/mapbox/shp-write), which I will most likely test in Monday.
– CodeBox
Nov 23 '18 at 14:28












That's the library I was going to suggest you to try. But personnaly I never tryed it.
– Below the Radar
Nov 23 '18 at 14:32




That's the library I was going to suggest you to try. But personnaly I never tryed it.
– Below the Radar
Nov 23 '18 at 14:32












After reading a bit more about shp-write library, you might have problems to use it on client-side because it was made for Node.js (server side). You can try to use browserify.js but it's going to be complicated to handle all dependancies
– Below the Radar
Nov 23 '18 at 19:07






After reading a bit more about shp-write library, you might have problems to use it on client-side because it was made for Node.js (server side). You can try to use browserify.js but it's going to be complicated to handle all dependancies
– Below the Radar
Nov 23 '18 at 19:07



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445711%2fgetting-a-specific-layer-as-file-in-arcgis-js-4-x%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445711%2fgetting-a-specific-layer-as-file-in-arcgis-js-4-x%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)