Export Shapefile - Zipped

1639
3
12-08-2014 08:29 AM
jaykapalczynski
Frequent Contributor

I have this piece of code that is taking a graphic drawn by the user and creating a shapefile.

Right now it creates the .dbf .shp .shx  and the user can download it.

What I want is a .prj file to be created and the whole thing be zipped up....

Anyone know how to do this in JavaScript?

See attached

Thanks in Advance if someone can help.

0 Kudos
3 Replies
PaulCrickard
New Contributor III

For the projection you would need to write something like this to a text file (for Mercator):

PROJCS["WGS_1984_World_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]

You can see about writing textfiles here :

jquery - Writing data to a local text file with javascript - Stack Overflow

0 Kudos
PaulCrickard
New Contributor III

And name it the same as the shapefile and filetype .prj

0 Kudos
jaykapalczynski
Frequent Contributor

Thanks Paul...going to get at this soon....but good to know it can be done...sure I will have some future questions.

0 Kudos