[MS4W-Users] Query and Write to File Geodatabase?
TC Haddad
tchaddad at gmail.com
Thu May 23 12:06:40 EDT 2019
Hi,
to run gdal / ogr commands in MS4W you should first run the setenv.bat file
that is at the root of the MS4W project. After doing that you should be
able to run "ogrinfo --formats" from any location, and it should work.
One approach to your problem with the queries might be to try to set up the
data set as a WFS service, which you can then query and the WFS can be set
to return sets of results in a number of formats (e.g. geojson might be
most useful for your use case).
If that sounds useful you can follow the regular MapServer docs for setting
up a WFS:
https://mapserver.org/ogc/wfs_server.html
And for geojson output you can define an output format in your map file
like this:
OUTPUTFORMAT
NAME "geojson"
DRIVER "OGR/GEOJSON"
MIMETYPE "application/json; subtype=geojson"
FORMATOPTION "STORAGE=stream"
FORMATOPTION "FORM=SIMPLE"END
On Thu, May 23, 2019 at 5:58 AM igis--- via MS4W-Users <
ms4w-users at lists.ms4w.com> wrote:
> We have an ESRI File Geodatabase (OpenFileGDB) folder/database and are
> trying to work with it using MS4W and SWIG MapScript PHP. It's working
> well to create maps and get data and query by shape and point, but I've
> been asked to look into a couple other things and I'm not having much luck,
> and would appreciate any clarification or pointers in the right direction.
>
> 1) We'd like to be able to use PHP to get data from specific GDB tables.
> For example, with a restaurant table with a street_name column in the
> attribute table, we'd like to be able to query and produce a report saying
> Main St has 8 and Elm has 2, etc. In a SQL based database it's like
> "SELECT DISTINCT street_name, COUNT(street_name) FROM restaurant GROUP
> BY street_name;" and you get results rather quickly. However, I've only
> been able to compile this information by looping through all the records in
> the table and adding it to a PHP array which is slow and inefficient. Is
> there a better way to do this that I'm missing?
>
> 2) In the near future, we'd like to be also write drawn lines or shapes to
> a table in the GDB over the web using PHP. Is this even possible? At
> https://mapserver.org/input/vector/filegdb.html the sample "ogrinfo
> --formats" lists FileGDB as read/write but
> https://www.gdal.org/drv_openfilegdb.html says the GDAL OpenFileGDB
> driver is read-only. Furthermore, when I run "ogrinfo --formats"
> from C:\ms4w\tools\gdal-ogr\ I get an error that "The code execution
> cannot proceed because gdal204.dll was not found. Reinstalling the program
> may fix this problem." so I'm not sure how to proceed, or if I'm even on
> the right path.
>
> Thanks for any comments, clarification, or pointers!
>
> PS > It appears the link on
> https://mapserver.org/input/vector/filegdb.html to OGR driver page needs
> to be updated from https://www.gdal.org/ogr/drv_filegdb.html (404) to I
> believe https://www.gdal.org/drv_openfilegdb.html. This looks like it
> may affect a lot of links to GDAL.org for the databases on
> https://mapserver.org/input/ if anyone here has access and time to update.
>
> _______________________________________________
> MS4W-Users mailing list
> MS4W-Users at lists.ms4w.com
> https://lists.ms4w.com/mailman/listinfo/ms4w-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ms4w.com/pipermail/ms4w-users/attachments/20190523/7afcce36/attachment.html>
More information about the MS4W-Users
mailing list