7 Spatial Database Tips for PostGIS, Oracle, & SQL Server


Published on

Become a database dynamo with these productivity-boosting tips. Discover how to connect your spatial database with 325+ data sources - including tabular, raster and GIS – without any coding. You'll see how to spatialize ordinary data, view it on a map, and learn about automated techniques for updates/deletes, edit/change detection, as well as data validation.

Published in: Software
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Welcome to our webinar - 7 Spatial Database tips for Postgis, Oracle and SQL Server
  • Welcome to our 7 Spatial Database tips webinar. My name is Robyn Rennie and with me is Steve McCabe. We are both members of the Professional Services team here at Safe Software and deal with many of the database cases which make their way into our support group. Today we are going to show a number of techniques for working with databases that you may not have run across in your daily work with FME. So to add variety we are going to work with the three major non-esri database formats that we deal with and we will mention as we are doing the demonstrations if a particular demo is specific for a particular format.
  • RR - We love to get questions throughout the webinar so feel free to ask away by typing questions into the webinar panel as shown. Today we have a truly International team ready to answer your questions - on line with us today are Mark Stoakes, Ryan Cragg and Ken Bragg and we need to keep them busy so fire away. They are ready and willing to help you out..

    Any questions which we don’t get to in the next hour we will be following up with you later today. Also this session is being recorded and the workspaces, slides and audio will be emailed to you after the event.

  • RR - For those of you that aren’t familiar with FME we are the leading spatial translation tool. We allow you to connect to over 350 formats, transform your data as you move it from one format into another - or even from one format back into the same format and we also have the capability of automating those kinds of transformation processes.
  • RR - Stick with us if you are new to FME - however here are a couple of links which provide great resources for getting started. We give a weekly live product demo which is free to sign up for and have multiple online courses, tutorials etc all to assist you in getting started with the product.

    However this is an advanced technical webinar so we are not going to be covering beginner concepts today -

    http://www.safe.com/learning/training/on-demand/tutorials/#spatialdatabase - although this is written in FME 2013 the concepts are all the same - some of the screenshots may differ slightly. This is an excellent guide for getting started.
  • RR - So, lets say, we work for the BC government and have been tasked with collecting data from each of the municipalities in the province. They are to provide us with a file Geodatabase of municipal data such as, at a minimum, land boundaries, neighbourhoods, grid for their orthophotos, parks, streets and traffic lights. We are required to load this into a staging database hosted on one of our enterprise servers so that we can examine it prior to loading it into our production database which has a fixed schema model.

    We want to be able to update this staging database, view it in a variety of different viewers - depending on which department is going to be looking at the data and then refine it as we move it into production.

    It would also be nice to be able to automate this step so that as each municipality complies we just have to point to a new geodatabase and away we go.

    Do you think we can come up with something that will work - and of course it has to be implemented by tomorrow afternoon!
  • RR - So I decided to play with the Dynamic options in FME Workbench - these are available at the time you generate the workspace. The City of Vancouver has already provided us with the first sample geodatabase and I presume it has the required feature types in it. Because we are a multi cultural province we are going to show tips of how to work with this data in three of the major database formats.

    So to start with lets generate a workspace - Geodatabase to Oracle - select Dynamic schema. Notice that I only get one reader feature class and one writer feature class - neither of which have feature class names on them - point out the Feature Types to read published parameter and how the Dynamic writer is setup to use the originating data schema.

    Now open the sample workspace which shows writing to all three databases.

    Point out Feature Types to read - prompt and run allows me to pick which feature types I want

    Dynamic writer - show
    Oracle - General properties, schema coming from production database because we want uppercase feature class names and attribute., attributes to remove due to geodb attributes, don’t need to worry about feature geometry
    SQL Server - destination coordinate system to LL, geography datatype, attributes to remove
    Postgis - lowercase attributes, attributes to remove

    Giving control to the writer - it bases the feature classes on the incoming feature classes and their schema on how they were defined in the Geodatabase.

    Great for loading into a staging DB - we will see how to work with this in a later example.
  • RR - ok - so now we have our data in a staging database and immediately it is out of date - along comes a cad file showing which traffic lights are not working in the city which could be considered to be a crisis so we need to get the data updated as soon as possible. We even have one traffic signal which we are going to remove!

    This example shows the use of our new DatabaseUpdater and DatabaseDeleter transformers - which make simple updates like this much easier.

    ChangeDetector can be used for more complex Change detection - however it is very important to understand your data. In this case - Deleted - doesn’t actually mean deleted - it just means these features weren’t in the revised file. And Unchanged - actually means these are the ones which need to be updated.

    FeatureReader/FeatureMerger can also be used to determine changes between data sources but again it is important to understand your data. Use of the CRCCalculator is also recommended for comparing attributes and geometry

  • When working with Oracle, GeoMedia requires the GDOSYS schema to be present in the database and the metadata exists. The metadata data can be added using GeoMedia’s Database Utilities…. and that’s it, now you can view the data or edit if you wish from within GeoMedia Pro.
  • SchemaMapper shows how to map attribute names to new required names and map incoming feature type names to new names

    Dynamic writer then reads the fixed schema from an external CSV file to build the tables to the required layout.

    Start showing the csv files of attribute mappings and then schema mapping - show Schema from table reader as a resource. vs AttributeValueMapper

    Send out this link
    and this link

  • Take the Parks data and extract centerpoints as LL coordinates and output multiple geometry features combining polygons/points geometry/geography

    Handle Multiple spatial columns on reader
    Aggregator and deaggregator
    Multiple geometry setter transformer

    Show table in MS SQL Management studio
    Also SQL Statement to start - which builds the table.

  • Once again what did we do special in our data to enable the ability to view the data in ArcMap? Unique integer key field.

    Can also drag Geometry and Geography datasets into ArcMap and they will reproject correctly. Just can’t handle the multiple geometry data - picks the first geometry type that it finds

    No editing capability

  • 1 - -bulk loading of data into tables which participate in a parent/child relationship - show it failing first - i.e. adding new data that doesn’t have a parent entry

    2 - showing how to turn off constraints and then enable after the fact.

    3 - Multiple writer - managing writer order - loading new keys and then loading data - navigator pane, feature holder, feature read on reference table to check for existing reference entries

    talk about spinning off bad records to a csv writer?
  • Three ways to hold rasters

    - using the Postgis Raster writer
    - as a BLOB in a vector record - using the AttributeFileReader to read the data
    - as a footprint bounding box with a link to the file location
  • Dynamic workspaces are extremely powerful especially when combined with the SchemaMapper transformer for working with pre-defined schema.

    Updating and deleting some of the options available

    Oracle and SQL Server support multiple geometry features - even across coordinate systems. Postgis doesn’t yet but by issuing a custom SQL Select statement it is possible to read in just the required geometry.

    Working with the Constraints and Foreign keys in the PostGIS Database - works the same for the other formats. Remember that the SQL Steve is using is specific to Postgis - you will need to modify it to work with your database

    Loading Raster/images data in PostGIS - good for small amounts of data - I am not sure what Refractions recommends but for loading the Orthophotos associated with the Vancouver City data it would be better to load them as footprints with pointers.

    Easy to read any of these formats in other 3rd party applications such as Geomedia, ArcMap, KML - etc

  • Database training coming up in October: http://www.safe.com/learning/training/course-schedule/registration/?class=CLS06619

    Lots of new enhancements to make working with Databases easier in FME 2015 - Named connections - way better handling of the Writer Mode / fm_db_operation and fme_where attributes.
  • 7 Spatial Database Tips for PostGIS, Oracle, & SQL Server

    1. 1. Demos Dynamic loading of data - unknown source feature types - quick and powerful data loading
    2. 2. Demos (Oracle) Updating and Deleting - New transformers DatabaseUpdater DatabaseDeleter - Feature Reading to find Key values
    3. 3. Demos (Oracle) Viewing with Geomedia
    4. 4. Demos (SQL Server) SchemaMapping - Adding value to a Dynamic workspace - Fixed schema database models
    5. 5. Demos (SQL Server) Multiple Geometry - Reading/Writing - Displaying
    6. 6. Demos (SQL Server) Viewing with ArcMap
    7. 7. Demos (Postgis) Constraints - Primary key/foreign key - SQL before/after translation
    8. 8. Demos (Postgis) Two ways to hold Rasters - BLOB fields - Postgis Raster writer
    9. 9. Demos (Postgis) Viewing in KML