I downloaded a mbtiles file from this location:
https://openmaptiles.com/downloads/europe/netherlands/
I can serve this file in PHP with this library : https://github.com/klokantech/tileserver-php
This returns a compressed PBF, which Mapbox GL JS can use, but I'm not able in PHP to decode this data to get information out of it.
Has anybody ever extracted data from PBF using PHP ?
I know that this thread is a little bit old right now, but I will answer this anyway in case someone bumps into this issue.
You can use package named osm-pbf, for reading PBF files using PHP. As far as I know, it is currently the only option if you want to use PHP.
Link to package: https://github.com/franksierra/osm-pbf
Installation is fairly easy, you can just use composer.
The library itself is pretty slow, it takes around 8 minutes to read 300MB PBF file, but for smaller files it works like a charm.
Related
I am woking on exporting datas to excel file from mysql.I google some docs and finally I choose the PHPExcel,it works well and I can successfully complete my work.
but when I upload my code to the online server,it display an error which is "XMLWriter is not found",I also google for this and I know it because the installed php isn't compiled with the class "XMLWriter ",but the question is I have no privilege to recompile the php source.
so if there is other open source class that is used to export data to excel file?
I hope I describe my question clearly.
If you can avoid using PHPExcel, have a look at this tutorial for a plain and simple solution, it might help.
Since you have no control on your PHP installation, I strongly suggest you to abandon PHPExcel, as your PHP version does not include the needed libraries for this package and you don't want to go though painful hacks to make it work somehow...
Hi I have a MAMP server set up on a mac I am using and I have this displaying a calendar using the php icalendar source code. I am trying to have this display a public calendar which I can do but I need it to be up to date so I need it to import the Calendars csv file regularly. So my question is does anyone know how I could go about programmatically exporting a .csv file from a public calendar and how I could then import it into a certain location on a server again via a script or code?
Thanks a lot
There are a lot of ways to download the .csv file.
You could use fopen, cURL to download the file. For fopen you need to enable to read files from an url.
An other way, must be supported by the other party. Is to use ftp.
I think the best way for these is just look at php.net how to let them work.
Second you want to make a scheduld job. I don't know it in macs, but with linux you can make cron's you can say these need to be run every x time (1min, 1day 1 week).
In the script you do the download and update part.
Hope it helps
What I'd like to do
I'd like to allow a user to download a dynamically generated pdf file (certificate). I was thinking of creating a pdf template and just write the user's name on it with PHP, that's the only thing that will be dynamic about this.
How I'd like to do it
Since the application is for a client and I have no idea on what server will he use it I'd like to know if there are ways of achieving this without any extra extensions or whatsoever to be installed on the server. I can assume he has PHP > 5.
Basically read the template pdf and write a string to it then save it to be able to offer for download, all this with PHP?
doing this with pure php on your own will get very messy, so i recommend using FPDF in combination with FPDI (to open your templates). both can easily be added to your projects sources, so you don't need to install any extensions (unless you want to compress your PDFs - in that case you'll need zlib installed).
I want to write multiple image files to a odt file. I will be specifying a dir and the script will take it from there thru a loop. But where do i start? I have never done anything like this before!
I found this python code, which can convert html 2 python... so we can parse an html first and then call this one. But there is no reference on how to use this.
html2odt code
Atlast I found a PHP way to write odt direct! Its well documented.
http://www.odtphp.com/
I have also written a complete practical solution in php. You can upload multiple images and get the odt document generated.
The code is hosted at http://code.google.com/p/images2odt/
The first post is done here.
For anyone wanting to use the Python code will need a Python interpreter version 2.6. It might also work with version 2.7. It's mainly used in Linux but there are Windows and Mac versions as well. You will also need the files listed in the from and import statements. These files are in some of the other folders. It looks like it is a part of a much bigger Linux package. One last thing, Python scripts usually takes their arguments from a command line.
Additional info:
I looked over the setup.py file and it told me that this is an API library for open documents called odfpy. The version is 0.9.2. The link it has for the documentation is broken. A google search for odfpy came up with a place to download a more recent version (0.9.4) in a tarbell here:
http://pypi.python.org/pypi/odfpy
The documentation can be found here in an Open Office document:
https://joinup.ec.europa.eu/software/odfpy/document/api-odfpyodt
Looking for a way to enable someone to upload a single file which will be series of image files (all gif) merged together as one big file. Here is what I need to do:
Using VB6, want to merge the image files (potentially dozens of them) into a single file
Upload file to a PHP Script (easy enough)
Have PHP break apart the single file and write image files
I know how to handle the uploading of the file. I also know how to write the image files in PHP. What I am unsure of is the merging/un-merging operation.
In theory, I should just be able to use VB6 to merge all images using binary read/writing. However, does anyone know the series of binary codes that prefix each .gif file so PHP can pick up on that, or do I need to write some sort of binary separator in between each merged image?
I could surely tinker with this myself, but I thought some of you smarter-than-me coders may have already done this, and/or could provide a link, some code, or some 'things to consider'.
Thanks.
Instead of merging/un-merging, if the whole purpose is to avoid overhead of sending dozens of files, why not zipping them and unzipping in PHP?
That should be far easier than the merging operation you're proposing.
Here's a free Zip/Unzip library for Windows: Info-ZIP
Here's some sample code that uses Info-ZIP: Zip and Unzip Using VB5 or VB6
Here's PHP's documentation on the ZIP module: php.net/zip
Here's an example of how to use "unzip" command through PHP, rather than using the Zip module: Zipping and Unzipping Files with PHP
Google is your friend :)