[mapserver-users] GeoJSON output from MapServer

Dejan.Gambin at pula.hr Dejan.Gambin at pula.hr
Mon Jul 6 23:37:54 PDT 2009


Thanks Steve,

I did all that and I get:

loadOutputFormat(): General error message. OUTPUTFORMAT clause references 
driver TEMPLATE, but this driver isn't configured. 

Do I have an older MapServer version? Currently, I run this on ms4w 2.2.7 
(MapServer 5.0.2), but as I remember, I have also tried with 3.0-beta3 
(MapServer 5.4.0) and got the same result. 

Does it mean this driver is not supported in those versions?

regards, dejan

mapserver-users-bounces at lists.osgeo.org wrote on 06.07.2009 18:00:03:

> Two things:
> 
> 1) TEMPLATE is a keyword and must be quoted at the moment, so use 
> DRIVER 'TEMPLATE'
> 
> 2) The file to be used in the OUTPUTFORMAT is given like this:
> 
>   FORMATOPTION 'FILE=/some/template/file/...'
> 
> 3) You're call to MapServer needs to be a query. For example:
> 
>   http://localhost/cgi-bin/mapserv.exe?
> map=/ms4w/apps/pmapper/pmapper-3.2.0/config/default/geojson_demo.
> map&layer=countries&mode=nquery&qformat=geojson
> 
> This call will use all the default EXTENT value in the mapfile to 
> query all eligible layers and run the
> results through the geojson driver.
> 
> I'm doing this to produce javascript code that gets executed by an 
> Ext.JS component. Not purely
> GeoJSON but it works similarly.
> 
> Steve
> 
> >>> On 7/2/2009 at 4:15 PM, in message
> <OFA82DFB5F.67E53647-ONC12575E7.0073E271-C12575E7.0074CA4C at pula.hr>,
> <Dejan.Gambin at pula.hr> wrote:
> > Steve,
> > 
> > Is there any GeoJSON example I can see? I must be missing something 
> > trivial,
> > 
> > When I put:
> > 
> > OUTPUTFORMAT
> >   NAME 'geojson'
> >   DRIVER TEMPLATE
> >   MIMETYPE 'application/json; subtype=geojson'
> >   TEMPLATE 'myTemplate.js'
> > END
> > 
> > in my.map file and call for example 
> > "http://localhost/cgi-bin/mapserv.exe?
> map=/ms4w/apps/pmapper/pmapper-3.2.0/con 
> > fig/default/geojson_demo.map&layer=countries" 
> > (this works correctly without geojson part), I get: getString(): 
Symbol 
> > definition error. Parsing error near (TEMPLATE):(line 74) 
> > 
> > If I put DRIVER 'TEMPLATE' then I get: loadOutputFormat(): Unknown 
> > identifier. Parsing error near (TEMPLATE):(line 76) 
> > 
> > Finally, putting FORMATOPTION 'FILE=myTemplate.js' instead of TEMPLATE 

> > gives me: loadOutputFormat(): General error message. OUTPUTFORMAT 
clause 
> > references driver TEMPLATE, but this driver isn't configured. 
> > 
> > So, I am obviously doing something wrong regardless the myTemplate.js 
> > file? (anyway, can you give me an example .js file, anything that 
could 
> > help :-)
> > 
> > regards, dejan
> > "Steve Lime" <Steve.Lime at dnr.state.mn.us> wrote on 02.07.2009 
15:35:28:
> > 
> >> What does myTemplate.js look like?
> >> 
> >> >>> <Dejan.Gambin at pula.hr> 07/02/09 5:33 AM >>>
> >> Thanks Fabio,
> >> 
> >> As I said in my last post, I can't get GeoJSON output using this 
> >> outputformat:
> >> 
> >> OUTPUTFORMAT
> >>   NAME 'geojson'
> >>   DRIVER 'TEMPLATE'
> >>   MIMETYPE 'application/json; subtype=geojson'
> >>   FORMATOPTION 'FILE=myTemplate.js'
> >> END
> >> 
> >> :-(
> >> 
> >> regards, dejan
> >> 
> >> Fabio D'Ovidio <fabiodovidio at gmail.com> wrote on 02.07.2009 09:28:06:
> >> 
> >> > Hi,
> >> > 
> >> > Dejan.Gambin at pula.hr ha scritto:
> >> > >
> >> > > Fabio,
> >> > >
> >> > > Glad to here you are here too :-)
> >> > >
> >> > > I can certainly use both GeoServer and MapServer but this is not 
> >> > > something I would like at the end. Since I am still investigating 

> > all 
> >> > > this, I am not in such a hurry to get it working with my data 
ASAP. 
> >> > > So, I would rather go with one of your Mapserver solutions.
> >> > It is not so difficult...just 2, 3 minutes to load your layer in 
> >> > GeoServer ;-)
> >> > 
> >> > >
> >> > > My first question, to be sure - so MapOl reads/gets the GeoJSON 
data 
> > 
> >> > > from Geoserver WFS and outputs GeoJSON data to WebClient? If I 
> >> > > understand Steve correctly, there is no way currently to get 
GeoJSON 
> > 
> >> > > output from MapServer WFS, only with CGI? So we come to your 
> > solution 
> >> 2.
> >> > 
> >> > If you want to use the second solution you must create the HTTP 
string 
> > 
> >> > to get GeoJSON from CGI-MapServer and than you must change MapOl 
> > request 
> >> 
> >> > to receive data and read them.
> >> > If you want send me the URL and I'll send you the new MapOl as soon 
as 
> > 
> >> > possbile!
> >> > 
> >> > 
> >> > -- 
> >> > Fabio D'Ovidio
> >> > Geospatial solutions
> >> > 
> >> > Inova S.r.l.
> >> > Web : http://www.inovaos.it 
> >> > GeoBI Blog: www.geobi.org 
> >> > Tel.: 081 197 57 600
> >> > mail: fabiodovidio at gmail.com, f.dovidio at inovaos.it 
> >> > skype: dovidio_fa
> >> > 
> >> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090707/261d3fb8/attachment.htm>


More information about the MapServer-users mailing list