Re: [GRASS-user] Vector drawings in PDF - converting them
Kurt, I now have a pdf map from which I want to pull some vector data and use in a GIS. I am curious to hear about your workflow with this process. For me, I ran the command below and got a single-layer dxf file that does not seem to be amenable to useful work in a GIS environment. Would you mind sharing some details about how you work through the pdf to vector data process beyond getting the dxf file? Thanks, John On Jan 19, 2008, at 9:42 PM, Kurt Heston wrote: John, Excellent! Works flawlessly. Just a little experimenting yielded this command: pstoedit.exe -f dxf_s:-splineaspolyline roads.pdf roads.dxf Without the -splineaspolyline argument the DXF looks just like the other conversions that didn't work. I now have a solution with the right licensing model. Thanks for the suggestion! --Kurt John C. Tull wrote: I found this with a search of freshmeat.net. Perhaps it will work, and free. Let us know. http://www.pstoedit.net/ Cheers, John On Jan 19, 2008, at 6:43 PM, Kurt Heston wrote: Paul, That tool works GREAT! I tried it, half expecting it to simply discard what it couldn't convert like all of the open-source tools I'd found prior, but it worked...and well. All of the objects the PDF had to offer came right over. Interestingly, Illustrator complains before it opens the DXFs the tool produces, but Grass is delighted with them. My guess is the AideCad people are formatting the DXF using an older standard. Part of what I'm doing with the GIS project I'm working on is trying to convince my client that OS is the way to go (they are a non-profit). Having to buy a product to do this part of the data conversion with a non-GPL app doesn't help with that part of things. However, it's great to have something that works. Thanks for the suggestion! --Kurt ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Vector drawings in PDF - converting them
Hamish wrote: I found this with a search of freshmeat.net. Perhaps it will work, and free. Let us know. http://www.pstoedit.net/ Kurt Heston wrote: Excellent! Works flawlessly. Just a little experimenting yielded this command: pstoedit.exe -f dxf_s:-splineaspolyline roads.pdf roads.dxf Without the -splineaspolyline argument the DXF looks just like the other conversions that didn't work. I now have a solution with the right licensing model. Thanks for the suggestion! (The code is GPL2) Display of PS/EPS in a GRASS monitor- looking at src/drvsampl.cpp and drvsampl.h, the primitive commands are very close to d.graph's set (which reflects grass's raster graphics lib): move to, line to, rectangle, set line color, set fill color, etc. so it would probably be fairly simple for someone to write a d.graph input file plugin for pstoedit, or incorporate the PS reading/sanitizing code to let d.graph render PS files in the xmon. (e.g. .eps logo) Not quite. The PS/PDF moveto/lineto commands construct paths which are subsequently either stroked or filled, while the GRASS equivalents automatically stroke the path. To display PS/PDF vector data using the GRASS display system, you would need to accumulate the moveto/lineto commands into a buffer, then either replay the data using R_move_abs/R_cont_abs or use it to construct a polygon to be filled with R_polygon_abs. In the case of filling, there may be issues with complex areas. PS/PDF provides a choice of non-zero and even-odd winding rules (fill and eofill operators respectively), while GRASS only provides even-odd. Perhaps wxPython's GUI canvas is able to directly render PS already??? (no idea) If so this would be a lower priority, but still interesting. Processing arbitrary PostScript is complex enough that all practical options involve Ghostscript. This is true whether you're rasterising or converting to some other vector format. The latter case normally involves using one of Ghostscript's vector output drivers, e.g. PCL or PDF, or even the pswrite driver (which outputs relatively flat PostScript using a limited set of operators). -- Glynn Clements [EMAIL PROTECTED] ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Vector drawings in PDF - converting them
John Tull wrote: I found this with a search of freshmeat.net. Perhaps it will work, and free. Let us know. http://www.pstoedit.net/ Kurt Heston wrote: Excellent! Works flawlessly. Just a little experimenting yielded this command: pstoedit.exe -f dxf_s:-splineaspolyline roads.pdf roads.dxf Without the -splineaspolyline argument the DXF looks just like the other conversions that didn't work. I now have a solution with the right licensing model. Thanks for the suggestion! (The code is GPL2) Display of PS/EPS in a GRASS monitor- looking at src/drvsampl.cpp and drvsampl.h, the primitive commands are very close to d.graph's set (which reflects grass's raster graphics lib): move to, line to, rectangle, set line color, set fill color, etc. so it would probably be fairly simple for someone to write a d.graph input file plugin for pstoedit, or incorporate the PS reading/sanitizing code to let d.graph render PS files in the xmon. (e.g. .eps logo) Perhaps wxPython's GUI canvas is able to directly render PS already??? (no idea) If so this would be a lower priority, but still interesting. Import as vector map- Translating moveto and lineto commands into coordinates for standard GRASS ascii format (for v.in.ascii) with a pstoedit plugin would be a little more work, but fairly trivial. And using their code to make a v.in.ps module seems feasible too if someone wished to make that. (then like DXF you'd use v.transform to adjust from XY to map coords) Certainly converting PDF or PS to another vector format with a rasterization step degrades the data unnecessarily. Another tool which could be useful is pdftk. If you uncompress the PDF with that you get text-editor access to the PostScript within, and then it's just translating ps draw commands to coordinates. It's highly useful for other PDF tasks too. http://www.pdfhacks.com/pdftk/ Hamish Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Vector drawings in PDF - converting them
Paul, That tool works GREAT! I tried it, half expecting it to simply discard what it couldn't convert like all of the open-source tools I'd found prior, but it worked...and well. All of the objects the PDF had to offer came right over. Interestingly, Illustrator complains before it opens the DXFs the tool produces, but Grass is delighted with them. My guess is the AideCad people are formatting the DXF using an older standard. Part of what I'm doing with the GIS project I'm working on is trying to convince my client that OS is the way to go (they are a non-profit). Having to buy a product to do this part of the data conversion with a non-GPL app doesn't help with that part of things. However, it's great to have something that works. Thanks for the suggestion! --Kurt PA Light wrote: Try Aide PDF to DXF Converter http://www.aidecad.com/pdf-to-dxf-converter.html I've successfully used it to convert PDF to DXF. Aide offers a free trial version good for 20 conversion, after which you will be required to purchase a licence. Cheers, Paul -Original Message- From: Kurt Heston [SMTP:[EMAIL PROTECTED] Sent: Thursday, January 17, 2008 8:42 PM To: grass-user@lists.osgeo.org Subject:Re: [GRASS-user] Vector drawings in PDF - converting them Grass 6.2 appears to be even less agreeable to the DXF format that Inkscape writes than it was to the one Illustrator did. I'm still playing with it, but no luck yet. Dylan Beaudette wrote: On Thursday 17 January 2008 11:10:39 am Kurt Heston wrote: Dylan, Will do. Is there a specific feature I should look for that solves my specific problem? --K Kurt- Well, I would take a look at all of the vector (path) tools available in Inkscape. I have not used to to work with much GIS data, but I do know that it can import PDF data as vector (path) primitives. Feel free to post your findings back to the list. Cheers, Dylan Dylan Beaudette wrote: On Wednesday 16 January 2008 11:22:02 pm Kurt Heston wrote: I have a TON of vector drawings available to me in PDF format that I'm georeferencing. So far, I'm doing it by converting them to PNGs and using r.to.vect to massage them. This is really tedious and the data isn't as clean as a straight vector conversion would be. In Illustrator, I can see that all the vector math is there. That is, the PDF isn't simply a wrapper around raster data. I've tried opening the PDFs in Illustrator and exporting them as DXFs, but Grass ignores a lot of the data when I do this...they look very different in Grass once imported. I can export them as SVG from Illustrator, but surprisingly, there doesn't appear to be a single open-source tool available out there that converts SVG into some mainstream GIS file format. Does anyone have experience doing this type of conversion? Pointers welcome. ___ Check out Inkscape. Dylan ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Vector drawings in PDF - converting them
I found this with a search of freshmeat.net. Perhaps it will work, and free. Let us know. http://www.pstoedit.net/ Cheers, John On Jan 19, 2008, at 6:43 PM, Kurt Heston wrote: Paul, That tool works GREAT! I tried it, half expecting it to simply discard what it couldn't convert like all of the open-source tools I'd found prior, but it worked...and well. All of the objects the PDF had to offer came right over. Interestingly, Illustrator complains before it opens the DXFs the tool produces, but Grass is delighted with them. My guess is the AideCad people are formatting the DXF using an older standard. Part of what I'm doing with the GIS project I'm working on is trying to convince my client that OS is the way to go (they are a non- profit). Having to buy a product to do this part of the data conversion with a non-GPL app doesn't help with that part of things. However, it's great to have something that works. Thanks for the suggestion! --Kurt ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Vector drawings in PDF - converting them
John, Excellent! Works flawlessly. Just a little experimenting yielded this command: pstoedit.exe -f dxf_s:-splineaspolyline roads.pdf roads.dxf Without the -splineaspolyline argument the DXF looks just like the other conversions that didn't work. I now have a solution with the right licensing model. Thanks for the suggestion! --Kurt John C. Tull wrote: I found this with a search of freshmeat.net. Perhaps it will work, and free. Let us know. http://www.pstoedit.net/ Cheers, John On Jan 19, 2008, at 6:43 PM, Kurt Heston wrote: Paul, That tool works GREAT! I tried it, half expecting it to simply discard what it couldn't convert like all of the open-source tools I'd found prior, but it worked...and well. All of the objects the PDF had to offer came right over. Interestingly, Illustrator complains before it opens the DXFs the tool produces, but Grass is delighted with them. My guess is the AideCad people are formatting the DXF using an older standard. Part of what I'm doing with the GIS project I'm working on is trying to convince my client that OS is the way to go (they are a non-profit). Having to buy a product to do this part of the data conversion with a non-GPL app doesn't help with that part of things. However, it's great to have something that works. Thanks for the suggestion! --Kurt ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Vector drawings in PDF - converting them
ok, the problems are with the curves. The ogr2ogr tool has a converter from Interlis to other ogrformats. Interlis supports arcs (defined by three points). They also calculate new vertices along the arcs to be compatible to other formats that don't support curves. One can define how many Every SVG viewer has code on how to display curves (arcs, quadratic and cubic spline curves). But I don't know if you can dig up and work with that code directly. Many of them probably forward their drawing commands to underlying graphics libraries like Cairo, AGG, OpenVG, Java2D, etc. As you said, you might also want to ask the Batik developers on the Batik list. These people are usually friendly and often help where they can. Andreas Andreas, Thanks for you comments. I agree completely. The curves are definitely where the problem lies. There would need to be a clever algorithm that converted them to polylines with some sort of configurable resolution. However, my guess is the code used convert SVG to raster formats like TIF and PNG has to do something similar. I began looking into using the facilities in Batik to accomplish this. The PNGTranscoder looks to be a good place to start. Haven't gotten very far in this past weekend when I began to look into it, no blatant roadblocks yet. --Kurt Andreas Neumann wrote: Hi, I don't have an immediate solution to your problem, however, I would like to discuss the use of the SVG format. Also, are you using curves in your original data? SVG would be a great format for transforming non-GIS vector maps into a GIS format. But it is not so surprising that most GIS only export and don't import SVG. SVG is usually a presentation format, not a transfer format for GIS data. Also, SVG has a lot of features that can't be easily transfered to GIS - think about elliptical arcs, cubic and quadratic spline curves. Those would have to be transfered into the OGC geometry models, where support for curves is more or less in its infancy. A number of GIS software allows the export of SVG, not always in a very form, though: Postgis (ok), Grass (did not try that), Mapserver (haven't tried that), ESRI (crappy, they seem to have some sort of resolution for their vector export). But, I think it would be great to have svg support incorporated into the ogr tools. It would make sense, also since FME and other OS and commercial GIS support SVG. Andreas I have a TON of vector drawings available to me in PDF format that I'm georeferencing. So far, I'm doing it by converting them to PNGs and using r.to.vect to massage them. This is really tedious and the data isn't as clean as a straight vector conversion would be. In Illustrator, I can see that all the vector math is there. That is, the PDF isn't simply a wrapper around raster data. I've tried opening the PDFs in Illustrator and exporting them as DXFs, but Grass ignores a lot of the data when I do this...they look very different in Grass once imported. I can export them as SVG from Illustrator, but surprisingly, there doesn't appear to be a single open-source tool available out there that converts SVG into some mainstream GIS file format. Does anyone have experience doing this type of conversion? Pointers welcome. -- Andreas Neumann Böschacherstrasse 6, CH-8624 Grüt/Gossau, Switzerland Email: [EMAIL PROTECTED], Web: * http://www.carto.net/ (Carto and SVG resources) * http://www.carto.net/neumann/ (personal page) * http://www.svgopen.org/ (SVG Open Conference) * http://www.geofoto.ch/ (Georeferenced Photos of Switzerland) ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Vector drawings in PDF - converting them
Within Illustrator maybe you can build a script that adds intermediate points to curves (don't really remember, but it sounds like 'densify paths', or 'add anchor points'), attended that vertices will be recognized when imported Vincent Le jeudi 17 janvier 2008 à 09:03 +0100, Andreas Neumann a écrit : ok, the problems are with the curves. The ogr2ogr tool has a converter from Interlis to other ogrformats. Interlis supports arcs (defined by three points). They also calculate new vertices along the arcs to be compatible to other formats that don't support curves. One can define how many Every SVG viewer has code on how to display curves (arcs, quadratic and cubic spline curves). But I don't know if you can dig up and work with that code directly. Many of them probably forward their drawing commands to underlying graphics libraries like Cairo, AGG, OpenVG, Java2D, etc. As you said, you might also want to ask the Batik developers on the Batik list. These people are usually friendly and often help where they can. Andreas Andreas, Thanks for you comments. I agree completely. The curves are definitely where the problem lies. There would need to be a clever algorithm that converted them to polylines with some sort of configurable resolution. However, my guess is the code used convert SVG to raster formats like TIF and PNG has to do something similar. I began looking into using the facilities in Batik to accomplish this. The PNGTranscoder looks to be a good place to start. Haven't gotten very far in this past weekend when I began to look into it, no blatant roadblocks yet. --Kurt Andreas Neumann wrote: Hi, I don't have an immediate solution to your problem, however, I would like to discuss the use of the SVG format. Also, are you using curves in your original data? SVG would be a great format for transforming non-GIS vector maps into a GIS format. But it is not so surprising that most GIS only export and don't import SVG. SVG is usually a presentation format, not a transfer format for GIS data. Also, SVG has a lot of features that can't be easily transfered to GIS - think about elliptical arcs, cubic and quadratic spline curves. Those would have to be transfered into the OGC geometry models, where support for curves is more or less in its infancy. A number of GIS software allows the export of SVG, not always in a very form, though: Postgis (ok), Grass (did not try that), Mapserver (haven't tried that), ESRI (crappy, they seem to have some sort of resolution for their vector export). But, I think it would be great to have svg support incorporated into the ogr tools. It would make sense, also since FME and other OS and commercial GIS support SVG. Andreas I have a TON of vector drawings available to me in PDF format that I'm georeferencing. So far, I'm doing it by converting them to PNGs and using r.to.vect to massage them. This is really tedious and the data isn't as clean as a straight vector conversion would be. In Illustrator, I can see that all the vector math is there. That is, the PDF isn't simply a wrapper around raster data. I've tried opening the PDFs in Illustrator and exporting them as DXFs, but Grass ignores a lot of the data when I do this...they look very different in Grass once imported. I can export them as SVG from Illustrator, but surprisingly, there doesn't appear to be a single open-source tool available out there that converts SVG into some mainstream GIS file format. Does anyone have experience doing this type of conversion? Pointers welcome. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Vector drawings in PDF - converting them
Dylan, Will do. Is there a specific feature I should look for that solves my specific problem? --K Dylan Beaudette wrote: On Wednesday 16 January 2008 11:22:02 pm Kurt Heston wrote: I have a TON of vector drawings available to me in PDF format that I'm georeferencing. So far, I'm doing it by converting them to PNGs and using r.to.vect to massage them. This is really tedious and the data isn't as clean as a straight vector conversion would be. In Illustrator, I can see that all the vector math is there. That is, the PDF isn't simply a wrapper around raster data. I've tried opening the PDFs in Illustrator and exporting them as DXFs, but Grass ignores a lot of the data when I do this...they look very different in Grass once imported. I can export them as SVG from Illustrator, but surprisingly, there doesn't appear to be a single open-source tool available out there that converts SVG into some mainstream GIS file format. Does anyone have experience doing this type of conversion? Pointers welcome. ___ Check out Inkscape. Dylan ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user