1

Can you please let me know if it is possible to present an ArcMap Generated Layer (.lyr) on top of ArcGIS JavaScript API Map without using ArcGIS Server? Like using server uploaded file from URL ?

  • A layer file does not have any data in it. Just style information. So not unless you have some data to match it against that can be represented as a layer on the JS API. – Simon Aug 9 '17 at 14:53
  • Thanks Simon but how abot rhis part not unless you have some data to match it against that can be represented as a layer on the JS API. how I can do this? – user1106951 Aug 9 '17 at 15:27
1

The web map will need to reference the data in an available location. Since the layer file is only a reference to a feature class in a database, it does not include any actual data. One option is to upload to ArcGIS Online, if you have an account.

  1. Add .lyr file to ArcMap
  2. Click file>share as service (make sure you are signed in to AGO first)
  3. Choose Publish a service
  4. In "Choose a Connection", pick your ArcGIS Online connection
  5. Go through the publishing wizard
  6. This will upload your data, but use the layer definition in your layer file
  7. Find the service you created by logging into arcgis.com and clicking "Content"
  8. Click on the hosted layer, and on the overview tab, find the URL reference URL to use in adding to map

Use this URL to add to your map object:

 var featureLayer1 = new FeatureLayer({
        url: "(PLACE URL HERE)"
    });

 map.add(featureLayer1);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.