Is there a library to parse GIS shape files ( .shp )?

edited November 2016 in JavaScript Mode

I know there is GeoTools in Java and there is shp.js in javascript (https://github.com/kig/shp.js/)

But i cant find it for processing... so if i use the java lib then i wont be able to run my sketch in html5, and if i want to use the js parser i dont know how to connect it to the sketch in html5... any ideas?

Tagged:

Answers

  • So there is one, its called MapThing and its developed for processing 1.5

  • If MapThing is to hard to bring up to date, does GeoTools not work for you in Processing for some reason? Are there specific Processing-centric features that you need?

  • edited November 2016

    GeoTools are very complicated, and i dont know how i would be able to run my sketch in html5 afterwards with this heavy java dependency.

    I have found out that there is a format called geojson, apparently its very easy to export shp to geojson (see here: https://geoconverter.hsr.ch) and then you only have to use processings json parser, its working great for me!

  • edited November 2016

    run my sketch in html5

    What is your goal? To run your sketch in :

    1. Processing (for Java)
    2. p5.js

    If p5.js, then it doesn't matter if it is a "heavy" or "light" Java dependency -- you just want JavaScript. So you should use shp.js.

    Edit -- Glad to hear geojson is working for you!

  • Goal is to run both Processing and then i usually upload it in a html5 canvas, the same .pde file and it works fine... i guess that is p5?

  • Are you using Processing 2 or Processing 3?

  • Im using Processing 3 but i have done the html5 thing with processing 2 sketches as well if im not mistaken

  • Sorry, I read your initial post wrong and didn't realize you were using Processing JS mode in PDE (not Java mode and not p5.js).

    Is there a particular reason you can't use shp.js? Do you get an error?

    I'm not too familiar with ProcessingJS (JavaScript mode), but perhaps someone can help. I thought that JavaScript mode was removed in favor of p5.js in recent versions of Processing 3, but I don't know the details.

  • edited November 2016

    Yes, true, i could use P5 - then shp.js should work.

    I guess i thought that if there was a simple library written in processing i would still be able to upload it together with the pde sketch into html5 and then have the sketch work both as a desktop and web application without having to write 2 different codes.

    If im not mistaken this approach works with libraries like peasycam etc

    But perhaps writing only in p5 is not a bad option since browser environment is becoming a standard for running software apps so i might just focus on that.

  • Interesting -- I didn't think that ProcessingJS was able to transcode java libraries like PeasyCam, I thought the libraries had to also offer a JS version.

    It certainly would be easier coding it once rather than implementing two parallel versions. Whichever approach you take, good luck!

  • Actually i might be wrong about peasycam : ( Maybe it was some other library that i tried. Anyways, thank s for following me up, i think i have a much clearer view now : )

Sign In or Register to comment.