Select to view content in your preferred language

Load local layer (shape) in HTML viewer API for Javascript

602
1
12-21-2010 04:52 AM
PauPérez_Puigcerver
Emerging Contributor
There are any application (.NET, Java, ...) that can be used to load in HTML viewer Javascript API, like the widget "Shape File Overlay for Sample Viewer" for Flex API?

Thanks

Pau Pérez
0 Kudos
1 Reply
AxelSchaefer
Emerging Contributor
This question has been posted several times in this forum. Yes you can do it. But you need a server-roundtrip for this. JavaScript doesn't allow the direct access to your local drive, due to security restrictions. JS runs in a webbrowser who shouldn't access your local filesystem automatically. Therefore it is not possible with the JS-API alone.

You have to upload your shapefile via HTML mechanisms to a server-component, like the code-behind of an ASPX-page. You can parse your shapefile transform it for example to a JSON format (for example a FeatureSet) and send the results back to the client with a callback. The client can draw the results directly on the GraphicsLayer.

HTH.
Axel
0 Kudos