How do I add a shapefile (.lpk) to a map?

3336
7
11-22-2013 03:07 PM
DamNguyen
New Contributor III
I'm not familiar with GIS so I don't know what kind of layer a shapefile is. How do I add it to an existing map?

My map:
map = new esri.Map("mapDiv", {
    center: [-95.80, 39.29],
    zoom: 4,
    basemap: "topo"
});


Thank you.
0 Kudos
7 Replies
JianHuang
Occasional Contributor III
When you say "add to map", is that map only for you displaying on your computer? Or, do you want to pass the URL of the web app so that you can share it?
In order to share your data or layer, you have to host it as a service either on your ArcGIS Server machine, or put it on arcgis.com.
0 Kudos
DamNguyen
New Contributor III
When you say "add to map", is that map only for you displaying on your computer? Or, do you want to pass the URL of the web app so that you can share it?
In order to share your data or layer, you have to host it as a service either on your ArcGIS Server machine, or put it on arcgis.com.


Hi Jian,

I want the map to be share-able on a public website. Since I don't have my own ArcGIS server, how would I put it on arcgis.com? And what kind of layer class/object does shapefile fall under? I'm not sure if I phrased this question correction. As an example, to add a KML layer, I would create a KMLLayer object then add it to the map by doing so:

dojo.require("esri.layers.KMLLayer");
var kmlUrl = "http://url-to-kml-file-here.kmz"; 
kml1 = new esri.layers.KMLLayer(kmlUrl);     
map.addLayer(kml1);


But for a shapefile (.lkp), what do I do?

Again, thanks for your help.
0 Kudos
JeffPace
MVP Alum
you can't add shapefiles.  Otherwise few would pay for Server.

You have to either publish the data, or publish it on arcgis.com with an account and then consume the webmap in your application.
0 Kudos
DamNguyen
New Contributor III
you can't add shapefiles.  Otherwise few would pay for Server.

You have to either publish the data, or publish it on arcgis.com with an account and then consume the webmap in your application.


Hi Jeff,

I'm not understanding you entirely because I'm very new at this. Sorry in advance. By publish it on arcgis.com. Do you mean create a webmap (http://www.arcgis.com/home/webmap/viewer.html) upload the shapefile, then embed it in my website?
0 Kudos
JeffPace
MVP Alum
Yes

http://resources.arcgis.com/en/help/arcgisonline/index.html#//010q000000m2000000

But remember

Limitations
Below are the limitations to using shapefiles in the ArcGIS.com map viewer.
Compression formats other than a .zip archive are not supported.
Files containing more than 1,000 features cannot be added to a map.
The following features are not supported: multipatch or multipoint geometries, geometries that cross the dateline, or self-intersections in polygons. Shapefiles with these features cannot be added to a map.


If your shapefile is outside this it won't work for you.
0 Kudos
DamNguyen
New Contributor III
Thank you, Jeff!
0 Kudos
JeffPace
MVP Alum
you are welcome.  good luck
0 Kudos