SlideShare a Scribd company logo
Drupal and Outer 
Space
A Game Changer for the Geospatial Data Market 
Dauria Aerospace 
develops new ways in 
building low cost 
satellites, thus reducing 
costs for earth 
observation data 
drastically. 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
The Game Changer for the Geospatial Data Market 
Affordable Geo data allow 
small businesses to pioneer 
new business models. 
Example: 
Low cost parcel monitoring 
service for local farmers 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Building Satellites with Smartphone Technology 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Building Lightweight Satellites 
Conventional Satellite 
New Satellite 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Less Expensive Launches 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
We need a Configurable Product with a Map 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Commerce's Standard Handling of Product Variations 
http://demo.commerceguys.com/ck/tops/guy-short-sleeve-tee 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
The Customizable Products Module 
As the ancient 
Drupal Proverb goes: 
There's a module 
for that 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Configuration of References 
Content Type for the 
Product Display 
Configuration: 
Add Product Reference 
Set „Product Types that 
can be referenced“ 
to Product Type; 
Set „Add to Cart Line 
Item Type“ 
to Line Item Type 
Product Display Node 
Configuration: 
Set „Product Reference“ 
to Product 
Product Type 
Configuration: 
Set „Default Reference“ 
to Content Type 
Product 
Configuration: 
Set „Referenced by“ 
to Product 
Display Node 
Line Item Type 
Configuration: 
Set „Add to Cart Line 
Item Type“ 
to itself (self reference!) 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Validating User Inputs 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Validating User Inputs 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Validating User Inputs 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Validating User Inputs 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Validating User Inputs 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Utilizing PostGIS 
PostGIS extends PostgreSQL Databases with geodetic functions 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
The PostGIS Module integrates this Functions into Drupal 
class PostgisGeometry { 
... 
function validate() { 
$geo = is_null($this->wkt) ? $this->geometry : $this->wkt; 
try { 
$result = db_query("SELECT ST_GeometryType(:geo), ST_IsValid(:geo), ST_IsValidReason(:geo) as reason", 
array(':geo' => $geo))->fetchAssoc(); 
// Return reason if geometry is not valid. 
if (!$result['st_isvalid']) { 
return array( 
'error' => 'postgis_unparsable', 
'message' => t('Not a valid geometry: @reason.', array('@reason' => $result['reason'])), 
); 
} 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org 
... 
} 
catch (PDOException $e) { 
// TODO: catch only WKT parse errors. 
return array( 
'error' => 'postgis_unparsable', 
'message' => t('Unable to parse WKT: ' . $geo), 
); 
} 
}
But the PostGIS Module has some Weaknesses 
/** 
* Calculates diffrence to a given geometry. 
* 
* @param PostgisGeometry $geometry 
* Geometry which this instance will be compared to. 
* 
* @return PostgisGeometry 
* Geometry of diffrence. 
*/ 
function diff($geometry) { 
... 
$geo_diff = db_query("SELECT ST_Union(ST_Difference(:geo_a, :geo_b), ST_Difference(:geo_b, :geo_a))", 
array(':geo_a' => $geo_a, ':geo_b' => $geo_b))->fetchField(); 
$geo_type = db_query("SELECT GeometryType(:geo_diff)", 
array(':geo_diff' => $geo_diff))->fetchField(); 
$diff = new PostgisGeometry($geo_type, $this->srid); 
$diff->fromGeometry($geo_diff); 
return $diff; 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org 
} 
- Some important geodetic functions are not implemented 
- Error handling is inconsistent
Extending and Overwriting the PostGIS Module 
class PostgisGeometries extends PostgisGeometry { 
... 
function intersects($geometry) { 
if ((get_class($geometry) !== 'postgis_geometry') && (get_class($geometry) !== 'PostgisGeometries')) { 
throw new PostgisGeometryException('not postgis_geometry'); 
} 
try { 
$geo_a = $this->getText(); 
if(stripos($geo_a,'GEOMETRYCOLLECTION(' ) === 0) { 
$geo_a = substr(strstr($geo_a, '('),1, -1); 
} 
$geo_b = $geometry->getText(); 
if(stripos($geo_b,'GEOMETRYCOLLECTION(' ) === 0) { 
$geo_b = substr(strstr($geo_b, '('),1, -1); 
} 
$intersects = db_query("SELECT ST_Intersects(text :geo_a, text :geo_b)", 
array(':geo_a' => $geo_a, ':geo_b' => $geo_b))->fetchField(); 
return $intersects; 
} 
catch (PDOException $e) { 
throw new PostgisGeometryException( $e->getMessage( ) , (int)$e->getCode( ) ); 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org 
} 
}
Writing a module to validate the AOI and calculate the price 
function water_quality_form_alter(&$form, &$form_state, $form_id) { 
... 
$form['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt']['#element_validate'][] = 
'water_quality_aoi_validate'; 
... 
function water_quality_aoi_validate($element, &$form_state) { 
... 
$coverage_region_comparison->transform($aoi->getSrid()); 
$coverage_region_comparison->dump(); 
$intersects_google_projection = $coverage_region_comparison->intersects($aoi_comparison); 
if ($intersects_google_projection){ 
// Convert aoi to srid of the region. 
$aoi_comparison->transform($coverage_region['region']->getSrid()); 
$aoi_comparison->dump(); 
// check if the aoi intersects with the region. This needs to be 
// done in the SRID of the coverage region for accuracy. 
$within = $aoi_comparison->within($coverage_region['region']); 
if ($within){ 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org 
... 
...
The Open Layers Editor has some Bugs 
What it 
should deliver 
POLYGON((1066993.16984217 4873953.49407963, 
1340943.47921804 5392502.29411237, 
1810572.58092165 5382718.35450175, 
1979345.539345157 5106322.0602720035, 
1849708.33939679 4776114.09813913, 
1066993.16984217 4873953.49407963)) 
GEOMETRYCOLLECTION( 
POLYGON((1066993.16984217 4873953.49407963, 
1340943.47921804 5392502.29411237, 
1810572.58092165 5382718.35450175, 
1979345.539345157 5106322.0602720035, 
1849708.33939679 4776114.09813913, 
1066993.16984217 4873953.49407963)), 
POINT(1203968.324530105 5133227.894096), 
POINT(1575758.0300698448 5387610.32430706), 
POINT(1894959.0601334036 5244520.207386877), 
POINT(1914526.9393709735 4941218.079205567), 
POINT(1458350.75461948 4825033.79610938), 
POINT(1066993.16984217 4873953.49407963), 
POINT(1340943.47921804 5392502.29411237), 
POINT(1810572.58092165 5382718.35450175), 
POINT(1979345.539345157 5106322.0602720035), 
POINT(1849708.33939679 4776114.09813913)) 
What it 
sometimes 
delivers 
GEOMETRYCOLLECTION() 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
The Open Layers Editor has some Bugs 
Caching and the 
Open Layers Editor 
have an awkward 
relationship 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
The Open Layers Editor has some Bugs 
function water_quality_form_alter(&$form, &$form_state, $form_id) { 
... 
... 
function water_quality_subscription_type_validate($element, &$form_state) { 
if(!isset($element['#value']) || empty($element['#value'])){ 
drupal_rebuild_form($form_state['build_info']['form_id'], $form_state); 
} 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org 
} 
function eomap_eula_validate($element, &$form_state) { 
if(!isset($element['#value']) || empty($element['#value'])){ 
drupal_rebuild_form($form_state['build_info']['form_id'], $form_state); 
form_set_error('field_line_item_map', t('Agreement to Product EULA must be checked')); 
} 
} 
$form['line_item_fields']['field_subscription_type'][LANGUAGE_NONE]['#element_validate'][] = 
'water_quality_subscription_type_validate'; 
$form['line_item_fields']['field_eomap_eula_agreement'][LANGUAGE_NONE]['#element_validate'][] = 
'eomap_eula_validate'; 
... 
... 
}
The Open Layers Editor has some Bugs 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
The Open Layers Editor has some Bugs 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
The Open Layers Editor has some Bugs 
$form_state['no_cache'] = TRUE; 
if (isset($form_state['values']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt'])){ 
$form_state['input']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt'] = 
$form_state['values']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt']; 
} else { 
if (isset($form_state['input']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt'])){ 
$wkt = $form_state['input']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt']; 
if(stripos($wkt, 'POINT') !== false){ 
$wkt = substr(strstr($wkt, '('), 1,(stripos($wkt, ',POINT') - stripos($wkt, '(') -1)); 
} 
$form['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt']['#value'] = $wkt; 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org 
} 
} 
Some form fields mysteriously loose 
their value and need to be refilled
Wrapping it up: Placing the Geo 
Data Product in the Shopping Cart 
A Rule 
overwrites 
the line item 
price with 
the calculated 
price 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Wrapping it up: Placing the Geo 
Data Product in the Shopping Cart 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
What it's all about... 
You can build some such thing 
and even more sophisticated 
sites with Drupal modules 
and a little coding! 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
Any Questions? 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org
The End 
Спасибо за внимание 
Спасибі за увагу 
Danke für Ihre Aufmerksamkeit 
Thank you for your attention 
Translated to a select 
choice of languages 
of planet Earth: 
Martin Mayer, Diplom Systems Practitioner (Open) info@socialoom.org

More Related Content

Viewers also liked (17)

PDF
Ask not only what your Drupal can do for you, ask what you can do for your Dr...
DrupalCamp MSK
 
PPTX
Git - Вадим Валуев
DrupalCamp MSK
 
PPTX
Создание первого ИТ-кооператива в России - Станислав Новиков
DrupalCamp MSK
 
PPTX
Открытые данные, как инструмент создания собственных коммерческих приложений ...
DrupalCamp MSK
 
PDF
Freelancers Unite! - Martin Mayer
DrupalCamp MSK
 
PDF
Облачные технологии, которые упрощают жизнь разработчикам - Игорь Лукянов
DrupalCamp MSK
 
PDF
Направление: Вектор - Евгений Юртаев
DrupalCamp MSK
 
PPTX
Хуки, токены, рулсы, плагины - пишем "правильный" код под Друпал - Андрей Бе...
DrupalCamp MSK
 
PDF
Continuous integration сайтов на Drupal: Jenkins, Bitbucket, Features, Drush ...
DrupalCamp MSK
 
PDF
Создание каталога на D7 и фасетный поиск по нему - Андрей Токмаков
DrupalCamp MSK
 
PDF
jocurididactice
Natalia Gatmaniuc
 
PPTX
Drupal в облаке - Владимир Юнев
DrupalCamp MSK
 
PPTX
От фрилансера до веб-студии за 5 шагов - Геннадий Колтун
DrupalCamp MSK
 
DOC
lucrare-problematic-a-copiilor-ramasi-singuri-acasa-ca-urmare-a-parintilor-p...
Natalia Gatmaniuc
 
PPT
Опыт Drupal разработчика на бирже oDesk - Петр Лозовицкий
DrupalCamp MSK
 
PPT
Quality Control Tests for Herbal Drugs
Muhammad Asad
 
PPT
Efficacy and Potency of drug
Muhammad Asad
 
Ask not only what your Drupal can do for you, ask what you can do for your Dr...
DrupalCamp MSK
 
Git - Вадим Валуев
DrupalCamp MSK
 
Создание первого ИТ-кооператива в России - Станислав Новиков
DrupalCamp MSK
 
Открытые данные, как инструмент создания собственных коммерческих приложений ...
DrupalCamp MSK
 
Freelancers Unite! - Martin Mayer
DrupalCamp MSK
 
Облачные технологии, которые упрощают жизнь разработчикам - Игорь Лукянов
DrupalCamp MSK
 
Направление: Вектор - Евгений Юртаев
DrupalCamp MSK
 
Хуки, токены, рулсы, плагины - пишем "правильный" код под Друпал - Андрей Бе...
DrupalCamp MSK
 
Continuous integration сайтов на Drupal: Jenkins, Bitbucket, Features, Drush ...
DrupalCamp MSK
 
Создание каталога на D7 и фасетный поиск по нему - Андрей Токмаков
DrupalCamp MSK
 
jocurididactice
Natalia Gatmaniuc
 
Drupal в облаке - Владимир Юнев
DrupalCamp MSK
 
От фрилансера до веб-студии за 5 шагов - Геннадий Колтун
DrupalCamp MSK
 
lucrare-problematic-a-copiilor-ramasi-singuri-acasa-ca-urmare-a-parintilor-p...
Natalia Gatmaniuc
 
Опыт Drupal разработчика на бирже oDesk - Петр Лозовицкий
DrupalCamp MSK
 
Quality Control Tests for Herbal Drugs
Muhammad Asad
 
Efficacy and Potency of drug
Muhammad Asad
 

Similar to Drupal in aerospace - selling geodetic satellite data with Commerce - Martin Mayer (15)

PDF
Drupal and Outer space - Martin Mayer
DrupalCampDN
 
PDF
Camptocamp maps open_e_rp.key
Nico Tristan
 
KEY
Optimize drupal using mongo db
Vladimir Ilic
 
PPT
Server side geo_tools_in_drupal_pnw_2012
Mack Hardy
 
PDF
Building Location Aware Apps - Get Started with PostGIS, PART I
lasmasi
 
PDF
Pg intro part1-theory_slides
lasmasi
 
PPTX
Day 6 - PostGIS
Barry Jones
 
PPTX
PostGIS and Spatial SQL
Todd Barr
 
PDF
Geographical Data Management for Web Applications
Symeon Papadopoulos
 
PDF
State of GeoServer 2012
Jody Garnett
 
PPT
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
Steven Pousty
 
KEY
OSCON july 2011
chelm
 
PPT
Geoprocessing in Web Time (Robert Cheetham)
geeknixta
 
PPTX
Why is postgis awesome?
Kasper Van Lombeek
 
Drupal and Outer space - Martin Mayer
DrupalCampDN
 
Camptocamp maps open_e_rp.key
Nico Tristan
 
Optimize drupal using mongo db
Vladimir Ilic
 
Server side geo_tools_in_drupal_pnw_2012
Mack Hardy
 
Building Location Aware Apps - Get Started with PostGIS, PART I
lasmasi
 
Pg intro part1-theory_slides
lasmasi
 
Day 6 - PostGIS
Barry Jones
 
PostGIS and Spatial SQL
Todd Barr
 
Geographical Data Management for Web Applications
Symeon Papadopoulos
 
State of GeoServer 2012
Jody Garnett
 
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
Steven Pousty
 
OSCON july 2011
chelm
 
Geoprocessing in Web Time (Robert Cheetham)
geeknixta
 
Why is postgis awesome?
Kasper Van Lombeek
 
Ad

Recently uploaded (20)

PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
July Patch Tuesday
Ivanti
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Ad

Drupal in aerospace - selling geodetic satellite data with Commerce - Martin Mayer

  • 2. A Game Changer for the Geospatial Data Market Dauria Aerospace develops new ways in building low cost satellites, thus reducing costs for earth observation data drastically. Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 3. The Game Changer for the Geospatial Data Market Affordable Geo data allow small businesses to pioneer new business models. Example: Low cost parcel monitoring service for local farmers Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 4. Building Satellites with Smartphone Technology Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 5. Building Lightweight Satellites Conventional Satellite New Satellite Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 6. Less Expensive Launches Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 7. We need a Configurable Product with a Map Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 8. Commerce's Standard Handling of Product Variations http://demo.commerceguys.com/ck/tops/guy-short-sleeve-tee Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 9. The Customizable Products Module As the ancient Drupal Proverb goes: There's a module for that Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 10. Configuration of References Content Type for the Product Display Configuration: Add Product Reference Set „Product Types that can be referenced“ to Product Type; Set „Add to Cart Line Item Type“ to Line Item Type Product Display Node Configuration: Set „Product Reference“ to Product Product Type Configuration: Set „Default Reference“ to Content Type Product Configuration: Set „Referenced by“ to Product Display Node Line Item Type Configuration: Set „Add to Cart Line Item Type“ to itself (self reference!) Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 11. Validating User Inputs Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 12. Validating User Inputs Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 13. Validating User Inputs Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 14. Validating User Inputs Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 15. Validating User Inputs Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 16. Utilizing PostGIS PostGIS extends PostgreSQL Databases with geodetic functions Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 17. The PostGIS Module integrates this Functions into Drupal class PostgisGeometry { ... function validate() { $geo = is_null($this->wkt) ? $this->geometry : $this->wkt; try { $result = db_query("SELECT ST_GeometryType(:geo), ST_IsValid(:geo), ST_IsValidReason(:geo) as reason", array(':geo' => $geo))->fetchAssoc(); // Return reason if geometry is not valid. if (!$result['st_isvalid']) { return array( 'error' => 'postgis_unparsable', 'message' => t('Not a valid geometry: @reason.', array('@reason' => $result['reason'])), ); } Martin Mayer, Diplom Systems Practitioner (Open) [email protected] ... } catch (PDOException $e) { // TODO: catch only WKT parse errors. return array( 'error' => 'postgis_unparsable', 'message' => t('Unable to parse WKT: ' . $geo), ); } }
  • 18. But the PostGIS Module has some Weaknesses /** * Calculates diffrence to a given geometry. * * @param PostgisGeometry $geometry * Geometry which this instance will be compared to. * * @return PostgisGeometry * Geometry of diffrence. */ function diff($geometry) { ... $geo_diff = db_query("SELECT ST_Union(ST_Difference(:geo_a, :geo_b), ST_Difference(:geo_b, :geo_a))", array(':geo_a' => $geo_a, ':geo_b' => $geo_b))->fetchField(); $geo_type = db_query("SELECT GeometryType(:geo_diff)", array(':geo_diff' => $geo_diff))->fetchField(); $diff = new PostgisGeometry($geo_type, $this->srid); $diff->fromGeometry($geo_diff); return $diff; Martin Mayer, Diplom Systems Practitioner (Open) [email protected] } - Some important geodetic functions are not implemented - Error handling is inconsistent
  • 19. Extending and Overwriting the PostGIS Module class PostgisGeometries extends PostgisGeometry { ... function intersects($geometry) { if ((get_class($geometry) !== 'postgis_geometry') && (get_class($geometry) !== 'PostgisGeometries')) { throw new PostgisGeometryException('not postgis_geometry'); } try { $geo_a = $this->getText(); if(stripos($geo_a,'GEOMETRYCOLLECTION(' ) === 0) { $geo_a = substr(strstr($geo_a, '('),1, -1); } $geo_b = $geometry->getText(); if(stripos($geo_b,'GEOMETRYCOLLECTION(' ) === 0) { $geo_b = substr(strstr($geo_b, '('),1, -1); } $intersects = db_query("SELECT ST_Intersects(text :geo_a, text :geo_b)", array(':geo_a' => $geo_a, ':geo_b' => $geo_b))->fetchField(); return $intersects; } catch (PDOException $e) { throw new PostgisGeometryException( $e->getMessage( ) , (int)$e->getCode( ) ); Martin Mayer, Diplom Systems Practitioner (Open) [email protected] } }
  • 20. Writing a module to validate the AOI and calculate the price function water_quality_form_alter(&$form, &$form_state, $form_id) { ... $form['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt']['#element_validate'][] = 'water_quality_aoi_validate'; ... function water_quality_aoi_validate($element, &$form_state) { ... $coverage_region_comparison->transform($aoi->getSrid()); $coverage_region_comparison->dump(); $intersects_google_projection = $coverage_region_comparison->intersects($aoi_comparison); if ($intersects_google_projection){ // Convert aoi to srid of the region. $aoi_comparison->transform($coverage_region['region']->getSrid()); $aoi_comparison->dump(); // check if the aoi intersects with the region. This needs to be // done in the SRID of the coverage region for accuracy. $within = $aoi_comparison->within($coverage_region['region']); if ($within){ Martin Mayer, Diplom Systems Practitioner (Open) [email protected] ... ...
  • 21. The Open Layers Editor has some Bugs What it should deliver POLYGON((1066993.16984217 4873953.49407963, 1340943.47921804 5392502.29411237, 1810572.58092165 5382718.35450175, 1979345.539345157 5106322.0602720035, 1849708.33939679 4776114.09813913, 1066993.16984217 4873953.49407963)) GEOMETRYCOLLECTION( POLYGON((1066993.16984217 4873953.49407963, 1340943.47921804 5392502.29411237, 1810572.58092165 5382718.35450175, 1979345.539345157 5106322.0602720035, 1849708.33939679 4776114.09813913, 1066993.16984217 4873953.49407963)), POINT(1203968.324530105 5133227.894096), POINT(1575758.0300698448 5387610.32430706), POINT(1894959.0601334036 5244520.207386877), POINT(1914526.9393709735 4941218.079205567), POINT(1458350.75461948 4825033.79610938), POINT(1066993.16984217 4873953.49407963), POINT(1340943.47921804 5392502.29411237), POINT(1810572.58092165 5382718.35450175), POINT(1979345.539345157 5106322.0602720035), POINT(1849708.33939679 4776114.09813913)) What it sometimes delivers GEOMETRYCOLLECTION() Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 22. The Open Layers Editor has some Bugs Caching and the Open Layers Editor have an awkward relationship Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 23. The Open Layers Editor has some Bugs function water_quality_form_alter(&$form, &$form_state, $form_id) { ... ... function water_quality_subscription_type_validate($element, &$form_state) { if(!isset($element['#value']) || empty($element['#value'])){ drupal_rebuild_form($form_state['build_info']['form_id'], $form_state); } Martin Mayer, Diplom Systems Practitioner (Open) [email protected] } function eomap_eula_validate($element, &$form_state) { if(!isset($element['#value']) || empty($element['#value'])){ drupal_rebuild_form($form_state['build_info']['form_id'], $form_state); form_set_error('field_line_item_map', t('Agreement to Product EULA must be checked')); } } $form['line_item_fields']['field_subscription_type'][LANGUAGE_NONE]['#element_validate'][] = 'water_quality_subscription_type_validate'; $form['line_item_fields']['field_eomap_eula_agreement'][LANGUAGE_NONE]['#element_validate'][] = 'eomap_eula_validate'; ... ... }
  • 24. The Open Layers Editor has some Bugs Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 25. The Open Layers Editor has some Bugs Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 26. The Open Layers Editor has some Bugs $form_state['no_cache'] = TRUE; if (isset($form_state['values']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt'])){ $form_state['input']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt'] = $form_state['values']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt']; } else { if (isset($form_state['input']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt'])){ $wkt = $form_state['input']['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt']; if(stripos($wkt, 'POINT') !== false){ $wkt = substr(strstr($wkt, '('), 1,(stripos($wkt, ',POINT') - stripos($wkt, '(') -1)); } $form['line_item_fields']['field_line_item_map'][LANGUAGE_NONE][0]['wkt']['#value'] = $wkt; Martin Mayer, Diplom Systems Practitioner (Open) [email protected] } } Some form fields mysteriously loose their value and need to be refilled
  • 27. Wrapping it up: Placing the Geo Data Product in the Shopping Cart A Rule overwrites the line item price with the calculated price Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 28. Wrapping it up: Placing the Geo Data Product in the Shopping Cart Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 29. What it's all about... You can build some such thing and even more sophisticated sites with Drupal modules and a little coding! Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 30. Any Questions? Martin Mayer, Diplom Systems Practitioner (Open) [email protected]
  • 31. The End Спасибо за внимание Спасибі за увагу Danke für Ihre Aufmerksamkeit Thank you for your attention Translated to a select choice of languages of planet Earth: Martin Mayer, Diplom Systems Practitioner (Open) [email protected]