Giter VIP home page Giter VIP logo

ogre's Introduction

Build Status NPM NPM Downloads

Ogre is a web frontend and API for the ogr2ogr module. See a live demo here.

Installation

  1. Install GDAL tools (includes the ogr2ogr command line tool)

  2. Install package:

npm install -g ogre

Usage

To run the app:

ogre -p 3000

Then visit http://localhost:3000 in a your favorite browser.

Options include:

Usage: ogre [options]

Options:
 -h, --help      help
 -p, --port      port number (default 3000)
 -v, --version   version number
 -t, --timeout   timeout before ogre kills a job in ms (default 15000)
 -l, --limit     byte limit for uploads (default 50000000)

ogre's People

Contributors

bilts avatar btfou avatar dericke avatar gastonzalba avatar itjope avatar jade-bot avatar macrouch avatar rclark avatar wavded avatar yuhangch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ogre's Issues

error of "npm install ogre" in ubuntu10.4 in vmware

error of npm install ogre in ubuntu10.4 in vmware .can anyone help me?

xxxxx@ubuntu:~$ npm install ogre
npm ERR! error installing [email protected] Error: ETIMEDOUT, Connection timed out
npm ERR! error installing [email protected] at Socket._onConnect (net.js:602:18)
npm ERR! error installing [email protected] at IOWatcher.onWritable as callback
npm ERR! Error: ETIMEDOUT, Connection timed out
npm ERR! at Socket._onConnect (net.js:602:18)
npm ERR! at IOWatcher.onWritable as callback
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]
npm ERR!
npm ERR! System Linux 2.6.32-28-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "ogre"
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/xxx/npm-debug.log

Properties not split up

I successfully converted a JSON track (e.g. https://envirocar.org/api/stable/tracks/52714d4ee4b000fe0582a292) from enviroCar with your great website!

However, all the observed properties are in one column when I open the shapefile in QGis. Is this an issue with the GeoJSON file that is put in, or a problem of the conversion?

Input JSON snippet

"properties": {
    "id": "52714d4ee4b000fe0582a294",
    "time": "2013-10-18T09:29:48Z",
    "phenomenons": { … }
}

Thanks for your help!

size limitations

is there a size limit when converting to geojson? web client keeps spitting back geojson that is cut off...i'm assuming its because the files are too big.

just curious, tool is great. thanks for your help.

Get ERROR #4: Unable to open datasource

Whenever I try to convert a small shapefile using the ogre web client

{"errors":["ERROR 4: Unable to open /tmp/27651-kd1jy0.shx or /tmp/27651-kd1jy0.SHX.","FAILURE:","Unable to open datasource

POst request

Hi,

Trying to directly make an HTTP POST request and get this as a response:

{"error":true,"msg":"Cannot read property 'upload' of undefined"}

I'm providing the upload parameter with the local file location.

Error: EACCES, open '/usr/lib/node_modules/ogre/src/public/style.css'

Hello. Thanks for Ogre. :)

I've installed node.js and npm to be able to run ogre locally and it seems to work when running as root, but when I run under my account it gives the following error. I appear to be able to read the file so I'm a bit stumped. Is it trying to write to it?

ahayes@devel:~$ ogre
Ogre started, listening on port 3000
{ [Error: EACCES, open '/usr/lib/node_modules/ogre/src/public/style.css']
errno: 3,
code: 'EACCES',
path: '/usr/lib/node_modules/ogre/src/public/style.css' }

^Z
[2]+ Stopped ogre
ahayes@devel:$ bg
[2]+ ogre &
ahayes@devel:
$ ls -al /usr/lib/node_modules/ogre/src/public/style.css
-rw-r--r-- 1 nobody root 203 Jan 7 16:22 /usr/lib/node_modules/ogre/src/public/style.css

15MB file limit

most of my shape zip files (prj, shp, shx, and dbf file) are at 30+MB. Any way to get them converted ?

ogre:command not found

it setup in /usr/local/bin and /usr/local/lib/node_modules/ogre and /usr/local/bin is in my $PATH
but not setup in ~/.local/bin.
i try add /usr/local/lib/node_modules/ogre to the PATH, but fail to run too.
what else can i do to run it ?

Coordinates seem to be off?

Hello :)

I've downloaded an ESRI ArcGIS shape file from http://cityplanning.lacity.org/, and then I uploaded and converted the zipped file to GeoJSON with your lovely online converter (thanks so much!), but when I try adding the converted GeoJSON data to Google Maps as a data layer at https://developers.google.com/maps/documentation/javascript/examples/layer-data-dragndrop, it doesn't work.

And the Google Maps page works perfectly with native (unconverted) GeoJSON files downloaded from the LA Times' mapping project at http://boundaries.latimes.com/sets/.

Just wondering if I'm doing something wrong or if there's a concept I'm not grasping?

Thanks so much for everything! You rock!

Pardis

Problem when sending files via http.post: stream ended unexpectedly

I am trying to use your service to convert my files into GeoJSON.

For this I am using the http.post module you can find here:
https://www.npmjs.com/package/http-post

This is my full code for sending an existing file to your service to get the GeoJSON back:

http.post('http://ogre.adc4gis.com/convert', {

}, [
  {
    param: 'upload',
    path:'/existing/file.zip'
  }
], function(res){
  res.setEncoding('utf8');
  res.on('data', function(chunk) {
    console.log(chunk);
  });
});

And this is the result I am getting:
{"error":true,"msg":"stream ended unexpectedly"}

Is there something I am missing ?

ogr2o.gr

Hi Marc,

I registered the ogr2o.gr domain a while back when I was thinking of building a service that does exactly what ogre does. That seems unnecessary at this point, and I just got a renewal notice for the domain because it's going to expire on July 4, 2013. If you'd like I can transfer the domain or just renew it for another year and point the DNS at your sever. Thoughts?

Output displays in the browser, causing the browser to crash preventing download

I've got a 40mb GML file I'm trying to convert. Ogre does a good job of it - but then instead of letting me download the ~50mb output, it displays it as text in the browser. It doesn't offer any alternative option - there's no "download" tick box or similar I can see.

Browsers aren't designed to display megabytes of text, so the browser crashes every time, and can't save the output. Not only that, but many browsers' save tools cause the page to reload, losing the output, preventing it from being downloaded.

It's a shame to see a tool do a good job then fail at the final hurdle like this.

Can't you set the output to download as a file? Or at least, allow users to choose?

Allowing URL input would be good too.

OGR guesses wrong

Hi.. I've some shp files where ogr fails to guess the right projection. From the command line i can use the -a_srs flag and -t_srs flag to specify the source and target projection.. There will be a method to submit these flags from the POST params?

Thanks,
Daniele

Setting up local environment on Windows

Hi there,
I found out ogre is provided interesting features to support geo formats.
I want to run ogre locally, to do some experiments and developments.

As the first step i tried to set up local environment. I am working on Windows. With no surprises, i got a lot of installation issues.

  1. Does npm install ogre is enough to do or should i also install gdal packages for windows.
    There are many choices available for windows, which is confusing.

  2. I tried to build a docker image for ogre using provided Dockerfile. It doesn't seem helpful either.
    The

homme.gdal:v1.11.1

doesn't get pulled completely. I tried to pull

latest

tag. It works fine.
But again my confusion is does it install gdal or ogre?

How can i run this service on docker?

3)Overall, What would be the easier solution to setup a local environment to run ogre locally on a windows machine?

{ errors: [ "Error: spawn ENOENT" ] }

Hello,

Thank you for making this! It is awesome.

I am trying to convert a 130mb shapefile to JSON.

I npm installed ogre

I installed gdal with these instructions, including the set path step.
https://sites.google.com/site/eospansite/installinggdalonmacosx

I read the other issue about enoent and path.

When I try to convert on localhost with a timeout of 1500000 I almost immediately get the error
{
errors: [
"Error: spawn ENOENT"
]
}

Do you have any advice on what I should do?

Best,
Andy

Request Entity (still) Too Large

I'm seeing the same error described in issue #34 when trying to convert a 220 KB GeoJson file to Shapefile. Is it possible to apply the fix suggested by jasonChili in issue #34?

Python requests.post failing on TAB files

Hi,

I've been trying to get this working for quite a while within my python environment with little success. I have a zipped MapInfo file which when sent through an HTTP client (like Postman) work great, but when I try to send the same file via the python requests library, I get the following error:

{"errors":["FAILURE:","Unable to open datasource `/tmp/5-1lgxaqi\' with the following drivers.","  -> ESRI Shapefile","  -> MapInfo File","  -> UK .NTF","  -> SDTS","  -> TIGER","  -> S57","  -> DGN","  -> VRT","  -> REC","  -> Memory","  -> BNA","  -> CSV","  -> NAS","  -> GML","  -> GPX","  -> LIBKML","  -> KML","  -> GeoJSON","  -> Interlis 1","  -> Interlis 2","  -> GMT","  -> GPKG","  -> SQLite","  -> ODBC","  -> WAsP","  -> PGeo","  -> MSSQLSpatial","  -> PostgreSQL","  -> PCIDSK","  -> OpenFileGDB","  -> FileGDB","  -> XPlane","  -> AVCBin","  -> AVCE00","  -> DXF","  -> Geoconcept","  -> GeoRSS","  -> GPSTrackMaker","  -> VFK","  -> PGDump","  -> OSM","  -> GPSBabel","  -> SUA","  -> OpenAir","  -> PDS","  -> WFS","  -> HTF","  -> AeronavFAA","  -> Geomedia","  -> EDIGEO","  -> GFT","  -> GME","  -> SVG","  -> CouchDB","  -> Idrisi","  -> ARCGEN","  -> SEGUKOOA","  -> SEGY","  -> XLS","  -> ODS","  -> XLSX","  -> ElasticSearch","  -> PDF","  -> Walk","  -> CartoDB","  -> SXF",""]}

Python version: Python 2.7.6

I've checked the headers and content being sent, and nothing looks out of the ordinary or wrong, not sure what could be causing this.

Any help would be immensely appreciated! Thank you!!!

Getting 'No file uploaded' message when trying to make POST request from C#

Hi,

I am trying to make POST request to ogre web client from c#. Below is my code:

               HttpClient client = new HttpClient();
               MultipartFormDataContent form = new MultipartFormDataContent();
               HttpContent content = new StreamContent(file.InputStream);
               content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
               {
                   Name = "upload",
                   FileName = file.FileName
               };
               form.Add(content,"upload",file.FileName);
               var response = (await client.PostAsync("http://ogre.adc4gis.com/convert", form));
               var geoJSON = response.Content.ReadAsStringAsync().Result;

I am getting 'No file uploaded' response. I have also tried setting content-type explicitly as follows:
content.Headers.ContentType = new MediaTypeHeaderValue("multipart/form-data");

But still the result is same i.e. getting 'No file uploaded' response.

Any help will be much appreciated.

Thanks

Option to switch x/y coordinates

Have a strange Problem with a GeoRSS File in EPSG:31256 coordinates, which are converted to EPSG:4326 in der wrong order. So the output GeoJSON coordinates are wrong. When I insert only the coordinates from the GeoRSS Tag they are converted correct.
An extra option to siwtch x/y coordinates could be a solution?

connect has no method 'staticProvider'

xxxxx@ubuntu:~/nodeogre/ogre$ node /usr/local/bin/ogre/run.js

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object function createServer() {
if ('object' == typeof arguments[0]) {
return new HTTPSServer(arguments[0], Array.prototype.slice.call(arguments, 1));
} else {
return new HTTPServer(Array.prototype.slice.call(arguments));
}
} has no method 'staticProvider'
at HTTPServer. (/usr/local/lib/node_modules/ogre/bin/ogre/src/ogre.js:15:25)
at HTTPServer.configure (/usr/local/lib/node_modules/ogre/node_modules/express/lib/http.js:484:52)
at Object.createServer (/usr/local/lib/node_modules/ogre/bin/ogre/src/ogre.js:14:9)
at Object. (/usr/local/lib/node_modules/ogre/bin/ogre/run.js:2:6)
at Module._compile (module.js:407:26)
at Object..js (module.js:413:10)
at Module.load (module.js:339:31)
at Function._load (module.js:298:12)
at Array. (module.js:426:10)
at EventEmitter._tickCallback (node.js:126:26)

how to use Post to download zip shapefile itself?

Thanks for sharing this great tool

I have tried to use Post request in my code to get zipped file download through web client, but no clue how to do it in callback function to fullfil the same ability as the convert button "Convert to Shapefile" does.

Could you please provide newbies some help? Many Thanks

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
var objectcol={"displayFieldName":"","geometryType":"esriGeometryPolygon","spatialReference":{"wkid":102100,"latestWkid":3857},"fields":[{"name":"OID","type":"esriFieldTypeOID","alias":"OID"},{"name":"Name","type":"esriFieldTypeString","alias":"Name","length":60},{"name":"BUFF_DIST","type":"esriFieldTypeDouble","alias":"BUFF_DIST"},{"name":"SUM_CLIPPOP","type":"esriFieldTypeInteger","alias":"SUM_CLIPPOP"},{"name":"SUM_CLIPEMP","type":"esriFieldTypeInteger","alias":"SUM_CLIPEMP"},{"name":"Shape_Length","type":"esriFieldTypeDouble","alias":"Shape_Length"},{"name":"Shape_Area","type":"esriFieldTypeDouble","alias":"Shape_Area"}],"features":[{"geometry":{"type":"polygon","rings":[[[-8841308.9388,5412113.0163],[-8841274.2092,5412109.977899998],[-8841240.5348,5412100.954800002],[-8841208.9388,5412086.2214],[-8841180.3813,5412066.225199997],[-8841155.7299,5412041.573799998],[-8841135.7337,5412013.0163],[-8841121.0003,5411981.420299999],[-8841111.9772,5411947.745899998],[-8841108.9388,5411913.0163],[-8841111.9772,5411878.286700003],[-8841121.0003,5411844.612300001],[-8841135.7337,5411813.0163],[-8841155.7299,5411784.458800003],[-8841180.3813,5411759.807400003],[-8841208.9388,5411739.8112],[-8841240.5348,5411725.077799998],[-8841274.2092,5411716.054700002],[-8841308.9388,5411713.0163],[-8841343.6684,5411716.054700002],[-8841377.3428,5411725.077799998],[-8841408.9388,5411739.8112],[-8841437.4963,5411759.807400003],[-8841462.1477,5411784.458800003],[-8841482.1439,5411813.0163],[-8841496.8773,5411844.612300001],[-8841505.9004,5411878.286700003],[-8841508.9388,5411913.0163],[-8841505.9004,5411947.745899998],[-8841496.8773,5411981.420299999],[-8841482.1439,5412013.0163],[-8841462.1477,5412041.573799998],[-8841437.4963,5412066.225199997],[-8841408.9388,5412086.2214],[-8841377.3428,5412100.954800002],[-8841343.6684,5412109.977899998],[-8841308.9388,5412113.0163]]],"_ring":0,"spatialReference":{"wkid":102100,"latestWkid":3857}},"attributes":{"OID":1,"Name":null,"BUFF_DIST":200,"SUM_CLIPPOP":2,"SUM_CLIPEMP":null,"Shape_Length":1255.0427251988326,"Shape_Area":125026.69382391222}},{"geometry":{"type":"polygon","rings":[[[-8840769.1023,5412624.188900001],[-8840734.3727,5412621.1504999995],[-8840700.6983,5412612.127400003],[-8840669.1023,5412597.394000001],[-8840640.5448,5412577.3977999985],[-8840615.8934,5412552.746399999],[-8840595.8972,5412524.188900001],[-8840581.1638,5412492.5929000005],[-8840572.1407,5412458.918499999],[-8840569.1023,5412424.188900001],[-8840572.1407,5412389.4592999965],[-8840581.1638,5412355.784900002],[-8840595.8972,5412324.188900001],[-8840615.8934,5412295.631399997],[-8840640.5448,5412270.979999997],[-8840669.1023,5412250.983800001],[-8840700.6983,5412236.250399999],[-8840734.3727,5412227.227300003],[-8840769.1023,5412224.188900001],[-8840803.8319,5412227.227300003],[-8840837.5063,5412236.250399999],[-8840869.1023,5412250.983800001],[-8840897.6598,5412270.979999997],[-8840922.3112,5412295.631399997],[-8840942.3074,5412324.188900001],[-8840957.0408,5412355.784900002],[-8840966.0639,5412389.4592999965],[-8840969.1023,5412424.188900001],[-8840966.0639,5412458.918499999],[-8840957.0408,5412492.5929000005],[-8840942.3074,5412524.188900001],[-8840922.3112,5412552.746399999],[-8840897.6598,5412577.3977999985],[-8840869.1023,5412597.394000001],[-8840837.5063,5412612.127400003],[-8840803.8319,5412621.1504999995],[-8840769.1023,5412624.188900001]]],"_ring":0,"spatialReference":{"wkid":102100,"latestWkid":3857}},"attributes":{"OID":2,"Name":null,"BUFF_DIST":200,"SUM_CLIPPOP":401,"SUM_CLIPEMP":103,"Shape_Length":1255.0427252029426,"Shape_Area":125026.69382473118}},{"geometry":{"type":"polygon","rings":[[[-8840644.8921,5411926.700999998],[-8840610.1625,5411923.662600003],[-8840576.4881,5411914.6395],[-8840544.8921,5411899.906099997],[-8840516.3346,5411879.909900002],[-8840491.6832,5411855.258500002],[-8840471.687,5411826.700999998],[-8840456.9536,5411795.104999997],[-8840447.9305,5411761.430600002],[-8840444.8921,5411726.700999998],[-8840447.9305,5411691.9714],[-8840456.9536,5411658.296999998],[-8840471.687,5411626.700999998],[-8840491.6832,5411598.1435],[-8840516.3346,5411573.4921],[-8840544.8921,5411553.495899998],[-8840576.4881,5411538.762500003],[-8840610.1625,5411529.739399999],[-8840644.8921,5411526.700999998],[-8840679.6217,5411529.739399999],[-8840713.2961,5411538.762500003],[-8840744.8921,5411553.495899998],[-8840773.4496,5411573.4921],[-8840798.101,5411598.1435],[-8840818.0972,5411626.700999998],[-8840832.8306,5411658.296999998],[-8840841.8537,5411691.9714],[-8840844.8921,5411726.700999998],[-8840841.8537,5411761.430600002],[-8840832.8306,5411795.104999997],[-8840818.0972,5411826.700999998],[-8840798.101,5411855.258500002],[-8840773.4496,5411879.909900002],[-8840744.8921,5411899.906099997],[-8840713.2961,5411914.6395],[-8840679.6217,5411923.662600003],[-8840644.8921,5411926.700999998]]],"_ring":0,"spatialReference":{"wkid":102100,"latestWkid":3857}},"attributes":{"OID":3,"Name":null,"BUFF_DIST":200,"SUM_CLIPPOP":200,"SUM_CLIPEMP":65,"Shape_Length":1255.04272520306,"Shape_Area":125026.69382475453}},{"geometry":{"type":"polygon","rings":[[[-8838528.5419,5411850.263999999],[-8838493.8123,5411847.225599997],[-8838460.1379,5411838.202500001],[-8838428.5419,5411823.4690999985],[-8838399.9844,5411803.472900003],[-8838375.333,5411778.821500003],[-8838355.3368,5411750.263999999],[-8838340.6034,5411718.667999998],[-8838331.5803,5411684.993600003],[-8838328.5419,5411650.263999999],[-8838331.5803,5411615.534400001],[-8838340.6034,5411581.859999999],[-8838355.3368,5411550.263999999],[-8838375.333,5411521.706500001],[-8838399.9844,5411497.055100001],[-8838428.5419,5411477.058899999],[-8838460.1379,5411462.325499997],[-8838493.8123,5411453.3024],[-8838528.5419,5411450.263999999],[-8838563.2715,5411453.3024],[-8838596.9459,5411462.325499997],[-8838628.5419,5411477.058899999],[-8838657.0994,5411497.055100001],[-8838681.7508,5411521.706500001],[-8838701.747,5411550.263999999],[-8838716.4804,5411581.859999999],[-8838725.5035,5411615.534400001],[-8838728.5419,5411650.263999999],[-8838725.5035,5411684.993600003],[-8838716.4804,5411718.667999998],[-8838701.747,5411750.263999999],[-8838681.7508,5411778.821500003],[-8838657.0994,5411803.472900003],[-8838628.5419,5411823.4690999985],[-8838596.9459,5411838.202500001],[-8838563.2715,5411847.225599997],[-8838528.5419,5411850.263999999]]],"_ring":0,"spatialReference":{"wkid":102100,"latestWkid":3857}},"attributes":{"OID":4,"Name":null,"BUFF_DIST":200,"SUM_CLIPPOP":22,"SUM_CLIPEMP":37,"Shape_Length":1255.0427252029426,"Shape_Area":125026.69382473118}},{"geometry":{"type":"polygon","rings":[[[-8840687.888,5411573.179799996],[-8840653.1584,5411570.141400002],[-8840619.484,5411561.118299998],[-8840587.888,5411546.384900004],[-8840559.3305,5411526.388700001],[-8840534.6791,5411501.737300001],[-8840514.6829,5411473.179799996],[-8840499.9495,5411441.583800003],[-8840490.9264,5411407.909400001],[-8840487.888,5411373.179799996],[-8840490.9264,5411338.450199999],[-8840499.9495,5411304.775799997],[-8840514.6829,5411273.179799996],[-8840534.6791,5411244.622299999],[-8840559.3305,5411219.970899999],[-8840587.888,5411199.974699996],[-8840619.484,5411185.241300002],[-8840653.1584,5411176.218199998],[-8840687.888,5411173.179799996],[-8840722.6176,5411176.218199998],[-8840756.292,5411185.241300002],[-8840787.888,5411199.974699996],[-8840816.4455,5411219.970899999],[-8840841.0969,5411244.622299999],[-8840861.0931,5411273.179799996],[-8840875.8265,5411304.775799997],[-8840884.8496,5411338.450199999],[-8840887.888,5411373.179799996],[-8840884.8496,5411407.909400001],[-8840875.8265,5411441.583800003],[-8840861.0931,5411473.179799996],[-8840841.0969,5411501.737300001],[-8840816.4455,5411526.388700001],[-8840787.888,5411546.384900004],[-8840756.292,5411561.118299998],[-8840722.6176,5411570.141400002],[-8840687.888,5411573.179799996]]],"_ring":0,"spatialReference":{"wkid":102100,"latestWkid":3857}},"attributes":{"OID":5,"Name":null,"BUFF_DIST":200,"SUM_CLIPPOP":183,"SUM_CLIPEMP":59,"Shape_Length":1255.0427252061977,"Shape_Area":125026.69382537971}}],"exceededTransferLimit":false} ;

function Esri2geo(data){
    console.log("json converted to object");
    console.log("begin parsing json");
    var geomType,
    originCRS={
        "type": "EPSG",
        "properties": {
            "code": 3857
        }
    };
    function parseGeometryType(type){
        if (type === "esriGeometryPoint"){
            return "Point";
        }
        else if (type === "esriGeometryMultipoint") {
            return "MultiPoint";
        }
        else if (type === "esriGeometryPolyline") {
            return "LineString";
        } 
        else if (type === "esriGeometryPolygon") {
            return "Polygon";
        }
        else{
            return "Empty";
        }

    }
    function featureToGeo (feature_in,geomType){
        var geometry = {};
        geometry.type = geomType;
        // grab the rings to coordinates
        var geom = feature_in.geometry;
        var coordinates;
        if (geomType === "Polygon") {
            coordinates = geom.rings;
        } else if (geomType === "LineString") {
            coordinates = geom.paths;
        } else if (geomType === "Point") {
            coordinates = [geom.x, geom.y];
        }

        geometry.coordinates = coordinates;     
        // convert attributes to properties
        var properties = {};
        var attr = feature_in.attributes;
        for (var field in attr) {
            properties[field] = attr[field];
        }       
        var feature_out = {};
        feature_out.type = "Feature";
        feature_out.geometry = geometry;
        feature_out.properties = properties;
        return feature_out;
    }
    var result;

    geomType=parseGeometryType(data.geometryType);
    console.log(geomType);
    console.log(data.features);
    var features = [];
    for (var i = 0, feature = {}; feature = data.features[i]; i++) {
        // prepare the main parts of the GeoJSON
        var feat = featureToGeo(feature, geomType);
        features.push(feat);
    }
    var featColl = {};
    featColl.type = "FeatureCollection";
    featColl.crs= originCRS;
    featColl.features = features;
    result = JSON.stringify(featColl, function(key, value) {
        if (typeof value === 'number' && !isFinite(value)){
            return String(value);
        }
        return value;
    });
    console.log("json parsed, return it");
    //console.log(result);
    return result;
}
//var data= objectcol;
var GeoJson=Esri2geo(objectcol);
//console.log(typeof(GeoJson));
console.log(GeoJson);
$.post("http://ogre.adc4gis.com/convertJson",
    {json:GeoJson, 
    outputName:"zippedshp"
    },
    function(result){
        console.info(result);

    });

Unable to send via .net WebRequest

I have been pulling my hair out for some time now trying to send over a .net connection. I using the following code below but it keeps coming back with a "bad request" error. I'm not sure what it's having an issue with. Is this an issue with my request format or the webserver?

Example:
Stream responseStream = response.GetResponseStream();

            byte[] rawData = ConvertToByteArray(responseStream);
            using (HttpClient client = new HttpClient())
            {
                using (MultipartFormDataContent formData = new MultipartFormDataContent())
                {
                    formData.Add(new ByteArrayContent(rawData, 0, rawData.Length), "Upload");
                    using (var message = await client.PostAsync("http://ogre.adc4gis.com/convert", formData))
                    {
                        var result = await message.Content.ReadAsStreamAsync();
                    }
                }
            }

Any insight or better way to do it would be much appreciated. Thanks!

On error respond with a http status code other than 200

Enhancement.

Today if one have to check if there was an error response when converting we need to parse the whole response content and check if the error field is present.

An easier way would be to respond with another http status code other than 200 (Ok), 400 (Bad Request) for example.

A suggestion for a future PR:

Set status to 400 (Bad Request) at:

Set status 503 (Service Unavailable) at:

how to let ogre run on windows

i had install the osgeo4w run in windows 7 .
then i download the wavded/ogre , how could i let the wavded/ogre run on windows ?

Request Entity Too Large

Hi :)

As part of my app, I convert GeoJson files into Shapefiles. The tool worked great before v0.8.0, but it is giving me this error message after and including v0.8.0:
{"error":true,"msg":"request entity too large"}

The json file itself is quite large but it used to convert successfully. Any ideas why this issue might be happening?

Thanks!

SHP to GeoJson conversion

I'm trying to convert a simple shapefile to GeoJson, and I'm getting this error back:

{"errors":["ERROR 4: Unable to open /tmp/25305-17005vw.shx or /tmp/25305-17005vw.SHX.","FAILURE:","Unable to open datasource `/tmp/25305-17005vw.shp' with the following drivers."," -> ESRI Shapefile"," -> MapInfo File"," -> UK .NTF"," -> SDTS"," -> TIGER"," -> S57"," -> DGN"," -> VRT"," -> REC"," -> Memory"," -> BNA"," -> CSV"," -> NAS"," -> GML"," -> GPX"," -> LIBKML"," -> KML"," -> GeoJSON"," -> Interlis 1"," -> Interlis 2"," -> GMT"," -> GPKG"," -> SQLite"," -> DODS"," -> ODBC"," -> WAsP"," -> PGeo"," -> MSSQLSpatial"," -> OGDI"," -> PostgreSQL"," -> MySQL"," -> PCIDSK"," -> OpenFileGDB"," -> XPlane"," -> AVCBin"," -> AVCE00"," -> DXF"," -> Geoconcept"," -> GeoRSS"," -> GPSTrackMaker"," -> VFK"," -> PGDump"," -> OSM"," -> GPSBabel"," -> SUA"," -> OpenAir"," -> PDS"," -> WFS"," -> HTF"," -> AeronavFAA"," -> Geomedia"," -> EDIGEO"," -> GFT"," -> GME"," -> SVG"," -> CouchDB"," -> Idrisi"," -> ARCGEN"," -> SEGUKOOA"," -> SEGY"," -> XLS"," -> ODS"," -> XLSX"," -> ElasticSearch"," -> PDF"," -> Walk"," -> CartoDB"," -> SXF",""]}

I know that the shapefile is valid because I got it from the same ogre utility page, using the convert-to- geojson sample GeoJson to shapefile.

Can anyone please tell me what am I missing or doing wrong here?

Thanks.

ogre:command not found

success install node &npm &apache2 ,then i ruan the npm install ogre . the command is sliently executed.
but when i want to run "ogre" the termimal tell me "ogre:command not found" anyone know why ?

Using CURL PHP Request

Hi and Hello Wavded. I develope a website application and using ogr2ogr on my localhost via npm. I did try using CURL for converting geojson files to shapefiles but to no avail it returns some weird text. I can't download the Zip Files.

PK�����VH.I�OGRGeoJSON.dbfc�g�bd``hd��$�@8�C^bn*T��D��)�J�e�T�D�������8�畤b��Up��/*Vp�L�IQ��pJ,NMJ��Q�.IL�,ͥ�̐��b� *�H-JU(�HU��O��L-V(�I�T$�xPK������wr�PK�����VH.I�OGRGeoJSON.prjsw�ww��V����������&J:.�!���J.HB����A��.�J�ef������:F��zF��FFƦfƱ�:�A���@��E��y����J:��:�~�!@3SӁ�@�=�Cs�Sc#K#SCKK� �46�PK����Qjy�PK�����VH.I�OGRGeoJSON.shpcP�b���^0300������9�>��}�c������|��QDA�pa3�PK������-�PK�����VH.I�OGRGeoJSON.shxcP�b���^0300������9�>��}�c������|��QD��<.PK��χy�+lPK�������VH.I����wr�� ��OGRGeoJSON.dbfPK�������VH.I��Qjy�� ���OGRGeoJSON.prjPK�������VH.I����-�� ��h�OGRGeoJSON.shpPK�������VH.Iχy�+l� ����OGRGeoJSON.shxPK�����8�

I also did try using POST Request to live website and it returns same result. I'm currently new with this..is there anything wrong or maybe you can point me the correct ways? Thanks in a bunch.

Here are the codes :

'<?php

$data = file_get_contents('data/tes_data.js');
$url_send ="http://localhost:3000/convertJson";
$str_data = json_encode($data);

$ch = curl_init($url_send);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'json=$data');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'skipFailures=1');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
var_dump($str_data);
return $result;
curl_close($ch);
?>'

the tes_data.js are some examples:

'{
"type": "Feature",
"properties": {
"name": "Coors Field",
"amenity": "Baseball Stadium",
"popupContent": "This is where the Rockies play!"
},
"geometry": {
"type": "Point",
"coordinates": [-104.99404, 39.75621]
}
}'

ogre:command not found

i use node v0.4.8 and install npm install -g ogre success .
but when i type ogre to running .

i got
xxx@ubuntu~/ogre$ogre
ogre:command not found

anything wrong?

Invalid signature

Hi, sometimes when i try to convert a .zip file with a shapefile inside i get this response:

{
error: true,
msg: "invalid signature: 0x8080014"
}

any ideas about how to resolve this error??

Allow fetching of input json from web url

It would be nice if the ogre web service would allow the input source to be a remote url instead of just a file source. e.g. http://services.arcgis.com/bwohQKLjesdlkj2897642/ArcGIS/rest/services/My_Custom_Service/FeatureServer/0?f=pjson

just something to think about :)

how to use Post to download zip shapefile itself?

Thanks for sharing this great tool

I have tried to use Post request in my code to get zipped file download through web client, but no clue how to do it in callback function to fullfil the same ability as the convert button "Convert to Shapefile" does.

Could you please provide newbies some help? Many Thanks

Results differ between web, api

I have a zipped shapefile that I'm converting to GeoJSON. The results seem to differ depending on whether I use the web interface or the REST API. Results are at https://gist.github.com/bgschiller/1359832a4e14edc8f3bf, though you'll have to click through to 'raw' in order to see the JSON.

When I use the form upload at http://ogre.adc4gis.com/, the results are in EPSG:4326. For example, the first point of the first polygon is [ -0.892238897814033, 9.491482735323443 ]. These are the results I expect, and hope for.

When I use the api, the results are not lat/lon pairs. For example, the first point of the first polygon is [ 731400.951299999840558, 1049891.9822 ], which is wildly out of range for latitude and longitude.

The zipped shapefile I'm using is available at https://www.dropbox.com/s/bx8q190y31c01tj/ogre_issue_example.zip
It is in UTM, but includes the .prj file.

On the web interface, i'm only filling in the fields for File, and Target SRS. File is ogre_issue_example.zip and Target SRS is EPSG:4326.

With curl, I'm using the following line:

curl -X POST -F targetSrs=EPSG:4326 -F upload=@ogre_issue_example.zip http://ogre.adc4gis.com/convert

I also tried using the python requests library, with

r = requests.post('http://ogre.adc4gis.com/convert',
          params={
                  'targetSrs':'EPSG:4326'
                  },
          files={
                 'upload':open('ogre_issue_example.zip','rb')
                 })

The results were the same as with curl.

Any advice is much appreciated. Thank you!

WFS Support

It would be great to use WFS Service URL's as Input instead of GEOJSON or Files.
WFS2Shape is what I need.

Conversion to meters instead of degrees

I noticed when I did a conversion to geojson from a .shp file that I ended up with geojson in an amount that had to be in meters, since the coordinates were way too large to be in degrees.

Is there a way to request this conversion be output in degrees, or is that set in the .shp file? There are too many points, and too great of a worry about inaccuracy to try doing a mathematical transformation on the resultant geojson.

File support

Ogre is already awesome and would be great with DWG, MIF, and DGN V8 support.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.