Wednesday, February 25, 2015

AutoCAD import x,y,z csv data points

How to import a text file of CSV data with x,y, z  3D points.


I though this might be hard but its really not.  The most work is in preparing the data.


  1. Create a clean CSV text file with only x,y,z values like this with NO headers:

521864.4,162152.5,447.17
    521870.7,162152.7,447.12
      521877.9,162153,447.11
        521884.8,162153,447.16
          521891.4,162153,447.13

          the first column is the X coordinate, second column is the Y coordinate, and the third column is the Z coordinate, all separated by a comma  ,

          it is important to note that I am using ACAD 2011 German (Deutsch).  This means your coordinates must be with a .  decimal separator NOT a comma, which is normally the case with German coordinates and numbers.


             2. Open ACAD with an empty template
             3. Click create POINT
             4. Copy the text file contents with STRG-C     or CTRL-C on english keyboard
             5. Then PASTE directly into the command line with STRG-V  or CTRL-V
             6. Hit escape
             7. Save your new DWG  with save
              8. DONE


          This was easy but not intuitive on my first attempt :)

          cheers
          Michael

          Tuesday, February 10, 2015

          Django GeoDjango deploy on windows server 2012 R2 IIS 8

          The battle is set me vs IIS on Windows Server 2012 R2!!

          Battle Description:  install django 1.7.4, geodjango on IIS 8.5

          Lets start with a BIG thanks to cstoker as  http://www.youtube.com/watch?v=kXbfHtAvubc  this was the best starting point to my adventure.  Please watch this video first.  Then follow along to install the remaining magic steps to get geodjango working on your windows server with IIS.

          1. Install OSGeo4W

          First you must INSTALL OSGeo4W  http://trac.osgeo.org/osgeo4w/  and install using custom methods to only select the "libs" gdal and co.  See GeoDjango install instructions here https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#windows 

          2. Update environment variables

          Then all you need to update are the environment variables .  Like here Screenshots below !

          1.  WSGI_HANDLER                            django.core.wsgi.get_wsgi_application()
          2. GDAL_DATA                                   C:\OSGeo4W64\share\gdal
              PROJ_LIB                                         C:\OSGeo4W64\share\proj
               PATH                                                C:\OSGeo4W64\bin


          Interesting Links:

          1 -  http://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-django-app/#troubleshooting-static-files
          2 - http://mrtn.me/blog/2012/06/27/running-django-under-windows-with-iis-using-fcgi/
          3- http://www.toptal.com/django/installing-django-on-iis-a-step-by-step-tutorial
          4. https://github.com/Microsoft/PTVS/wiki/wfastcgi  (Django specific)




          Here are some of my own text notes for easy copy paste:

          # add fast CGI Application

          # Full Path:
          C:\Python27\python.exe

          # Arguments appname is the root for example the first  /django_proj/django_proj
          C:\inetpub\webs\appname\wfastcgi.py

          # add module mapping
          #request path enter * in the field
          *
          # Module
          select fastcgi from list

          #Executable
          C:\Python27\python.exe|C:\inetpub\webs\appname\wfastcgi.py

          #Name
          Django Handler

          # Click Request Restrictions
          go and UN-SELECT Mapping invoke handler only if request is mapped to:

          # windows 2012 server using plain jane python global install

          # EnvironmentalVariables Collection Editor
          # here you need to add all of these key : value pairs NOT including the space or :

          KEY                                                    VALUE
          DJANGO_SETTINGS_MODULE    appname.settings
          PYTHONPATH                                 C:\Inetpub\wwwroot\appname_root
          WSGI_HANDLER                            django.core.wsgi.get_wsgi_application()
          GDAL_DATA                                   C:\OSGeo4W64\share\gdal
          PROJ_LIB                                         C:\OSGeo4W64\share\proj
          PATH                                                C:\OSGeo4W64\bin

          Screenshots










          django-admin-bootstrapped

          Also if you are using bootstrap and the django-admin-bootstrapped you will need to add the font mime type to your web.config  file in the main folder.

           If you want to use the GUI click your site in IIS then click "MIME Types", then on the right click add, followed by entering File name extension to    .woff2   and the MIME type:   set too        font/x-woff2    click ok then done.

          <?xml version="1.0" encoding="UTF-8"?>
          <configuration>
              <system.webServer>
                  <handlers>
                      <add name="Django Handler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python27\python.exe|C:\inetpub\webs\utc_django\wfastcgi.py" resourceType="Unspecified" />
                  </handlers>
                  <httpErrors errorMode="Detailed" />
                  <staticContent>
                      <mimeMap fileExtension=".woff2" mimeType="font/x-woff2" />
                  </staticContent>
              </system.webServer>
          </configuration>

          Deploy Django Script to IIS


          Now once this MOOO fuss is done you can run this script on the server to deploy my code from the local subversion repository to the live IIS inetpub directory.

          BIG NOTE:  once done you NEED to REMOVE the Django Handler on the folder STATIC because after each new deploy this folder inherits the IIS Handler Mappings from the parent !!!!  Meaning your STATIC files do not work !